No Code Attached Yet
avatar Stevec4
Stevec4
3 May 2022

Steps to reproduce the issue

Installed 4.13.RC1 over a 4.1.2 Install, received a notice of 3 overrides to check. When selecting my template I receive the following warning

Expected result

No Warning

Actual result

Warning: Undefined property: Joomla\CMS\Object\CMSObject::$inheritable \administrator\components\com_templates\src\Model\TemplateModel.php on line 2221

System information (as much as possible)

PHP 8.0.13
Database Version | 10.4.22-MariaDB
utf8mb4_general_ci
Frontend Template - Yo0theme
XAMMP

Additional comments

avatar Stevec4 Stevec4 - open - 3 May 2022
avatar joomla-cms-bot joomla-cms-bot - change - 3 May 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 May 2022
avatar Stevec4
Stevec4 - comment - 3 May 2022

I changed the line of code to, and the error is removed.
if (!isset($template->xmldata->inheritable))

avatar chmst
chmst - comment - 3 May 2022

Is this new? Not in 4.1.2?

avatar brianteeman
brianteeman - comment - 3 May 2022

Installed over, how?
Or did you mean upgraded

avatar richard67
richard67 - comment - 3 May 2022

I think the problem is that the Yotheme template doesn't provide the inheritable property in the template details XML file, like Cassiopeia has it here: https://docs.google.com/spreadsheets/d/1VY77oqekLMzKExyqlJ3q_H692bRl3ik8_-0J8aP0ZV0/edit#gid=0

To handle this, line 2221 of the template model should indeed be changed like @Stevec4 suggested above.

@dgrammatiko Do you agree? Or do we require the inheritable property in the template details XML files in 4.1?

@Stevec4 Do you want to make a pull request? Testing instructions would be more or less the same as here: #36250 .

avatar dgrammatiko
dgrammatiko - comment - 3 May 2022

@dgrammatiko Do you agree? Or do we require the inheritable property in the template details XML files in 4.1?

This is weird as the installer should always inject the inheritable and parent at the installation process:

(int) $this->manifest->inheritable,
(string) $this->manifest->parent ?: '',

And when we did the upgrade from 4.0.x to 4.1 we also injected the values (not inheritable no parent) to all templates, iirc. So this is weird...

avatar Stevec4
Stevec4 - comment - 3 May 2022

To clarify:
It was an upgrade using the full RC1 zip file from github, not via Joomla update,
This warning was not present in my Joomla 4.1.2

Steve

avatar dgrammatiko
dgrammatiko - comment - 3 May 2022

@Stevec4 actually your solution is fine, the code as written right now expects that the inheritable attribute exists in the XML, which is falsy for legacy templates. Maybe if (!isset($template->xmldata->inheritable) || !$template->xmldata->inheritable) to get the falsy part for templates with an inheritable attribute with a 0 value

avatar richard67
richard67 - comment - 3 May 2022

@dgrammatiko if (!isset($template->xmldata->inheritable) || !$template->xmldata->inheritable) ... wouldn't that just be easier with if (empty($template->xmldata->inheritable))?

avatar dgrammatiko
dgrammatiko - comment - 3 May 2022

@richard67 that would work as well

avatar Stevec4
Stevec4 - comment - 3 May 2022

@richard67 I have never done a PR but I am happy to if you like. I tried both changes the one Dimitris suggested and yours above and both solve the issue.

Steve

avatar richard67
richard67 - comment - 3 May 2022

@richard67 I have never done a PR but I am happy to if you like.

@Stevec4 Go for it. If you struggle with Git or GitHub we can advise.

avatar richard67
richard67 - comment - 4 May 2022

@Stevec4 Or did I get you wrong and I shall make the PR?

avatar Stevec4
Stevec4 - comment - 4 May 2022

I will give it a go now @richard67

avatar Stevec4
Stevec4 - comment - 4 May 2022

@richard67 feel free correct the PR if I have messed it up.

avatar richard67 richard67 - change - 4 May 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-05-04 15:01:11
Closed_By richard67
avatar richard67 richard67 - close - 4 May 2022
avatar richard67
richard67 - comment - 4 May 2022

Closing as having a pull request. See #37739 .

Add a Comment

Login with GitHub to post a comment