PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar brianteeman
brianteeman
20 Mar 2025

Summary of Changes

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

Testing Instructions

image

Open an article and change the user who created it
Check php error log

and/or code review

Actual result BEFORE applying this Pull Request

PHP Warning: Undefined array key 0 in D:\repos\j51\libraries\src\Table\Nested.php on line 1320

Expected result AFTER applying this Pull Request

no entry in the error-log

Link to documentations

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

avatar brianteeman brianteeman - open - 20 Mar 2025
avatar brianteeman brianteeman - change - 20 Mar 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Mar 2025
Category Libraries
avatar brianteeman brianteeman - change - 20 Mar 2025
The description was changed
avatar brianteeman brianteeman - edited - 20 Mar 2025
avatar brianteeman brianteeman - change - 20 Mar 2025
The description was changed
avatar brianteeman brianteeman - edited - 20 Mar 2025
avatar brianteeman brianteeman - change - 20 Mar 2025
Labels Added: PR-5.3-dev
avatar exlemor
exlemor - comment - 22 Mar 2025

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)

avatar brianteeman
brianteeman - comment - 23 Mar 2025

@exlemor you probably need to ensure that php is set to log all errors and warnings
error_reporting=E_ALL

avatar bembelimen
bembelimen - comment - 25 Mar 2025

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?

avatar ceford
ceford - comment - 27 May 2025

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.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45176.

avatar ceford ceford - test_item - 27 May 2025 - Tested successfully
avatar ceford
ceford - comment - 27 May 2025

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.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45176.

Add a Comment

Login with GitHub to post a comment