Updates Requested PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
2 Mar 2025

Pull Request for Issue #45001 and #42236 .

Summary of Changes

remove warning

Testing Instructions

Go to System > Administrator Template Styles.
Edit Atum - Default.
Click Save button.
See PHP error log.

or
run
npx cypress run --spec '.\tests\System\integration\api\com_templates\Administrator.cy.js'

npx cypress run --spec '.\tests\System\integration\api\com_templates\Site.cy.js'

Actual result BEFORE applying this Pull Request

PHP Warning: Attempt to read property "parent" on array in \administrator\components\com_templates\src\Model\StyleModel.php on line 399

PHP Warning: Attempt to read property "parent" on array in \administrator\components\com_templates\src\Model\StyleModel.php on line 400

PHP Warning: Attempt to read property "parent" on array in \administrator\components\com_templates\src\Model\StyleModel.php on line 400

Expected result AFTER applying this Pull Request

no more warning

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 alikon alikon - open - 2 Mar 2025
avatar alikon alikon - change - 2 Mar 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Mar 2025
Category Administration com_templates
avatar muhme muhme - test_item - 2 Mar 2025 - Tested successfully
avatar muhme
muhme - comment - 2 Mar 2025

I have tested this item ✅ successfully on 5c9b378

Tested before applying this patch there are four "PHP Warning" messages from the web server from running the two tests:

scripts/test 53 system '{tests/System/integration/api/com_templates/Administrator.cy.js,tests/System/integration/api/com_templates/Site.cy.js}'

After applying this PR with scripts/patch 53 joomla-cms-45052 there is no "PHP Warning" message anymore and the Cypress tests still run successful


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45052.
avatar alikon
alikon - comment - 2 Mar 2025

@SharkyKZ apart of your "usual" 👎 can you explain a little bit more ?

avatar joomdonation
joomdonation - comment - 4 Mar 2025

The warning here comes from mixed data type of $data parameter:

  • Usually, $data is an object
  • But in some case (for example, when saving item false), Joomla redirect to edit item form and in that case, $data is an array

For the time being, to be safe, you should update code to handle the case $data is an array (see the code from line 415 to 417 to get an idea). Later, we might want to discuss to see if we should update code of loadFormData method to always return object to make it simpler to handle $data

avatar joomdonation
joomdonation - comment - 5 Mar 2025

@alikon This issue should be covered by #45077 . Could you please help testing that PR to see if it address the issue you are having here? If Yes, this PR can be closed. Thanks

avatar alikon
alikon - comment - 6 Mar 2025

i've done a test with your #45077 in place with current fresh staging
still got ```

[06-Mar-2025 12:24:27 UTC] PHP Warning: Undefined property: stdClass::$parent in C:\laragon\www\530\administrator\components\com_templates\src\Model\StyleModel.php on line 344
[06-Mar-2025 12:24:27 UTC] PHP Warning: Undefined property: stdClass::$parent in C:\laragon\www\530\administrator\components\com_templates\src\Model\StyleModel.php on line 345
[06-Mar-2025 12:24:27 UTC] PHP Warning: Undefined property: stdClass::$parent in C:\laragon\www\530\administrator\components\com_templates\src\Model\StyleModel.php on line 345

avatar joomdonation
joomdonation - comment - 6 Mar 2025

Thanks @alikon. I am not familiar with the test but I will try to read the code to see how it happens and get it sorted.

avatar alikon
alikon - comment - 6 Mar 2025

you don't need to be familiar to the "automatic test" just edit & save atum from backend 😄

avatar joomdonation
joomdonation - comment - 7 Mar 2025

you don't need to be familiar to the "automatic test" just edit & save atum from backend 😄

Thanks. I see the reason of the warning. Fixed now, so it would be great if you can take another look :).

avatar alikon
alikon - comment - 7 Mar 2025

sure i'll do it

avatar alikon alikon - close - 7 Mar 2025
avatar alikon
alikon - comment - 7 Mar 2025

closing in favour of #45077

avatar alikon alikon - change - 7 Mar 2025
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2025-03-07 11:58:20
Closed_By alikon
Labels Added: Updates Requested PR-5.3-dev

Add a Comment

Login with GitHub to post a comment