-
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. |
No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you. |
Hi @nielsdos Sorry for the delay. The complexity of trying to recreate the issue was driving me nuts. I think your explanation : "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." works for me. I've only noticed this error alongside other errors, and only when I try to drill down to an error from Chrome. I didn't realise Chrome resends the network request but without the POST variables. Btw, I've included a screenshot for your and anyone else's reference in case they come across the same thing. Thanks for your help. I do believe this issue is 'resolved'. |
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: