Jump to content

Keep getting this PHP Warning


Claudia M

Recommended Posts

Running 6.2.0

I keep getting this PHP Warning in my error log.  The file is stock. 

[14-May-2018 23:50:21 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 /home/claudias/public_html/classes/seo.class.php on line 357

[15-May-2018 01:14:18 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 /home/claudias/public_html/classes/seo.class.php on line 357

Here is my line 357 and more:

foreach ($GLOBALS['hooks']->load('class.seo.getitem.parameters') as $hook) include $hook;

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

                                                            if ($url) {

                                                                           return $GLOBALS['storeURL'].'/index.php?'.http_build_query($_GET);

                                                            } else {

                                                                           return true;

                                                            }

                                             } else {

                                                            $_GET['_a'] = '404';

                                             }

                              } else {

                                             httpredir('index.php');

                              }

               }

Link to comment
Share on other sites

Nothing has changed in that area of the file since CC6114, and I do not get that error.

Do you have any plugins that would use "class.seo.get_item_vars"? You can determine this by looking in the /hooks/ folder of any suspect plugin.

Link to comment
Share on other sites

Please mention which plugins these are. I do not see how the hook code would need any upgrading, but I can't be sure.

There is another hook that could interfer - class.seo.getitem.parameters. If it disturbs $item_vars, this also could explain the error message.

The problem may cause some anomalies, however I think not any dire consequences.

Link to comment
Share on other sites

If you are interested in solving this, make the following edit in /classes/seo.class.php:

Near line 356, find:

foreach ($GLOBALS['hooks']->load('class.seo.getitem.parameters') as $hook) include $hook;

Change to:

$GLOBALS['debug']->debugMessage('Before Hook'.print_r($item_vars,true));foreach ($GLOBALS['hooks']->load('class.seo.getitem.parameters') as $hook) include $hook;$GLOBALS['debug']->debugMessage('After Hook'.print_r($item_vars,true));

Then, in admin, Store Settings, Advanced tab, enable debugging and enter your IP address in the adjacent field (www.whatismyip.com). Save.

For every page load, there will be a grey area at the bottom of the page. At the bottom of the grey area, there will be a Debug Messages area.

Visit a few pages and when the error is triggered, examine the Debug Messages.

Link to comment
Share on other sites

I checked every different type of page and here is an example of the debug messages and there is nothing new in my error log:

Debug Messages:

[0] Before HookArray ( [_a] => contact )

[1] After HookArray ( [_a] => contact )

Debug Messages:
[0] Before HookArray ( [_a] => category [cat_id] => 131 )
[1] After HookArray ( [_a] => category [cat_id] => 131 )

Debug Messages:
[0] Before HookArray ( [_a] => product [product_id] => 1001 )
[1] After HookArray ( [_a] => product [product_id] => 1001 )

Link to comment
Share on other sites

Yes - Nothing new in Error Log

Debug Messages:
[0] Before HookArray ( [_a] => sitemap )
[1] After HookArray ( [_a] => sitemap )

Debug Messages:
[0] Before HookArray ( [_a] => testimonials )
[1] After HookArray ( [_a] => testimonials )

Debug Messages:
[0] Before HookArray ( [_a] => add_testimonial )
[1] After HookArray ( [_a] => add_testimonial )

In admin looking at the error log page I have this in debug if this means anything.  Remember I have PHP notices surpressed in the control panel error log

PHP:
[Notice] /home/claudias/public_html/admin_YYines/sources/settings.errorlog.inc.php:63 - Undefined variable: smarty_data

 

Edited by Claudia M
More info
Link to comment
Share on other sites

"Remember I have PHP notices surpressed in the control panel error log."

How did you do that? When CubeCart's debug mode is disabled, Notices do not get logged. But when debug mode is enabled, then everything gets logged.

Like a dog with a bone, my next step would be to look at your site's web access log. Find the access that happened at 14-May-2018 23:50:21 UTC and 15-May-2018 01:14:18 UTC. (Your access logs may be timed using the server's local timezone, so be sure to adjust for timezone differences to UTC.)

Link to comment
Share on other sites

"Remember I have PHP notices surpressed in the control panel error log."

It was some code you gave me for 6.1xxx because I was getting soooo many notices in the log.  Should I remove it?  You got any idea what time that would be for USA Louisville eastern time.  For the life of me I can figure that out. 

Link to comment
Share on other sites

If you're on Windows, get 7-Zip (www.7-zip.org). It will decompress the GZ to the TAR. You then make another decompress to a plain text file.

I would think, if the server doesn't log UTC by default, then the it would be where the server is located. Probably.

We will have to look at the log file.

Link to comment
Share on other sites

For each line, there should be a time given.

[15/May/2018:21:37:26 -0700] which is (the time shown is UTC-7) Pacific DST

The UTC time is 16/May/2018:04:37:26.

So, to get back to UTC: my time (21:37) plus 7 hours is UTC (28:37), or 04:37 tomorrow.

Eastern is -4 from UTC, so you add back the four hours from Eastern to get to UTC.

However, pay attention to the time shown on the log entry. You must use the offset to add back the hours to get UTC.

If there is no offset, the the web access log entries may already be at UTC.

Link to comment
Share on other sites

Could this be what we’re after? I use to have Daren’s Product Review Plugin installed until we figured out it wouldn’t work well with my store – vintage, mostly one of an item and then listing removed when sold so the review is gone too. Great plugin though! But I deleted that plugin quite awhile back and went with the Site Testimonials plugin instead.

 

RAW ACCESS LOG ENTRIES

207.46.13.146 - - [15/May/2018:00:50:21 +0100] "GET /productreviews.html HTTP/1.1" 200 17662 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"

 

157.55.39.92 - - [15/May/2018:02:14:18 +0100] "GET /addproductreview.html HTTP/1.1" 200 17669 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"

 

ORIGINAL PHP WARNINGS

[14-May-2018 23:50:21 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 /home/claudias/public_html/classes/seo.class.php on line 357

[15-May-2018 01:14:18 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 /home/claudias/public_html/classes/seo.class.php on line 357

Link to comment
Share on other sites

Those are them! Good work!

So a search engine (Bing) is re-verifying pages it had indexed in the past is still valid.

Now we can confidently say that the situation is this:

When the PR plugin was installed, the database table CubeCart_seo_urls acquired a record where the 'path' value is "productreviews". (Elsewhere, the "addproductreview" gets dealt with, but there could be a record where the 'path' value is "addproductreview".)

Since it is a found seo path, CubeCart then tries to construct the array $item_vars from it, but fails. Hence, the error message.

Personally, I would use phpMyAdmin to delete those records from CubeCart_seo_urls.

Recent versions of CubeCart has added a function in admin, Maintenance, Rebuild tab, to "Clear all auto generated SEO URLs". But we presumably only need to deal with these two paths.

Edited by bsmither
Link to comment
Share on other sites

Hey Brian,

Just thought you’d like to know this.  I disabled the Site Testimonial Plugin in my store.  I did not delete it – and I got the first and last errors in my log. So the error happens if the plugin is deleted or disabled.  The second error is something I had discussed with you before, but now I found the entry in the log that matches it.  I don’t know where vieworder&cart_lookup comes from.  Anything to worry about? I’ll delete the testimonial entries in the seo database as I did with the reviews.

1.      Error Log

[17-May-2018 00:33:53 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 /home/claudias/public_html/classes/seo.class.php on line 357

Raw Access Log Entry

40.77.167.205 - - [17/May/2018:01:33:53 +0100] "GET /testimonials.html HTTP/1.1" 200 17428 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"

2.      Error Log

[17-May-2018 00:35:56 UTC] PHP Warning:  Security Warning: Illegal array key "cart_lookup}" was detected and was removed. in /home/claudias/public_html/classes/sanitize.class.php on line 111

Raw Access Log Entry

207.46.13.96 - - [17/May/2018:01:35:56 +0100] "GET /index.php?_a=vieworder&cart_lookup} HTTP/1.1" 200 15541 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"

3.      Error Log

[17-May-2018 00:36:00 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 /home/claudias/public_html/classes/seo.class.php on line 357

Raw Access Log Entry

207.46.13.96 - - [17/May/2018:01:36:00 +0100] "GET /addtestimonial.html HTTP/1.1" 200 17426 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"

Edited by Claudia M
styling
Link to comment
Share on other sites

I posted this issue in the Github: https://github.com/cubecart/v6/issues/2033

The, Illegal array key "cart_lookup}", appears to have been a mistake in the skin coding, where a language key was not formed properly. I do not find 'cart_lookup' as a complete or partial phrase key in CC4/5/6. So, it may be part of a plugin's language file.

Link to comment
Share on other sites

Could it be something old that has been removed?  I dont't remember doing this specifically, but I have changed some of my {$Lang} coding (you know what I mean) to actual wording. It seems that when I put the Track Order in my header I may have worded the link something like that  ....."cart_lookup" but then changed  it. It's kinda foggy though.

Link to comment
Share on other sites

The reason the Sanitizer rejected it is because of the right-brace.

So, the Smarty variable may have been missing it's left-brace, such as (only to illustrate - not the actual fault):
BAD: $LANG.module.cart_lookup}
GOOD: {$LANG.module.cart_lookup}

And, it's a BingBot, so, yes, it could be old.

Edited by bsmither
Link to comment
Share on other sites

I don't know if this is related, don't think so - not SEO, but I got this error in my log this morning.  The plugin is the free one from Daren which was deleted before I upgraded to 6.2.0

[18-May-2018 12:27:21 America/Louisville] PHP Notice:  Error: Hook 'SFWS_Product_Dimensions/hooks/class.cubecart.display_product.php' was not found in /home/claudias/public_html/classes/hookloader.class.php on line 288
[18-May-2018 12:28:30 America/Louisville] PHP Notice:  Error: Hook 'SFWS_Product_Dimensions/hooks/class.cubecart.display_product.php' was not found in /home/claudias/public_html/classes/hookloader.class.php on line 288
[18-May-2018 12:28:51 America/Louisville] PHP Notice:  Error: Hook 'SFWS_Product_Dimensions/hooks/class.cubecart.display_product.php' was not found in /home/claudias/public_html/classes/hookloader.class.php on line 288
[18-May-2018 12:30:36 America/Louisville] PHP Notice:  Error: Hook 'SFWS_Product_Dimensions/hooks/class.cubecart.display_product.php' was not found in /home/claudias/public_html/classes/hookloader.class.php on line 288
[18-May-2018 12:31:22 America/Louisville] PHP Notice:  Error: Hook 'SFWS_Product_Dimensions/hooks/class.cubecart.display_product.php' was not found in /home/claudias/public_html/classes/hookloader.class.php on line 288
[18-May-2018 12:31:24 America/Louisville] PHP Notice:  Error: Hook 'SFWS_Product_Dimensions/hooks/class.cubecart.display_product.php' was not found in /home/claudias/public_html/classes/hookloader.class.php on line 288

I don't know if this makes a difference, but for about a minute my store, admin, ftp, cpanel would not load.  Timed out.  When it came back it was showing the claudiasbargains skin I used in 6.1.4 and it showed in admin so I just changed it to my current skin.

Edited by Claudia M
More Info
Link to comment
Share on other sites

Regarding your last point, you may want to query your hosting provider. I would be worried that this could be a backup restore, and that orders have gone missing.

I am hoping that there comes a version of CubeCart that does a proper deletion of plugins. In admin, Manage Extensions, there is a Delete icon for Extensions. But I am not sure how complete the deletion is.

What I would do is to rummage through the database (CubeCart_config, Cubecart_modules, CubeCart_hooks) and delete the appropriate records.

Or, you can re-install the plugin, then properly set its Status to off and Delete it. (Whether that works, I haven't tried.)

Edited by bsmither
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...