This PR addresses warnings and deprecations related to accessing the argv key in $_SERVER and passing a null value to the strpos() function in PHP 8.1.
2024/09/10 13:00:40 [error] 2304450#2304450: *249549 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key "argv" in /example.com/public_html/enrol/attributes/lib.php on line 252PHP message: PHP Warning: Trying to access array offset on value of type null in /example.com/public_html/enrol/attributes/lib.php on line 252PHP message: PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /example.com/public_html/enrol/attributes/lib.php on line 252" while reading upstream, client: 23.88.105.37, server: example.com, request: "GET /admin/cron.php?password=... HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.1-fpm-example.com.sock:", host: "example.com"
Issues:
PHP Warning: Undefined array key "argv" — Occurs when trying to access a non-existent argv key in the $_SERVER superglobal.
PHP Warning: Trying to access array offset on value of type null — Triggered when attempting to access an array index that is null.
PHP Deprecated: strpos(): Passing null to parameter # 1 ($haystack) of type string is deprecated — Occurs when null is passed as the first argument to strpos(), which is deprecated in PHP 8.1.
Changes made:
Added a check to ensure that $_SERVER['argv'] is set and not null before accessing it.
Replaced the strpos() call with a safer approach, handling potential null values.
This PR addresses warnings and deprecations related to accessing the argv key in $_SERVER and passing a null value to the strpos() function in PHP 8.1.
2024/09/10 13:00:40 [error] 2304450#2304450: *249549 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key "argv" in /example.com/public_html/enrol/attributes/lib.php on line 252PHP message: PHP Warning: Trying to access array offset on value of type null in /example.com/public_html/enrol/attributes/lib.php on line 252PHP message: PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /example.com/public_html/enrol/attributes/lib.php on line 252" while reading upstream, client: 23.88.105.37, server: example.com, request: "GET /admin/cron.php?password=... HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.1-fpm-example.com.sock:", host: "example.com"
Issues:
Changes made: