Claudia Posted March 7 Share Posted March 7 I am still getting a lot of PHP Warnings even though I've updated to 6.4.10. This is just the last couple of hours. I deleted a bunch earlier today. Most in the cPanel log are repeats of these. Nothing in the admin log. PHP Version 8.1.16 [06-Mar-2023 18:39:43 America/Louisville] PHP Warning: Undefined variable $random_product in /home/xxxxxxx/public_html/classes/gui.class.php on line 1348 [06-Mar-2023 18:45:40 America/Louisville] PHP Warning: Undefined array key "_g" in /home/xxxxxxx/public_html/classes/ssl.class.php on line 39 [06-Mar-2023 18:46:44 America/Louisville] PHP Warning: Undefined variable $random_product in /home/xxxxxxx/public_html/classes/gui.class.php on line 1348 [06-Mar-2023 18:30:19 America/Louisville] PHP Warning: Undefined array key "doc_name" in /home/xxxxxxx/public_html/classes/cubecart.class.php on line 89 [06-Mar-2023 18:30:19 America/Louisville] PHP Warning: Undefined array key "hide_title" in /home/xxxxxxx/public_html/classes/cubecart.class.php on line 91 [06-Mar-2023 18:30:19 America/Louisville] PHP Warning: Undefined variable $contents in /home/xxxxx/public_html/classes/cubecart.class.php on line 197 [06-Mar-2023 18:30:19 America/Louisville] PHP Warning: Trying to access array offset on value of type null in /home/xxxxxx/public_html/classes/cubecart.class.php on line 197 [06-Mar-2023 18:30:19 America/Louisville] PHP Warning: Undefined variable $contents in /home/xxxxxxx/public_html/classes/cubecart.class.php on line 194 [06-Mar-2023 18:30:19 America/Louisville] PHP Warning: Trying to access array offset on value of type null in /home/xxxxxx/public_html/classes/cubecart.class.php on line 194 [06-Mar-2023 18:17:11 America/Louisville] PHP Warning: Undefined array key "HTTP_USER_AGENT" in /home/xxxxxx/public_html/classes/session.class.php on line 676 [06-Mar-2023 18:14:31 America/Louisville] PHP Warning: Array to string conversion in /home/xxxxxx/public_html/classes/db/database.class.php on line 178 [06-Mar-2023 18:14:37 America/Louisville] PHP Warning: Undefined variable $external_categories in /home/xxxxxx/public_html/admin_Ot3sX0/sources/products.index.inc.php on line 853 [06-Mar-2023 18:14:37 America/Louisville] PHP Warning: Undefined variable $option_list in /home/xxxxxxx/public_html/admin_Ot3sX0/sources/products.index.inc.php on line 957 [06-Mar-2023 18:14:37 America/Louisville] PHP Warning: Undefined array key "option_matrix" in /home/xxxxxx/public_html/admin_Ot3sX0/sources/products.index.inc.php on line 1216 [06-Mar-2023 18:14:37 America/Louisville] PHP Warning: Undefined array key "plugin_tabs" in /home/xxxxxxx/public_html/admin_Ot3sX0/sources/products.index.inc.php on line 1276 [06-Mar-2023 18:06:00 America/Louisville] PHP Warning: Undefined global variable $_GET in /home/xxxxx/public_html/includes/functions.inc.php on line 206 [06-Mar-2023 18:06:00 America/Louisville] PHP Warning: Invalid Security Token in /home/xxxxx/public_html/classes/sanitize.class.php on line 155 Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 7 Share Posted March 7 Only a couple of the above need to be looked at. Array to string conversion - database.class.php:178 involves building an html link from data related to sorting a table column. The cubecart.class.php:194,197 involves fetching document details and failing at it. Everything else is the product of a particular programming style and PHP8 being annoyingly stern. No doubt, each version will have many, many changes to keep PHP8 from complaining about "Undefined" stuff. Without doing a deep-dive into troubleshooting efforts, it cannot be known what data is causing the two specific errors noted earlier. Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 7 Share Posted March 7 I posted an issue in the Github regarding the document details. Do you have any code snippets that allow for more options to sort columns in any of the tables (stock or custom) in admin? Quote Link to comment Share on other sites More sharing options...
Claudia Posted March 7 Author Share Posted March 7 All I have are those additional fields I added in Products and Orders that I made sortable. No code snippets Quote Link to comment Share on other sites More sharing options...
Claudia Posted March 7 Author Share Posted March 7 I just went in and cleared my error log. Five minutes late I went and checked. Got these errrors numerous times.. [07-Mar-2023 10:43:31 America/Louisville] PHP Warning: Undefined array key "_g" in /home/cambarga/public_html/includes/extra/snippet_f4308ce0418a4ec0d7106f4189af8605.php on line 2 [07-Mar-2023 10:53:41 America/Louisville] PHP Warning: Undefined variable $random_product in /home/cambarga/public_html/classes/gui.class.php on line 1348 [07-Mar-2023 10:55:17 America/Louisville] PHP Warning: Undefined array key "HTTP_USER_AGENT" in /home/cambarga/public_html/classes/session.class.php on line 676 [07-Mar-2023 10:55:17 America/Louisville] PHP Warning: Undefined array key "_g" in /home/cambarga/public_html/classes/ssl.class.php on line 39 The first one is for a code snippet you created for me to add a new tab to the orders page in admin: <?php if($_GET['_g'] == 'orders' && (!isset($_GET['node']) || $_GET['node'] == 'index') && isset($_GET['action']) && in_array($_GET['action'], array('add','edit'))) { $tab['name'] = 'More Order Info'; $tab['tab_id'] = 'tab_moreorderinfo'; $tab['target'] = '#moreorderinfo'; $tabs[] = $tab; } Hold on there was another snippet you created that might have something to do with the sort error. This is to show the product images by file name. I name my photos 01-front, 02-left, etc. <?php $return_filenames = array_map(function($element){return $element['filename'];},$return); array_multisort($return_filenames,$return); ?> Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 7 Share Posted March 7 In the snippet: From: if($_GET['_g'] == 'orders' && (!isset($_GET['node']) || $_GET['node'] == 'index') && isset($_GET['action']) && in_array($_GET['action'], array('add','edit'))) { To: if(isset($_GET['_g']) && $_GET['_g'] == 'orders' && (!isset($_GET['node']) || $_GET['node'] == 'index') && isset($_GET['action']) && in_array($_GET['action'], array('add','edit'))) { In /classes/gui.class.php, near line 1315, in the function _displayRandomProduct(): From: foreach ($GLOBALS['hooks']->load('class.gui.display_random_product_pre') as $hook) { include $hook; } $featured_products = $GLOBALS['db']->select('CubeCart_inventory', 'product_id', $GLOBALS['catalogue']->outOfStockWhere(array('status' => '1', 'featured' => '1'))); $n = ($featured_products ? count($featured_products) : 0); if ($n > 0) { $random_product = false; To: $random_product = false; foreach ($GLOBALS['hooks']->load('class.gui.display_random_product_pre') as $hook) { include $hook; } $featured_products = $GLOBALS['db']->select('CubeCart_inventory', 'product_id', $GLOBALS['catalogue']->outOfStockWhere(array('status' => '1', 'featured' => '1'))); $n = ($featured_products ? count($featured_products) : 0); if ($n > 0) { In /classes/session.class.php, near line 676: From: return strpos(($_SERVER['HTTP_USER_AGENT']), 'Trident') ? 'IEX' : htmlspecialchars($_SERVER['HTTP_USER_AGENT']); To: return strpos(($_SERVER['HTTP_USER_AGENT']??"fullsize"), 'Trident') ? 'IEX' : htmlspecialchars($_SERVER['HTTP_USER_AGENT']??"fullsize"); In /classes/ssl.class.php, near line 39: From: if ($GLOBALS['config']->get('config', 'ssl') && !ADMIN_CP && !CC_SSL && !in_array($_GET['_g'], $this->_ignored_pages)) { To: if ($GLOBALS['config']->get('config', 'ssl') && !ADMIN_CP && !CC_SSL && isset($_GET['_g']) && !in_array($_GET['_g'], $this->_ignored_pages)) { Warnings such as these will eventually all be found and re-coded to keep PHP8 from mentioning them. Quote Link to comment Share on other sites More sharing options...
Claudia Posted March 7 Author Share Posted March 7 Thanks Brian. If you say these, and more, warnings aren't hurting anything and my site is working correctly I'll stop bugging you with this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.