[php-src] Issue #14191: Trying to access array offset on value of type null

From: Date: Fri, 10 May 2024 08:27:45 +0000
Subject: [php-src] Issue #14191: Trying to access array offset on value of type null
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246889@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/14191 Author: gidzr ### Description The following code: ``` set_error_handler(function($errno, $errstr, $errfile, $errline ) { // Handle the error (e.g., display it in the browser) echo ":: CommonHelper Error Logger (set_error_handler section) ::--> [$errno] $errstr on line $errline in file $errfile <br><br>"; } ``` in a class that is called on ajax post ``` public function(){ print_r($_POST) } ``` Resulted in two inconsistent things occurring: 1. the correct posted variables were printed.. but 2. the commonhelper set_error_handler() function assessed the code before the $_POST variables were set, resulting in a NULL result from the error handlers view This had flow-on effects whereby if I had strtoupper($_POST['varname']), it would both provide a correct result while simultaneously throwing a deprecation warning for strtoupper on a null value. I can't find anything online to explain this. ### PHP Version 8.1.17 ### Operating System XAMPP

« previous php.bugs (#246889) next »