postnl/postnl-magento2

[BUG] strtolower(): Passing null to parameter #1 ($string) of type string is deprecated

orkuncv opened this issue · 4 comments

Deprecated function: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated
strtolower(NULL) can be used in private function getOptionFromQuote() Observer/TIGPostNLOrderSaveBefore/SetDefaultData.php(163) | Service/Order/ProductInfo.php(137): strtolower(NULL)

To Reproduce
Steps to reproduce the behavior:

  1. Make an order in Magento
  2. Go to admin
  3. Create Shipment for order

Expected result
Shipment grid to be updated.

Actual result
Critical error and shipment grid cant be updated.

Workaround
Can be fixed by:

$option  = $option ? strtolower($option) : '';

in Service/Order/ProductInfo.php(137)

** Please complete the following information**

  • Magento version: 2.4.4-p1
  • PHP version: 8.1
  • TIG PostNL version: 1.12.3

Hi @orkuncv ,

I just created a clean Magento 2.4.4-p1 environment to test this. But I was not able to reproduce this issue. It seems I can make shipments without errors, tried this with multiple orders. Could you send this issue to PostNL at digitaleklantsupport@postnl.nl then they can investigate this further in your environment.
If PostNL can't fix the issue themselves, they will ask us to also look into it.

Have a great day,
Jeffrey

@tig-jeffreybranderhorst have you tried it on php 8.1. We got the same issue. when looking in the code it can give a NULL.

This means that in php8.1 it will be a critical error, since the function is strict.

Hi @orkuncv & @leonhelmus

We have been able reproduce this and we will add your solution into the next release.

Have a nice day.
Vincent

Hi @orkuncv & @leonhelmus ,

We have added this in our latest version of the extension.
If come across something else, don't hesitate to inform us.

Have a great day,
Jeffrey