Jump to content

5.2.4 Not an Array ERROR Message


Recommended Posts

It's hopefully a previously edited version that I have updated incorrectly, but I'm getting this error when I opening the Dashboard.

 

[08-Oct-2013 17:45:30 UTC] PHP Warning:  array_merge() [<a href='http://docs.php.net/manual/en/function.array-merge.php'>function.array-merge.php</a>]: Argument #1 is not an array in /XXXXX/public_html/plushcatalog/classes/seo.class.php on line 230

 

Any idea what I've done wrong?

Link to comment
Share on other sites

That section of code has not changed as of CC522. If this happens consistently, then enable debug mode and look for a query such as:

SELECT * FROM CubeCart_seo_urls WHERE path = something.

 

There may be several, but one will have a path that is definitely not legitimate.

 

If that does not reveal anything, then in CC524, line 229, after:

$item_vars = $this->_getItemVars($item[0]['type'], $item[0]['item_id']);

Add:

trigger_error('Trying to array_merge ' . print_r($item_vars,true) . 'from' . print_r($item,true));

Link to comment
Share on other sites

[08-Oct-2013 20:00:37 UTC] PHP Warning:  array_merge() [<a href='http://docs.php.net/manual/en/function.array-merge.php'>function.array-merge.php</a>]: Argument #1 is not an array in /XXXXXXX/public_html/plushcatalog/classes/seo.class.php on line 230

[08-Oct-2013 20:02:12 UTC] PHP Notice:  Trying to array_merge Array

(

    [_a] => product

    [product_id] => 2639

)

fromArray

(

    [0] => Array

        (

            [id] => 2765

            [path] => disney-large-pink-chenille-core-piglet-hot-pink-stripe-velour-body

            [type] => prod

            [item_id] => 2639

        )

)

 in /home3/butter01/public_html/plushcatalog/classes/seo.class.php on line 231

 

I checked that product, and the image appears to be OK. The next time I cleared the error log and refreshed the Product Summary I found a category instead of a product in the error message.

 

I looked at the error log too soon. After giving it some time it did create a long list of fromArray info.

Link to comment
Share on other sites

This is now a real functionality issue for me. Contact Us is not working, and it's this same error, except the page is crashing this time.
 

[Notice] /XXXXXXx/public_html/plushcatalog/classes/seo.class.php:231 - Trying to array_merge Array ( [_a] => contact ) fromArray ( [0] => Array ( [id] => 368 [path] => contact-us [type] => contact [item_id] => 0 ) )
[Warning] /XXXXXXXX/public_html/plushcatalog/includes/lib/smarty/sysplugins/smarty_resource.php:349 - filemtime() [function.filemtime.php]: stat failed for /XXXXXXXX/public_html/plushcatalog/skins/blueprint/templates/content.contact.php
[Warning] /XXXXX/public_html/plushcatalog/includes/lib/smarty/sysplugins/smarty_resource.php:349 - filemtime() [function.filemtime.php]: stat failed for templates/content.contact.php
[Exception] /XXXXXXXXXX/public_html/plushcatalog/includes/lib/smarty/sysplugins/smarty_internal_templatebase.php:127 - Unable to load template file 'templates/content.contact.php'

 

I have a mod that my be causing this, as it's not working on the front end product listing. Ask about a product is the mod, but there are so many variations on this error message I'm having second thoughts that this mod is the cause. I disabled it and still got the crash. Will comment out the code and see what that does.

 

[Notice] XXXXXXXXX/public_html/plushcatalog/classes/seo.class.php:231 - Trying to array_merge fromArray ( [0] => Array ( [id] => 6428 [path] => large-pink-mama-pig-flower-hair-bow-collar-5-babies-zipper-tummy-askabout-3257 [type] => askabout [item_id] => 3257 ) )

 

Link to comment
Share on other sites

I'm seeing changed code in cubecart.class.php that sure looks like it's at least related to my problem. Maybe one of my mods or edits doesn't like this change:

	$meta_data	= array(
					'name'			=> $contents['doc_name'],
					'path'			=> null,
					'description'	=> $contents['seo_meta_description'],
					'keywords'		=> $contents['seo_meta_keywords'],
					'title'			=> $contents['seo_meta_title'],
				);

				$GLOBALS['seo']->set_meta_data($meta_data);

The old code had

'path' => $GLOBALS['seo']->getdbPath('doc', $doc_id),
Link to comment
Share on other sites

Unable to load template file 'templates/content.contact.php'

 

That's bad. Very bad.

 

 

Array ( [0] => Array (
  [id] => 6428
  [path] => large-pink-mama-pig-flower-hair-bow-collar-5-babies-zipper-tummy-askabout-3257
  [type] => askabout
  [item_id] => 3257
)

 

In a stock CC5, there is no type of item (not a literal item) called 'askabout'. So there must have been an edit to the function _getItemVars (line 749 in seo.class.php).

 

Please examine that function from your last known working codebase.

Link to comment
Share on other sites

Well, I found the issue in seo.class.php that was causing the Contact Us issue, and now Ask About a Product is working properly, as well as Contact Us. Phew!

 

BUT, now my 5.2.4 version of seo.class.php only has your debug code and the change to remove index.php if last chars in URL - otherwise it's the same as back in June. And the same error messages continue to accumulate.

 

Maybe I messed up the upgrade of another file. Any suggestions where I should look?

Link to comment
Share on other sites

Which errors are still getting logged? The array_merge error?

 

I cannot explain why PHP is reporting this error as $item_vars is an array, but try this, near line 230:

From:

$_GET = (is_array($_GET)) ? array_merge($item_vars, $_GET) : $item_vars;

To:

$_GET = (is_array($_GET)) ? array_merge((array)$item_vars, $_GET) : $item_vars;

Link to comment
Share on other sites

This is what I'm still getting:

[09-Oct-2013 16:22:38 UTC] PHP Notice:  Trying to array_merge Array
(
    [_a] => product
    [product_id] => 2981
)
fromArray
(
    [0] => Array
        (
            [id] => 2988
            [path] => ty-2002-pluffies-rust-tan-brown-white-whiffer-dog
            [type] => prod
            [item_id] => 2981
        )

)

 

I'll try your code change and report back.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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...