parcel-pro-nl / magento2-module

Verzendmodule om gemakkelijk orders in te laden in het verzendsysteem van Parcel Pro.
https://support.parcelpro.nl/koppelingen/magento-handleiding
Open Software License 3.0
0 stars 7 forks source link

Null exception when using custom shipping method with Magento 2.4.4+ #14

Open the-line opened 1 year ago

the-line commented 1 year ago

When using a custom shipping method with the option "Eigen verzendopties via parcelpro.nl" the shipment cannot be send correctly to ParcelPro.

When clicking on the "Zending aanmelden" option in a order, the following error message is given:

Exception #0 (Exception): Deprecated Functionality: substr(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/vendor/parcelpro/shipment/Controller/Adminhtml/Shipment/Index.php on line 154

This is because the response body of ParcelPro doesn't contain a barcode. Therefore the call to substr with the empty value of $response_body['Barcode'] value will trigger this exception.

This only happens when running PHP 8.1 which is required for Magento 2.4.4 and newer. Previous version of Magento are out of support and therefore running PHP 7.4 is not a option.