php-ups-api icon indicating copy to clipboard operation
php-ups-api copied to clipboard

Deprecation functions - PHP 8.1

Open lamp5 opened this issue 2 years ago • 4 comments

I can see a lot of deprecations when try to use id on PHP 8.1 `Deprecated: DOMDocument::createElement(): Passing null to parameter #2 ($value) of type string is deprecated in /var/www/vendor/gabrielbull/ups-api/src/Entity/PickupType.php on line 46

Deprecated: DOMDocument::createElement(): Passing null to parameter #2 ($value) of type string is deprecated in /var/www/vendor/gabrielbull/ups-api/src/Entity/Service.php on line 160

Deprecated: DOMDocument::createElement(): Passing null to parameter #2 ($value) of type string is deprecated in /var/www/vendor/gabrielbull/ups-api/src/Entity/ShipTo.php on line 145

Deprecated: DOMDocument::createElement(): Passing null to parameter #2 ($value) of type string is deprecated in /var/www/vendor/gabrielbull/ups-api/src/Entity/ShipTo.php on line 146

Deprecated: DOMDocument::createElement(): Passing null to parameter #2 ($value) of type string is deprecated in /var/www/vendor/gabrielbull/ups-api/src/Entity/PackagingType.php on line 96

Deprecated: DOMDocument::createElement(): Passing null to parameter #2 ($value) of type string is deprecated in /var/www/vendor/gabrielbull/ups-api/src/Entity/UnitOfMeasurement.php on line 105

Deprecated: DOMDocument::createElement(): Passing null to parameter #2 ($value) of type string is deprecated in /var/www/vendor/gabrielbull/ups-api/src/Entity/UnitOfMeasurement.php on line 105`

lamp5 avatar Dec 05 '22 07:12 lamp5

Worked in php 7.4 upgraded to 8.1 and lots of things broke

It appears " $this->getDescription())); " has to be changed to " $this->getDescription()?: "")); " on the listed lines above to escape passing the NULL

Wilburunion avatar Dec 08 '22 18:12 Wilburunion

Add this one to the list: src/Entity/Translate.php

        $node->appendChild($document->createElement('LanguageCode', $this->getLanguageCode() ?? ''));

WouterSteen avatar Dec 15 '22 12:12 WouterSteen

Is there a plan to upgrade this to work with php 8.1?

szczesuil avatar Aug 26 '23 20:08 szczesuil

we have the php-ups-api running under PHP 8.2 without any problems.

jav666 avatar May 24 '24 07:05 jav666