Skip to content

setTemplate creates invalid template record#32710

Merged
rdeutz merged 2 commits intojoomla:4.0-devfrom
weeblr:weeblr-32709
May 14, 2021
Merged

setTemplate creates invalid template record#32710
rdeutz merged 2 commits intojoomla:4.0-devfrom
weeblr:weeblr-32709

Conversation

@weeblr
Copy link
Copy Markdown
Contributor

@weeblr weeblr commented Mar 17, 2021

See issue #32709

Pull Request for Issue # .

Summary of Changes

Template record in application object now also has inheritable and parent properties which are not set by SiteApplication::setTemplate. This causes large numbers of PHP notices to be logged in various places.

Changes made is B/C, allowing either to pass in a full template definition object (with custom inheritable, params and parent props) or just the template name as a string.

Testing Instructions

Factory::getApplication()->setTemplate('new_template');

Actual result BEFORE applying this Pull Request

[17-Mar-2021 09:05:41 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:41 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 179
[17-Mar-2021 09:05:41 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Plugin\PluginHelper.php on line 61
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Plugin\PluginHelper.php on line 61
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Plugin\PluginHelper.php on line 61
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Error\Renderer\HtmlRenderer.php on line 76
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Document\Renderer\Html\MetasRenderer.php on line 130
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Document\Renderer\Html\MetasRenderer.php on line 130
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Document\Renderer\Html\MetasRenderer.php on line 134
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Document\Renderer\Html\MetasRenderer.php on line 130
[17-Mar-2021 09:05:42 UTC] PHP Notice:  Undefined property: stdClass::$parent in V:\dev\workspaces\products\src\j4\libraries\src\Application\SiteApplication.php on line 402

Expected result AFTER applying this Pull Request

No PHP notices.

Documentation Changes Required

@joeforjoomla
Copy link
Copy Markdown
Contributor

@weeblr this is already related to this PR #30360
Nobody seems to care about fixing it

@rdeutz
Copy link
Copy Markdown
Contributor

rdeutz commented Mar 17, 2021

@joeforjoomla as long as testing doesn't run sucessfully we are not going to merge, that's different from not caring

@joeforjoomla
Copy link
Copy Markdown
Contributor

@rdeutz as i see tests are successfully since months

@rdeutz
Copy link
Copy Markdown
Contributor

rdeutz commented Mar 17, 2021

@rdeutz as i see tests are successfully since months

currently not

grafik

@weeblr
Copy link
Copy Markdown
Contributor Author

weeblr commented Mar 17, 2021

@rdeutz I fixed the 3 spaces codestyle in this PR.

In addition, this PR should address the comment by @SharkyKZ in #30360 (comment). It allows passing either a string (B/C) as template name, in which case parent and inheritable have default values (0 and ''). Or if $template is an object, it expects it to have inheritable and parent properties which are then assigned to the template property itself.

Side note: the failing test in the #30360 don't seem related to the PR itself, but rather the test system (composer issue).

Yannick

@dgrammatiko
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on b828804

Thank you Yannick


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

@richard67
Copy link
Copy Markdown
Member

@weeblr Does this PR here replace #30360 by fixing the same issue in a better way? Or is that PR still needed when this one here will be merged? Am asking just to be sure I understand right.

@dgrammatiko
Copy link
Copy Markdown
Contributor

@richard67 yes, this replaces the other PR and also adds the missing points that @SharkyKZ was pointed in there. So this is complete compared to the other PR

@weeblr
Copy link
Copy Markdown
Contributor Author

weeblr commented Mar 17, 2021

@richard67 I was not aware of #30360 until @joeforjoomla mentioned it. It does solve the same problem, changing the same method, in a differrent way.

I feel my approach is more flexible but I'd leave up that to reviewers to decide.

@richard67
Copy link
Copy Markdown
Member

@dgrammatiko @weeblr Thanks for your feedback. I'll close the other PR in favour of this here.

@dgrammatiko
Copy link
Copy Markdown
Contributor

@richard67 can you add a release blocker here?

@richard67
Copy link
Copy Markdown
Member

@richard67 can you add a release blocker here?

@dgrammatiko Why does that suddenly become a release blocker?

@wilsonge What's your opinion? Release blocker or not?

@dgrammatiko
Copy link
Copy Markdown
Contributor

Why does that suddenly become a release blocker?

This PR replaced #30360 which was (or should have been RB). Anyways if this PR isn't merged is kinda hard to programmatically set a template (eg the API is broken)

@richard67
Copy link
Copy Markdown
Member

#30360 never had the release blocker label.

@richard67
Copy link
Copy Markdown
Member

I've asked for opinions in Glip in maintainers and JBS channel. Will see what they say.

@joomdonation
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on b828804


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

@joomla-cms-bot joomla-cms-bot removed this from the Joomla 4.0 milestone May 13, 2021
@richard67
Copy link
Copy Markdown
Member

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label May 13, 2021
@richard67 richard67 added this to the Joomla 4.0 milestone May 13, 2021
@rdeutz rdeutz merged commit dad70fa into joomla:4.0-dev May 14, 2021
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants