Skip to content

Commit

Permalink
Deprecated functionality: strlen(): Passing null to parameter #1
Browse files Browse the repository at this point in the history
I am getting this error with PHP 8.3 in the system.log file:

```Deprecated functionality: strlen(): Passing null to parameter #1 ($string) of type string is deprecated  in /var/www/html/app/code/core/Mage/Wishlist/Controller/Abstract.php on line 88```

**/app/code/core/Mage/Wishlist/Controller/Abstract.php on line 88**

In order to reproduce this issue log into a customer account in the Frontend then add any product to the Wishlist. You will be redirected to the customer account. A part of the URL is **wishlist/index/index/wishlist_id/[PRODUCT_ID]/**. Press the [Add All to the Cart] button. In my case I am getting an error message because the product has custom options and I have to choose them. If you take a look into the /var/log directory you will see a nice system.log file, having 374 kB as size and inside the same line 1745 times.

IMPORTANT NOTE: 
This PR has 3 implementations inside (3 lines, 2 commented), there may be others. Please share your opinions, at the end there will be only one line left.
  • Loading branch information
ADDISON74 authored Jul 4, 2024
1 parent 2b907ad commit c5e92d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/code/core/Mage/Wishlist/Controller/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public function allcartAction()

$qtysString = $this->getRequest()->getParam('qty');
if (isset($qtysString)) {
$qtys = array_filter(json_decode($qtysString), '\strlen');
$qtys = array_filter(json_decode($qtysString), fn($qtysString) => strlen($qtysString ?? ''));
// $qtys = array_filter(json_decode($qtysString), function ($qtysString) { return strlen($qtysString ?? ''); });
// $qtys = @array_filter(json_decode($qtysString), '\strlen');
}

/** @var Mage_Wishlist_Model_Item $item */
Expand Down

0 comments on commit c5e92d4

Please sign in to comment.