postnl / postnl-magento2

This is the official Magento 2 extension for the logistics company PostNL. Add shipping options and parcelshops to your checkout. Create labels with track and trace functionality from the backend.
59 stars 60 forks source link

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

Closed orkuncv closed 1 year ago

orkuncv commented 2 years ago

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

tig-jeffreybranderhorst commented 2 years ago

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

leonhelmus commented 2 years ago

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

tig-vincentthart commented 2 years ago

Hi @orkuncv & @leonhelmus

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

Have a nice day. Vincent

tig-jeffreybranderhorst commented 1 year ago

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