Undefined property: stdClass::$Barcode in TIG/PostNL/Model/Core/Cif.php on line 522
Closed this issue · 4 comments
When analysing the Magento system.log of a production system that runs the TIG_PostNL module (v1.15.3), I found dozens of occurrences (each day) of the following PHP notice:
Notice: Undefined property: stdClass::$Barcode in /path/to/magento/app/code/community/TIG/PostNL/Model/Core/Cif.php on line 522
The line read as follows:
if ($shipment->Barcode === $barcode) {
This notice can be fixed by making this check more robust, for instance by adding an isset
:
if (isset($shipment->Barcode) && $shipment->Barcode === $barcode) {
Or by adding an isset
first and throw an exception:
if (!isset($shipment->Barcode)) {
throw new TIG_PostNL_Exception(
Mage::helper('postnl')->__('Invalid shippingStatus response: %s', "\n" . var_export($response, true)),
'POSTNL-0055'
);
}
Hi @aadmathijssen,
Thank you for your submission, and providing several solutions. We'll implement this in a future release! I'll be closing this issue. If you have any other issues feel free to get in touch with us!
Thanks for the quick reply, though I don't understand why you closed this issue. It still is an issue until a new release is created in which this issue is fixed. Could you please leave this issue open?
Thanks.
Aad
Hi @aadmathijssen,
Good point, I'll leave the issue open until the next release.
This issue has been fixed in v1.15.5 already, although I did notice another barcode check at line 583 in the same file. This one will be in the following release.
Because the mentioned issue is fixed in a live release, I will be closing this issue. Thanks again @aadmathijssen for pointing this out.