Skip to content

[4.2] PHP8.2 Allow dynamic properties for Table, MenuItem and CMSObject#39591

Merged
HLeithner merged 3 commits intojoomla:4.2-devfrom
Digital-Peak:php82/dynamic-props
Jan 12, 2023
Merged

[4.2] PHP8.2 Allow dynamic properties for Table, MenuItem and CMSObject#39591
HLeithner merged 3 commits intojoomla:4.2-devfrom
Digital-Peak:php82/dynamic-props

Conversation

@laoneo
Copy link
Copy Markdown
Member

@laoneo laoneo commented Jan 11, 2023

Summary of Changes

Adds the AllowDynamicProperties attribute to the core classes Table, MenuItem and CMSObject to mark them as classes which do use dynamic properties.

Testing Instructions

Open the back end with PHP 8.2.

Actual result BEFORE applying this Pull Request

Tons of deprecated warnings like:
Deprecated: Creation of dynamic property ...... is deprecated in

Expected result AFTER applying this Pull Request

No warning in the mentioned classes.

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

@laoneo laoneo added the PHP 8.x PHP 8.x deprecated issues label Jan 11, 2023
@laoneo laoneo changed the title Allow dynamic properties for Table, MenuItem and CMSObject [4.2] PHP8.2 Allow dynamic properties for Table, MenuItem and CMSObject Jan 11, 2023
@Hackwar
Copy link
Copy Markdown
Member

Hackwar commented Jan 11, 2023

Do we need this for the Table class? Doesn't it inherit that behavior from the CMSObject class?

@laoneo
Copy link
Copy Markdown
Member Author

laoneo commented Jan 11, 2023

I wanted to make it explicit for better understanding.

@wilsonge
Copy link
Copy Markdown
Contributor

wilsonge commented Jan 11, 2023

Table/CMSObject obviously fine (I mean Hannes is right but I have no problem with it being explicit). In theory MenuItem shouldn't have needed this. Is there a public property missing from the class or something?

@laoneo
Copy link
Copy Markdown
Member Author

laoneo commented Jan 11, 2023

In theory MenuItem shouldn't have needed this. Is there a public property missing from the class or something?

I thought the same till I saw this code

https://github.com/joomla/joomla-cms/blob/4.2-dev/libraries/src/Menu/MenuItem.php#L208

@joomdonation
Copy link
Copy Markdown
Contributor

I am also unsure about MenuItem class. It does not need AllowDynamicProperties attribute. It should be added to AdministratorMenuItem class instead, at least from what I see in core usages.

@joomdonation
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 1791350

Change my mind. Dynamic properties for MenuItem class are added MenuHelper class of mod_menu frontend.


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

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Jan 12, 2023

I have tested this item ✅ successfully on 3412c5f


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

@joomdonation
Copy link
Copy Markdown
Contributor

@SharkyKZ Would be great if you could explain the reason for your thumb down reaction to this PR . Thanks !

@laoneo
Copy link
Copy Markdown
Member Author

laoneo commented Jan 12, 2023

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jan 12, 2023
@HLeithner HLeithner merged commit 4467f92 into joomla:4.2-dev Jan 12, 2023
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jan 12, 2023
@laoneo laoneo deleted the php82/dynamic-props branch January 12, 2023 15:35
@HLeithner
Copy link
Copy Markdown
Member

At some point we should get rid of all dynamic properties but for now I think being explicit makes it better to identify problems

@HLeithner
Copy link
Copy Markdown
Member

thanks

@Quy Quy added this to the Joomla! 4.2.7 milestone Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PHP 8.x PHP 8.x deprecated issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants