[4.2] PHP8.2 Define the JComponentTitle property in WebApplication class#39592
[4.2] PHP8.2 Define the JComponentTitle property in WebApplication class#39592roland-d merged 8 commits intojoomla:4.2-devfrom
Conversation
|
With the change in this PR, JComponentTitle won't be set to $app, so there is backward incompatible change here in case there is an extension (like mod_title in our core code) want to access to this value via For this, maybe we should add JComponentTitle as a public property to |
|
This property was never defined, nor documented, so I wouldn't count it as public API, therefore no BC break. It was added as a property just for the sake of micro optimization and was before in the internal storage of the app, see my linked commit. So we are going basically back to where we were at the beginning. |
I'm unsure about this, so I won't record my test result, sorry. Even if that's accepted, why do we have to use the if (isset($app->JComponentTitle)) {
} |
|
Because it is a hack, you should not define a custom property in a class which doesn't support it. So I'm glad PHP 8.2 did report that. This is an abuse and is bad code practice, I would remove it completely, but you never know what for apps do exist into the wild, so I'm leaving the variable assignment. I would even go that far and deprecated it in 4.3 and remove in 6.0. |
|
I found this on github if this is normal for breezingforms I would expect we break this component right? |
|
here is another one: adding this variable to WebApplication and deprecate it with j4.3 and remove it in 6 would be ok, but we need a bzw. layer for it right? Also I would go more specific with an own Or maybe moving this variable to the htmldocument? would this make more sense? |
Nope, because breezing forms is defining that variable (will also result in a deprecate warning) which then takes precedence here over the value from the app data store. The same applies for solidres. So from BC perspective we are covered, except when a module is using that variable only with core. Then it is not available, but again this is undocumented and not even close to a public API.
This is not the title of the application, it is really only a html string which gets then printed in the title module. So for now I think the closest would probably be the toolbar itself. |
|
Changed my mind and just added the missing property to the WebApplication class. Once upmerged to 4.3 we can then deprecate it. @joomdonation and @carlitorweb would you mind to give it a test? |
|
I have tested this item ✅ successfully on 9dee2a2 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39592. |
1 similar comment
|
I have tested this item ✅ successfully on 9dee2a2 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39592. |
|
RTC. Thanks ! This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39592. |
|
Thank you |
Summary of Changes
Adds a check when the title is rendered in the toolbar if the app has the propertyJComponentTitle.We are going basically back to the beginning cdd4173#diff-5f6eb93d25275fcc88e719c1c9e8df1de7be12c716b4632404256471aa953ad4L41.Defines the missing property
JComponentTitlein the WebApplication class. After this is upmerged to 4.3, it will be deprecated.Testing Instructions
Open the back end with PHP 8.2.
Actual result BEFORE applying this Pull Request
The wollowing warning is shown:
`Creation of dynamic property Joomla\CMS\Application\AdministratorApplication::$JComponentTitle is deprecated in libraries/src/Toolbar/ToolbarHelper.php on line 52
Expected result AFTER applying this Pull Request
No 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