vitalyk Posted September 25, 2021 Share Posted September 25, 2021 HiI am getting those errors many times after upgraded to PHP7.4, I am not a coder, need your help, developer not replying: 2021-09-25 1:06:04 - PHP Notice: Trying to access array offset on value of type bool in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 194 2021-09-25 1:06:04 - PHP Notice: Trying to access array offset on value of type bool in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 195 This code is responsible for the error: $data['product_info'] = $product_info; $data['weight'] = $this->weight->format($product_info['weight'], $product_info['weight_class_id']); $data['dimensions'] = $this->length->format($product_info['height'], $product_info['length_class_id']); Thank you all for your support. Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/ Share on other sites More sharing options...
Barand Posted September 25, 2021 Share Posted September 25, 2021 Have you tried checking the variables a the point where the error occurs. For example var_dump($product_info); 1 Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/#findComment-1590338 Share on other sites More sharing options...
vitalyk Posted September 25, 2021 Author Share Posted September 25, 2021 13 minutes ago, Barand said: Have you tried checking the variables a the point where the error occurs. For example var_dump($product_info); Thank you for your reply. Do I need to add this line after or before the code? Sorry. I have not knowledge about coding. Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/#findComment-1590339 Share on other sites More sharing options...
Barand Posted September 25, 2021 Share Posted September 25, 2021 Just before the first error would be good. 1 Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/#findComment-1590340 Share on other sites More sharing options...
vitalyk Posted September 25, 2021 Author Share Posted September 25, 2021 I did it this way: $data['product_info'] = $product_info; var_dump($product_info); $data['weight'] = $this->weight->format($product_info['weight'], (int)$product_info['weight_class_id']); $data['dimensions'] = $this->length->format($product_info['height'], (int)$product_info['length_class_id']); and got this on top of the webpage: array(45) { ["product_id"]=> string(4) "1114" ["name"]=> string(70) "12inch Universal Oil Filter Pliers Wrench 2-1/2 to 4-1/2 or 63.5-115mm" ["description"]=> string(1705) "<p>These oil filter pliers will remove 99% of all filters on motorbikes, cars, and light trucks. The pliers have a three gears position handle which provides extra grip around filter body adjustment. The shape of the pliers has a slight bend that helps to keep the handles out of the way from other parts of the engine. Double foam dip handles provide excellent leverage and secure grip that helps to remove any stubborn filters from your vehicle and make your oil change a simple task.</p><p><b>Features:</b></p><ul><li>Compatible with most car and light truck filters</li><li>Three positions for grip diameter adjustment</li><li>Black surface treatment for rust or corrosion protection</li><li>Undercut tongue and groove won't slip</li><li>Black comfort foam grips for ultimate hand comfort</li><li>Dipped cushioned handles</li></ul><p><b>Specifications:</b></p><ul><li>Brand: Harden</li><li>Model: 670312</li><li>Three gear positions</li><li>Material: carbon steel, foam dipped handles</li><li>Specifically bent design for more leverage and difficult to reach areas</li><li>Tool length: 12 inches or 300mm</li><li>Fits filter in diameter between: 2.5-4.5inch or 63.5-115mm</li><li>Black surface treatment</li><li>Foam dip handles</li><li>Weight: 17oz or 480g</li></ul><p><b>Package Includes:</b></p><ul><li>Oil filter wrench pliers</li><li>Retail packaging</li></ul>" ["meta_title"]=> string(70) "12inch Universal Oil Filter Pliers Wrench 2-1/2 to 4-1/2 or 63.5-115mm" ["meta_description"]=> string(165) "12inch Universal Oil Filter Pliers Wrench 2-1/2 to 4-1/2 or 63.5-115mm - These oil filter pliers will remove 99 of all filters on motorbikes, cars, and light trucks." ["meta_keyword"]=> string(79) " 12inch universal oil filter pliers wrench 2-1/2 4-1/2 63.5-115mm pliers 670312" ["custom_imgtitle"]=> string(70) "12inch Universal Oil Filter Pliers Wrench 2-1/2 to 4-1/2 or 63.5-115mm" ["custom_h2"]=> string(0) "" ["custom_h1"]=> string(79) "12inch Universal Oil Filter Pliers Wrench 2-1/2 to 4-1/2 or 63.5-115mm - Pliers" ["custom_alt"]=> string(70) "12inch Universal Oil Filter Pliers Wrench 2-1/2 to 4-1/2 or 63.5-115mm" ["tag"]=> string(72) "12inch, universal, oil, filter, pliers, wrench, 2-1/2, 4-1/2, 63.5-115mm" ["model"]=> string(6) "670312" ["sku"]=> string(0) "" ["upc"]=> string(0) "" ["ean"]=> string(0) "" ["jan"]=> string(0) "" ["isbn"]=> string(0) "" ["mpn"]=> string(0) "" ["location"]=> string(0) "" ["quantity"]=> string(3) "300" ["stock_status"]=> string(12) "Out Of Stock" ["image"]=> string(97) "catalog/Tools/Pliers/12inch Universal Oil Filter Pliers Wrench 2-12 to 4-12 or 63.5-115mm (1).jpg" ["manufacturer_id"]=> string(2) "23" ["manufacturer"]=> string(6) "Harden" ["price"]=> string(6) "4.9900" ["special"]=> NULL ["reward"]=> NULL ["points"]=> string(1) "0" ["tax_class_id"]=> string(1) "9" ["date_available"]=> string(10) "2021-09-18" ["weight"]=> string(10) "0.55000000" ["weight_class_id"]=> string(1) "1" ["length"]=> string(11) "36.00000000" ["width"]=> string(11) "11.00000000" ["height"]=> string(10) "5.00000000" ["length_class_id"]=> string(1) "1" ["subtract"]=> string(1) "1" ["rating"]=> float(0) ["reviews"]=> int(0) ["minimum"]=> string(1) "1" ["sort_order"]=> string(1) "1" ["status"]=> string(1) "1" ["date_added"]=> string(19) "2021-09-18 15:27:51" ["date_modified"]=> string(19) "2021-09-19 11:00:29" ["viewed"]=> string(5) "11881" } Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/#findComment-1590341 Share on other sites More sharing options...
Barand Posted September 25, 2021 Share Posted September 25, 2021 I don't know. There's no sign of anything boolean. Did you get the same error messages? 1 Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/#findComment-1590343 Share on other sites More sharing options...
vitalyk Posted September 25, 2021 Author Share Posted September 25, 2021 (edited) No, the log was clean. Only got array(45) text on top of the webpage of each product. as i understand this code is to display dimensions on the product page, everything works but every day getting 200 of same error in website log. 2021-09-25 1:06:04 - PHP Notice: Trying to access array offset on value of type bool in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 194 2021-09-25 1:06:04 - PHP Notice: Trying to access array offset on value of type bool in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 195 This started to happen after website was transferred to new server with PHP 7.4 I have attached the file. vq2-system_storage_modification_catalog_controller_product_product.php.TXT Edited September 25, 2021 by vitalyk Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/#findComment-1590344 Share on other sites More sharing options...
Barand Posted September 25, 2021 Share Posted September 25, 2021 LINE 190 $product_info = $this->model_catalog_product->getProduct($product_id); That is where the $product_info gets its value. I suspect that the method getProduct() is returning "false" if the $product_id id invalid (perhaps 0) Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/#findComment-1590345 Share on other sites More sharing options...
vitalyk Posted September 25, 2021 Author Share Posted September 25, 2021 Barand Thank you for your help. What should I add to or remove because if I disable that line I get: Notice: Undefined variable: product_info in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 193Notice: Undefined variable: product_info in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 194Notice: Trying to access array offset on value of type null in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 194Notice: Undefined variable: product_info in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 194Notice: Trying to access array offset on value of type null in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 194Notice: Undefined variable: product_info in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 195Notice: Trying to access array offset on value of type null in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 195Notice: Undefined variable: product_info in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 195Notice: Trying to access array offset on value of type null in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 195Notice: Undefined variable: product_info in /var/www/DOMAIN/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_product.php on line 198 Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/#findComment-1590346 Share on other sites More sharing options...
Barand Posted September 25, 2021 Share Posted September 25, 2021 That line is required (as you have discovered). You need too see if my suspicion is true. If it is, you need to stop it trying to output data for a non-existent product. Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/#findComment-1590347 Share on other sites More sharing options...
vitalyk Posted September 26, 2021 Author Share Posted September 26, 2021 I think I am going to give up. I upgraded my Ubuntu server from 16.04 to 20.04 and also newest PHP. I get many errors. I think my shopping cart website is not compatible with new PHP. I will downgrade it back and will use 16.04 until its possible. Quote Link to comment https://forums.phpfreaks.com/topic/313809-php-notice-trying-to-access-array-offset-on-value-of-type-bool-after-php-74-upgrade-please-help/#findComment-1590348 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.