Define JVersion class vars as constants#7217
Merged
Bakual merged 1 commit intojoomla:3.5-devfrom Jun 20, 2015
mbabker:JVersionConst
Merged
Define JVersion class vars as constants#7217Bakual merged 1 commit intojoomla:3.5-devfrom mbabker:JVersionConst
Bakual merged 1 commit intojoomla:3.5-devfrom
mbabker:JVersionConst
Conversation
Member
|
test after the patch Joomla still works 😉 |
Contributor
|
Tested and Joomla version still shows in the This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7217. |
Contributor
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_NOTICEPHP 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.