PHP Warning: Undefined array key, e.g. “dhl_default_signature_service”
-
Hi,
we use our www-error.log to catch PHP warnings and errors. Since upgrading to PHP 8 our log spills almost over with warning from this DHL plugin here.
In particular it is these two lines that cause the warnings:
PHP Warning: Undefined array key "dhl_default_signature_service" in /srv/data/web/vhosts/www.ourwebsite.de/htdocs/wp-content/plugins/dhl-for-woocommerce/includes/class-pr-dhl-wc-order-paket.php on line 288 ... PHP Warning: Undefined array key "dhl_default_endorsement" in /srv/data/web/vhosts/www.ourwebsite.de/htdocs/wp-content/plugins/dhl-for-woocommerce/includes/class-pr-dhl-wc-order-paket.php on line 431
This is because of a change between PHP 7 and 8. In PHP 8 undefined array keys are a warning now due to better highlight potential security issues.
Could you fix these warning, e.g. by using a fallback value with something like
??
operator. See https://stackoverflow.com/questions/70549291/best-way-to-handle-undefined-array-key-in-php-8-0 for example.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘PHP Warning: Undefined array key, e.g. “dhl_default_signature_service”’ is closed to new replies.