-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to access array offset on value of type null #14191
Comments
Please provide a small code snippet that reproduces the problem, based on what you wrote here I can't reproduce the issue. |
Yep - this is a weird one. The problem is that it might be an interaction between AJAX and PHP.. I'll try and provide a setup to minimally reproduce it, but I've never experienced this issue before despite repeating the exact approach numerous times. I think this is because it's always been happening in the background, but as these are still only deprecation warnings, didn't bubble up to inspect/browser unless they occurred at the same time as another proper error. The other issue is that the warning issued wasn't visible unless I double clicked on the resource under "Network" in the chrome inspect window. Which caused a new browser tab to open, showing the error. The key takeout that I can see however, is that it appears there's a brief moment when the ajax calls a script, calling the script causes PHP to run/assess a function before the global POST variable is set, this results in a php deprecation warning that strtolower(can use null values), then the function runs with the POSTED value .. super weird. Let me get some time to reproduce. |
I think that if you open a new window from the network tab, that Chrome resends the network request but without the POST variables. So that would explain at least the strange inconsistency there. |
Description
The following code:
in a class that is called on ajax post
Resulted in two inconsistent things occurring:
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
The text was updated successfully, but these errors were encountered: