User tests: Successful: Unsuccessful:
The $segments array is being accessed without first checking if it contains any elements. If $segments is empty, trying to access $segments[0] will trigger the warning. You need to check if the $segments array is not empty before accessing its elements
Open an article and change the user who created it
Check php error log
and/or code review
PHP Warning: Undefined array key 0 in D:\repos\j51\libraries\src\Table\Nested.php on line 1320
no entry in the error-log
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
PR-5.3-dev
|
I see (from code review) that this is a valid fix and it should be merged, but I also can't find it where you had the testing instruction pointing to. (I set a break point and during the author change, this code is never called?) Probably I missed something?
Testing this is problematic for me. Without the patch applied I can change the user and see the segments returned on article save. For a real user I get the three segments expected starting with root. If I select -No User- and save I see an empty array returned and that does not seem to trigger an error. If I force $segments to be null then I get a fatal error. So I must be misunderstanding or doing something wrong.
I have tested this item ✅ successfully on fc7b91b
My last comment was because I had not customised my php error_log location. Having done that I now see the Undefined array key message without the patch and no message with the patch.
Hi @brianteeman, I have 5.3 beta 3 and I am not able to find that PHP Warning in my error_log, do I need to download/install the nightly Joomla_5.3.0-beta4-dev-Development-Full_Package.zip to be able to test this on my test hosting? (sorry for the stupid question, just want to be able to test this)