Jump to content

PHP Array Error??


Recommended Posts

Hello all,

 

I have just downloaded a home banner module for opencart and after trying to get in touch with the original author, it looks like his not supporting his work correctly and im stuck with TWO PHP errors.

 

Warning: Invalid argument supplied for foreach() on line 22. Warning: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag on line 25.

 

The code is as follows:-

 

<?php
/*
Homepage Slideshow v1.0
Brought to you by Readyman - www.alreadymade.com
*/

class ControllerModuleHomepageslideshow extends Controller {

protected function index() {
	//$this->language->load('module/homepageslideshow');
    	//$this->data['heading_title'] = $this->language->get('heading_title');
	//$this->load->model('tool/seo_url');

        $this->data['config_url'] = $this->config->get('config_url');
        $this->data['delay'] = $this->config->get('homepageslideshow_delay');
        $this->data['speed'] = $this->config->get('homepageslideshow_speed');
        $this->data['pause'] = $this->config->get('homepageslideshow_pause');
        $this->data['height'] = $this->config->get('homepageslideshow_height');
        $this->data['width'] = $this->config->get('homepageslideshow_width');

        $a = unserialize($this->config->get('homepageslideshow_slide_image'));
        foreach ($a as $key => $row) {
            $sorting[$key]  = $row['sortorder'];
        }
        array_multisort($sorting, SORT_ASC, $a);
        $this->data['slide_images'] = $a;
	$this->id = 'homepageslideshow';

	if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/homepageslideshow.tpl')) {
		$this->template = $this->config->get('config_template') . '/template/module/homepageslideshow.tpl';
	} else {
		$this->template = 'default/template/module/homepageslideshow.tpl';
	}

	$this->render();
    }



}

 

 

any help would be greatly appreciated!!

Link to comment
Share on other sites

The error is stemming from this:

$a = unserialize($this->config->get('homepageslideshow_slide_image'));

 

Either the return values for that function are not serialized or is empty/false.  Try echo'ing/dumping the results to see what's being returned.

Link to comment
Share on other sites

Thanks for the reply! Is there anyway i could remove that or simply change the way its written. The actual application itself works. I think they are just warning errors.

 

How would you go about changing that function?

 

I'm not hot on PHP, that's why i have posted lol.

 

An help would be great!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.