Jump to content

PHP Notice: Trying to access array offset on value of type bool (after PHP 7.4 upgrade) Please help.


vitalyk

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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" }

Link to comment
Share on other sites

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 by vitalyk
Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.