Skip to content

Define JVersion class vars as constants#7217

Merged
Bakual merged 1 commit intojoomla:3.5-devfrom
mbabker:JVersionConst
Jun 20, 2015
Merged

Define JVersion class vars as constants#7217
Bakual merged 1 commit intojoomla:3.5-devfrom
mbabker:JVersionConst

Conversation

@mbabker
Copy link
Copy Markdown
Contributor

@mbabker mbabker commented Jun 20, 2015

Joomla's version data is currently manipulable within a JVersion instance since the data is defined as public facing vars. This PR blocks the ability of developers to be able to manipulate this information by defining the version data as constants instead.

Backward Compatibility

Fetching Data

A magic getter is implemented which will catch any calls which tried to access the previously defined class member variables and will return the corresponding constant instead. A deprecation log message is added for these cases. In instances where someone trying to access an undefined class variable occurs, a E_USER_NOTICE PHP error is generated (similar to PHP's native handling).

Setting Data

With this PR, it's no longer possible. It should have never been possible. But, since we are being so strict on B/C, this must be highlighted. And we should hopefully not use the argument that a developer could previously overwrite the core platform's version data as an excuse to not accept this patch IMO.

Testing Instructions

Make sure you have the version data displayed in the admin toolbar (default yes), apply the patch, and make sure the page loads without any error messages.

@Fedik
Copy link
Copy Markdown
Member

Fedik commented Jun 20, 2015

test after the patch Joomla still works 😉

@brianteeman
Copy link
Copy Markdown
Contributor

Tested and Joomla version still shows in the
toolbar
system information page
metadata when option is enabled to show the version


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

@Bakual Bakual added the RTC This Pull Request is Ready To Commit label Jun 20, 2015
@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Jun 20, 2015

Absolutely agree with making an exception for the potential B/C break here. If an extension really manipulated this, it deserves to break.

Bakual pushed a commit that referenced this pull request Jun 20, 2015
Define JVersion class vars as constants
@Bakual Bakual merged commit 5c7f173 into joomla:3.5-dev Jun 20, 2015
@Bakual Bakual added this to the Joomla! 3.5.0 milestone Jun 20, 2015
@zero-24 zero-24 removed the RTC This Pull Request is Ready To Commit label Oct 14, 2015
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.

6 participants