Jump to content

PHP Notices and Warnings since Upgrade to CC6.1.10


Claudia M
 Share

Recommended Posts

So since I updated to 6.1.10 I have gotten these PHP notices, warnings, etc. in my error log – more than once.  Anything here to worry about?  Also, if notices aren’t that big of a deal is there anyway to turn them off so they don’t get reported in the error log?  Or is that a bad idea. Thanks, Claudia

 

[07-Sep-2017 13:59:57 America/Louisville] PHP Warning:  No customer information detected. Order summary was not built or inserted. in /home/claudias/public_html/classes/order.class.php on line 1170

 

[07-Sep-2017 18:05:36 UTC] PHP Warning:  Invalid Security Token in /home/claudias/public_html/classes/sanitize.class.php on line 152

 

[07-Sep-2017 14:19:23 America/Louisville] PHP Warning:  Invalid argument supplied for foreach() in /home/claudias/public_html/classes/ajax.class.php on line 143

 

[07-Sep-2017 14:21:43 America/Louisville] PHP Warning:  curl_setopt() [<a href='http://docs.php.net/manual/en/function.curl-setopt.php'>function.curl-setopt.php</a>]: Disabling safe uploads is no longer supported in /home/claudias/public_html/modules/plugins/SFWS_Automatic_Social_Media_Posts/api/pinterest/src/Pinterest/Utils/CurlBuilder.php on line 53

 

This warning I got before:  I think it has to do with the way I sort my products. But they sort correctly so I don’t bother with it

[07-Sep-2017 18:54:39 UTC] PHP Warning:  Security Warning: Illegal array key "sort%5Bdate_added%5D" was detected and was removed. in /home/claudias/public_html/classes/sanitize.class.php on line 113

 

[07-Sep-2017 11:34:39 America/Louisville] PHP Notice:  Undefined variable: title in

/home/claudias/public_html/classes/seo.class.php on line 506

 

[07-Sep-2017 11:55:11 America/Louisville] PHP Notice:  Undefined index:  in

/home/claudias/public_html/classes/catalogue.class.php on line 314

 

[07-Sep-2017 12:13:04 America/Louisville] PHP Notice:  Undefined index: billing_address in /home/claudias/public_html/classes/cubecart.class.php on line 1130

 

[07-Sep-2017 12:13:04 America/Louisville] PHP Notice:  Undefined index: delivery_address in /home/claudias/public_html/classes/cubecart.class.php on line 1133

 

[07-Sep-2017 16:57:19 UTC] PHP Notice:  Undefined index: HTTP_USER_AGENT in /home/claudias/public_html/classes/session.class.php on line 599

 

[07-Sep-2017 17:57:16 UTC] PHP Notice:  Undefined variable: stock_warning in /home/claudias/public_html/classes/cart.class.php on line 405

 

[07-Sep-2017 13:57:16 America/Louisville] PHP Notice:  Undefined index: billing_address in /home/claudias/public_html/classes/cart.class.php on line 810

 

[07-Sep-2017 13:57:19 America/Louisville] PHP Notice:  Undefined index: billing_address in /home/claudias/public_html/classes/cubecart.class.php on line 601

 

[07-Sep-2017 13:57:19 America/Louisville] PHP Notice:  Undefined index: delivery_address in /home/claudias/public_html/classes/cubecart.class.php on line 633

 

[07-Sep-2017 13:57:19 America/Louisville] PHP Notice:  Undefined index: coupons in /home/claudias/public_html/classes/cubecart.class.php on line 1595

 

[07-Sep-2017 13:57:20 America/Louisville] PHP Notice:  Undefined index: free_coupon_shipping in /home/claudias/public_html/classes/cubecart.class.php on line 1619

 [07-Sep-2017 13:57:20 America/Louisville] PHP Notice:  Undefined index: gateway in /home/claudias/public_html/classes/cubecart.class.php on line 1731

 

[07-Sep-2017 13:57:20 America/Louisville] PHP Notice:  Undefined index: base_folder in /home/claudias/public_html/classes/cubecart.class.php on line 2117

 

[07-Sep-2017 13:57:20 America/Louisville] PHP Notice:  Undefined index: scope in /home/claudias/public_html/classes/cubecart.class.php on line 2128

 

 [07-Sep-2017 13:59:57 America/Louisville] PHP Notice:  Undefined index: retrieve in /home/claudias/public_html/classes/order.class.php on line 577

 

[07-Sep-2017 13:59:57 America/Louisville] PHP Notice:  Undefined index: options_identifier in /home/claudias/public_html/classes/order.class.php on line 1102

 

[07-Sep-2017 13:59:57 America/Louisville] PHP Notice:  Undefined index: options in /home/claudias/public_html/classes/order.class.php on line 1117

 

[07-Sep-2017 13:59:57 America/Louisville] PHP Notice:  Undefined index: bml in /home/claudias/public_html/modules/plugins/PayPal_Pro/hooks/class.cubecart.construct.gateway.php on line 22

 

[07-Sep-2017 13:59:57 America/Louisville] PHP Notice:  Undefined variable: inline in /home/claudias/public_html/modules/plugins/PayPal_Pro/hooks/class.cubecart.construct.gateway.php on line 24

 

[07-Sep-2017 13:59:59 America/Louisville] PHP Notice:  Undefined index: L_ERRORCODE0 in /home/claudias/public_html/modules/plugins/PayPal_Pro/website_payments_pro.class.php on line 456

 

[07-Sep-2017 14:03:12 America/Louisville] PHP Notice:  Undefined variable: lang in /home/claudias/public_html/modules/plugins/PayPal_Pro/hooks/class.cubecart.construct.confirm.php on line 38

 

[07-Sep-2017 14:03:12 America/Louisville] PHP Notice:  Undefined index: PAYMENTREQUEST_0_SHIPTOSTREET2 in /home/claudias/public_html/modules/plugins/PayPal_Pro/hooks/class.cubecart.construct.confirm.php on line 60

 

[07-Sep-2017 14:03:12 America/Louisville] PHP Notice:  Undefined variable: customer_id in /home/claudias/public_html/modules/plugins/PayPal_Pro/hooks/class.cubecart.construct.confirm.php on line 86

 

 [07-Sep-2017 14:03:13 America/Louisville] PHP Notice:  Undefined variable: list_checkouts in /home/claudias/public_html/classes/cubecart.class.php on line 1736

 

 [07-Sep-2017 14:05:24 America/Louisville] PHP Notice:  Undefined index: options_identifier in /home/claudias/public_html/classes/cart.class.php on line 1082

 

 [07-Sep-2017 14:05:25 America/Louisville] PHP Notice:  Undefined index: taxes in /home/claudias/public_html/classes/order.class.php on line 299

 

[07-Sep-2017 14:05:28 America/Louisville] PHP Notice:  Undefined variable: complete in /home/claudias/public_html/classes/order.class.php on line 514

 

[07-Sep-2017 14:05:31 America/Louisville] PHP Notice:  Undefined index: L_ERRORCODE0 in /home/claudias/public_html/modules/plugins/PayPal_Pro/hooks/class.cubecart.construct.gateway.php on line 37

 

 [07-Sep-2017 18:05:36 UTC] PHP Notice:  Undefined variable: _GET in /home/claudias/public_html/includes/functions.inc.php on line 196

 

[07-Sep-2017 14:05:38 America/Louisville] PHP Notice:  Undefined index: taxes in /home/claudias/public_html/classes/cubecart.class.php on line 1302

 

[07-Sep-2017 18:24:16 UTC] PHP Notice:  Undefined index: X-Forwarded-For in /home/claudias/public_html/includes/functions.inc.php on line 527

 

 [07-Sep-2017 20:55:15 UTC] PHP Notice:  Undefined variable: path in /home/claudias/public_html/classes/seo.class.php on line 323

 

[07-Sep-2017 16:55:15 America/Louisville] PHP Notice:  Undefined variable: sfws_related_products in /home/claudias/public_html/modules/plugins/SFWS_Deluxe_Related_Products/class.deluxe_related_products.php on line 324

 

 [07-Sep-2017 23:14:42 UTC] PHP Notice:  Undefined variable: _GET in /home/claudias/public_html/includes/functions.inc.php on line 196

 

[08-Sep-2017 02:36:59 America/Louisville] PHP Notice:  Undefined variable: order_string in home/claudias/public_html/classes/catalogue.class.php on line 1928

 

 [08-Sep-2017 07:48:31 UTC] PHP Notice:  Undefined index: HTTP_USER_AGENT in /home/claudias/public_html/classes/session.class.php on line 599

 

 [08-Sep-2017 10:37:54 America/Louisville] PHP Notice:  Undefined index: cat_id in /home/claudias/public_html/classes/cubecart.class.php on line 826

Link to comment
Share on other sites

"Is there anyway to turn PHP Notices off so they don't get reported in the error log?

By error log, are you referring to the listing in the admin's Error Log, System Error Log tab, or the "error_log" file that PHP creates because of instructions a file named "ini-custom.inc.php" that tells PHP to be logging errors to that file?

CC618 (carried over to CC6110) started logging everything - as opposed to CC615.

Short answer: we can adjust the reporting that gets logged through a code edit.

You can ignore all Undefined index and Undefined variable notices. You can ignore Invalid Security Token warnings as this is probably using the browser back button or having more than one admin screen open at once. For the most part, you can ignore Invalid argument warnings.

The above helps to find what may be causing unexpected results in CubeCart's operations - but mostly it is just the consequences of the programming style that is used to code CubeCart.

That leaves a few errors that may need to have some explanation:

Security Warning: Illegal array key "sort%5Bdate_added%5D" was detected and was removed

There may be a customization in the code that is incompatible with later versions of CubeCart. The array key mentioned should just be sort, but something is encoding sort[date_added] to sort%5Bdate_added%5D which has characters CubeCart deems dangerous (the %).

No customer information detected. Order summary was not built or inserted.

This is interesting. Something really outside the bounds of the normal sequence of events must have happened.

curl_setopt(): Disabling safe uploads is no longer supported

You will need to get with SemperFi and get an updated version of the "Automatic Social Media Posts" plugin.

 

Edited by bsmither
Link to comment
Share on other sites

Thanks for looking into this Brian.

1. By error log I mean the one in CPanel.   The "error_log" file that PHP creates.

2. Sorry .. didn't mean to include this one. Daren is looking into it:

This is interesting. Something really outside the bounds of the normal sequence of events must have happened.

curl_setopt(): Disabling safe uploads is no longer supported

You will need to get with SemperFi and get an updated version of the "Automatic Social Media Posts" plugin.

3. This one is because I don't use the sorting method that comes with CubeCart.  I sort by newly listed or by Daren's mod Custom Product Sort. 

Security Warning: Illegal array key "sort%5Bdate_added%5D" was detected and was removed

4. I don't know what this is

[07-Sep-2017 13:59:57 America/Louisville] PHP Warning:  No customer information detected. Order summary was not built or inserted. in /home/claudias/public_html/classes/order.class.php on line 1170

Whatever you think I can have removed from the error log safely I'd like the code to do it.  It's really annoying getting this large error log.  And I can always put it back if need be.

Thanks,

Claudia

Link to comment
Share on other sites

Here is my solution for CC618/CC6110 (and possibly later). It will inhibit PHP's Notices unless overridden - discussed later.

classes/debug.class.php
===================================================================
Find:
	protected static $_instance;

Add BEFORE:
	/**
	 * Suppress logging of PHP Notices
	 *
	 * @var bool
	 */
	private $_suppress_php_notices = true;

Find: 
	final protected function __construct() {

Change to:
	final protected function __construct($suppress_php_notices) {
		$this->_suppress_php_notices = $suppress_php_notices;

 
Find:
	public static function getInstance() {
		if (!(self::$_instance instanceof self)) {
			self::$_instance = new self();

Change to:

	public static function getInstance($suppress_php_notices = true) {
		if (!(self::$_instance instanceof self)) {
			self::$_instance = new self($suppress_php_notices);

Find:
			case E_NOTICE:
			case E_USER_NOTICE:
				$type = 'Notice';

Change to:
			case E_NOTICE:
				$type = 'Notice';
				$log = ($this->_suppress_php_notices) ? false : $can_log;
			break;
			case E_USER_NOTICE:
				$type = 'USERNotice';

Find (edited for originally taking this from my development version - the stock code is as follows):
		$error = "[<strong>".$type."</strong>] \t".$error_file.":".$error_line." - ".$error_string;
		$this->_errors[] = $error;
		if($log) {
			$this->_writeErrorLog($error, $type);
		}

Then find:
		return false;

Change to:
		return ($this->_suppress_php_notices && $type == 'Notice') ? true : false; // See PHP manual for set_error_handler() callback function return value



/controllers/controller.admin.pre_session.inc.php
===================================================================
Find:
$GLOBALS['debug'] = Debug::getInstance();

Change to:
$GLOBALS['debug'] = Debug::getInstance(!$GLOBALS['config']->has('config','debug_ignore_notices') ?: $GLOBALS['config']->get('config','debug_ignore_notices'));

/controllers/controller.index.inc.php
===================================================================
Find:
$GLOBALS['debug'] = Debug::getInstance();

Change to:
$GLOBALS['debug'] = Debug::getInstance(!$GLOBALS['config']->has('config','debug_ignore_notices') ?: $GLOBALS['config']->get('config','debug_ignore_notices'));


/ini-custom.inc.php (if present)
===================================================================
Find:
<?php

Add after:
// Un-comment to log PHP Notices
//$config_default['debug_ignore_notices'] = false;

By having the statement that (eventually) adds a config setting to say that "do NOT ignore PHP Notices," these notices will get logged to the error log and to CubeCart's System Error Log in admin.

If you have CubeCart's Debug enabled, you will still see them in the debug section at the bottom of the page.

The reason we are adding to the $config_default array is that this array is Config->merged()'d into the overall configuration and can be seen everywhere, but when shutting down, these merged elements are removed before the configuration is written back to the database. We do not want this setting persisting.

 

Edited by bsmither
Link to comment
Share on other sites

Currently, not everyone has PHP logging to an active error log. Some hosting configurations *may* have this enabled by default, and if so, I would imagine the PHP error log is kept trimmed by some internal mechanism.

Others who I have worked with did not shut off user-initiated PHP's error logging and the log has grown to several ten thousand megabytes.

The latest versions of CubeCart will trim it's internal database system error log table to 30 days.

In CubeCart's admin, Store Settings, Advanced tab, disabling debug mode (I think) will suppress the logging of all but the most serious of PHP errors. (I think.)

So, under normal operations, I would think CubeCart's current dealing with PHP error logging is adequate.

Link to comment
Share on other sites

Brian,

Part of your code changes read:

 

Find:

                              $error = "[<strong>".$type."</strong>] \t".htmlentities(strip_tags($error_file.":".$error_line." - ".$error_string));

                              $this->_errors[] = $error;

                                             $this->_writeErrorLog($error, $type);

                              }

 

Then find:

                              return false;

 

Change to:

                              return ($this->_suppress_php_notices && $type == 'Notice') ? true : false; // See PHP manual for set_error_handler() callback function return value

 

MY QUESTION

Am I suppose to change all the “find  and then find” code to the following:  Or was there a “change to” missing after the first “find”

 

return ($this->_suppress_php_notices && $type == 'Notice') ? true : false; // See PHP manual for set_error_handler() callback function return value

}

 

Thanks,

Claudia

Link to comment
Share on other sites

The "Find" line doesn't read the same as what you say:

My Line reads:

$error = "[<strong>".$type."</strong>] \t".$error_file.":".$error_line." - ".$error_string;
        $this->_errors[] = $error;

        if($log) {
            $this->_writeErrorLog($error, $type);
        }

Also I got an error, [11-Sep-2017 15:14:46 UTC] PHP Parse error:  syntax error, unexpected 'public' (T_PUBLIC) in /home/claudias/public_html/classes/debug.class.php on line 467, and the website and admin would not load. But when I put a } after the "Change to" it worked. Is that OK? Or am I going to get problems down the road.

Find:
		$error = "[<strong>".$type."</strong>] \t".htmlentities(strip_tags($error_file.":".$error_line." - ".$error_string));
		$this->_errors[] = $error;
			$this->_writeErrorLog($error, $type);
		}

Then find:
		return false;

Change to:
		return ($this->_suppress_php_notices && $type == 'Notice') ? true : false; // See PHP manual for set_error_handler() callback function return value
Link to comment
Share on other sites

I corrected the instructions above. Thanks for noticing that.

If you edited *just* the return false; statement, and did not disturb the following original stock line that has a single closing parenthesis, then this syntax error should not have happened.

So, do not disturb any statements after the to-be-edited return false;

 

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.

 Share

×
×
  • Create New...