User tests: Successful: Unsuccessful:
Pull Request for Issue # .
As far as I know it is not possible to import class constants, but when looking for an update to an extension Joomla was trying to do that.
I copied the const to the outside of the Updater class
Install this extension http://pixpro.net/pixext/downloads/module/mod_helloworld/0.0.1/e8e9e3c9f3a9dd3f1d2792d83269ad64.zip and see if it has any updates.
Link to update xml http://pixpro.net/pixext/updates/module/mod_helloworld/e8e9e3c9f3a9dd3f1d2792d83269ad64.xml
It should have an update with version no 0.0.2
It has an update with version no 0.0.6
Category | ⇒ | Libraries |
Status | New | ⇒ | Pending |
not when you are trying to get the value with constant() function
The error is that even if my joomla installation is on "stable" it finds updates that are in "dev" mode
To get a class constant you have to pass the fully qualified class name to the constant()
function.
// Works
$major = constant('Joomla\\CMS\\Version::MAJOR_VERSION');
// Does not work, will give an undefined constant message
$major = constant('MAJOR_VERSION');
It does not on my PHP version 5.6
protected function stabilityTagToInteger($tag)
{
$constant = '\\Joomla\\CMS\\Update\\Updater::STABILITY_' . strtoupper($tag);
if (defined($constant))
{
return constant($constant);
}
return Updater::STABILITY_STABLE;
}
Labels |
Added:
?
|
I have tested this item
Thanks at @johansundell, @csthomas too for this fix,
we had to remove multiple update tags (each of different stability level) because of the bug
i was going to look into this, but did not get time for it
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC after two successful tests.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-10-06 22:05:01 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
|
Yes, it is possible to use class constants. Otherwise
Joomla\CMS\Version::MAJOR_VERSION
would fail, and that doesn't.As is, this PR is invalid because there isn't actually a bug with the import of constants, plus you are defining these constants at the namespace level and not in the class. What is the specific bug (with error message(s) if available) you are seeing?