?
avatar Septdir
Septdir
22 Dec 2018

Steps to reproduce the issue

  1. Create Update server xml file with stable and beta versions. (etc 1.0.1 - stable 3.0.0 - beta)
  2. Go to Extensions: Update and find updates (set minimal stability: stable)
  3. Update extension

Expected result

Show new version 1.0.1
Download 1.0.1 version

Actual result

Show new version 1.0.1
But download 3.0.0(beta) version

System information (as much as possible)

PHP 7.2.10
Joomla 3.9.1

Additional comments

The problem is the function \Joomla\CMS\Update\Updater\Update::stabilityTagToInteger

==== START CHECK beta====
tag: beta
constant: \Joomla\CMS\Update\Updater::STABILITY_BETA
defined: bool(false)

==== START CHECK stable====
tag: stable
constant: \Joomla\CMS\Update\Updater::STABILITY_STABLE
defined: bool(false)
constant(): Couldn't find constant \Joomla\CMS\Update\Updater::STABILITY_BETA in <b>/xxx/libraries/src/Updater/Update.php</b> on line <b>555</b><br />

Attach update server xml if need
jupdate.zip

P.S The simplest solution is to abandon the constants. And use array or swith or if /elseif/else

avatar Septdir Septdir - open - 22 Dec 2018
avatar joomla-cms-bot joomla-cms-bot - change - 22 Dec 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 22 Dec 2018
avatar Bakual
Bakual - comment - 22 Dec 2018

Did you try what happens when you change the version from 3.0.0 beta1 to 3.0.0beta1 (without space) or 3.0.0.beta1 (dot instead of space)?
And what happens when you omit the 1 at the end and just try with beta?

Just to see if it's related to the version string somehow.

avatar Septdir
Septdir - comment - 22 Dec 2018

@Bakual Just for the sake of you checked. The result is the same. What is expected. Because the tag attribute is passed to this function, not the name

At the same time he believed in the presence of spaces. Everything is clear.

If use array it's as verry simple code etc

protected function stabilityTagToInteger($tag)
	{
		$tag   = strtolower($tag);
		$array = array('dev', 'alpha', 'beta', 'rc', 'stable');

		return in_array($tag, $array) ? array_search($tag, $array) : 4;
	}
avatar Bakual Bakual - change - 22 Dec 2018
Status New Closed
Closed_Date 0000-00-00 00:00:00 2018-12-22 16:41:19
Closed_By Bakual
avatar Bakual
Bakual - comment - 22 Dec 2018

I think I've found the issue. Actually the constant was referenced wrongly. Should be \Joomla\CMS\Updater\Updater::STABILITY_BETA instead of \Joomla\CMS\Update\Updater::STABILITY_BETA

See #23319 and please test.

Closing this issue since we have a PR.

avatar Bakual Bakual - close - 22 Dec 2018

Add a Comment

Login with GitHub to post a comment