Mibew / mibew

Mibew Messenger - open-source live support application
https://mibew.org
Other
473 stars 204 forks source link

vierbergenlars\\SemVer\\SemVerException "Invalid Version: 7.3.14-1~deb10u1 [[7.3.14-1~deb10u1]]" #246

Closed tocy13 closed 4 years ago

tocy13 commented 4 years ago

Environment

[php7:warn] [pid 34304] [client 10.5.10.191:1362] PHP Warning: Application stopped because of uncaught exception vierbergenlars\SemVer\SemVerException "Invalid Version: 7.3.14-1~deb10u1 [[7.3.14-1~deb10u1]]" (/var/www/html/mibew/vendor/vierbergenlars/php-semver/src/vierbergenlars/SemVer/version.php:27) in /var/www/html/mibew/libs/classes/Mibew/Application.php on line 164, referer: https://site.com/operator

faf commented 4 years ago

To begin with you didn't specified the version of Mibew Messenger. However, I can confirm that the issue is valid for the actual code.

The sad truth is that Mibew Messenger use semantic versioning system for dependencies management. And Debian versioning system is slightly incompatible with Semver. One can see the differences here:

https://semver.org/spec/v2.0.0.html#backusnaur-form-grammar-for-valid-semver-versions https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version

In short, in Debian they use tilda for pre-release tags, while Semver standard says that it should be hyphen. So, here is the dilemma. On the one hand Debian doesn't comply with the standard, on the other hand Debian is very popular, so it's important to support it...

Though, there should not be internal server error anyway. So some fix will follow.

tocy13 commented 4 years ago

Thank you very much for your fast response. I am using the latest version of mibew. I can confirm that it works well on CentOS. Cheers,

faf commented 4 years ago

Well, Debian is much bigger than Mibew...

@tocy13 Please, check the https://github.com/Mibew/mibew/tree/debian_fix branch. If that fix will work for you, I'll put in upstream.

tocy13 commented 4 years ago

Hi, By checking the branch I see the only difference is in src/mibew/libs/classes/Mibew/Plugin/DependencyGraph.php file - line 284. With this modification, once I enabled bcmath php7.3 extension I still got the 500 Internal server error when going to the plugins page. [Thu Mar 19 10:41:09.019919 2020] [php7:warn] [pid 17112] [client 10.X.X.X:24150] PHP Warning: Application stopped because of uncaught exception vierbergenlars\SemVer\SemVerException "Invalid Version: 7.3.14-1~deb10u1 [[7.3.14-1~deb10u1]]" (/var/www/html/mibew/vendor/vierbergenlars/php-semver/src/vierbergenlars/SemVer/version.php:27) in /var/www/html/mibew/libs/classes/Mibew/Application.php on line 164, referer:

In a previous fix you have provided, I saw that src/mibew/libs/classes/Mibew/Plugin/PluginInfo.php was also modified. Should this file be updated as well?

Thanks

tocy13 commented 4 years ago

When I replaced line 271 in src/mibew/libs/classes/Mibew/Plugin/PluginInfo.php with the following one:

if (!$version_constrain->satisfiedBy(new Version(preg_replace('/~/', '-', $system_info[$lib]), true))) {

then everything started working. Thanks

faf commented 4 years ago

@tocy13 Sorry, my bad. :)

And DependencyGraph.php should stay unchanged: it's related only to plugins, and plugins should follow the rules of semantic versioning.

I'll merge the fix into upstream in the near future.

tocy13 commented 4 years ago

Thank you. I restored DependencyGraph.php to the default 3.2.5 content and all still works:) I appreciate your fast response.