-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requirement check in upgrade.php does not validate OR dependencies correctly #14972
Comments
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
That hasn't been changed in quite some time though - I'm surprised this hasn't come up before if it's a genuine bug. (Not saying it's not, just strange that this is the first time it's reported.) |
Indeed. Maybe most people just use PHP GD, but I didn't install the module on our system because ImageMagick was already installed. Reduce attack surface and all that, you know. |
That's certainly possible. I haven't used ImageMagick in a decade, since most systems already have gd installed. I'm not sure of a reliable way to test this though. :-/ |
I just created a PR for this #14986 but also didn't fully test it by uninstalling extensions from my local system. I detailed how I "faked" it in the PR. |
@marcusmoore i think that’s a good best effort here - Ty! |
Will do, thank you! 👍 |
Debug mode
Describe the bug
On a PHP installation which does not have the first module of an OR dependency available (e.g. the
gd|imagick
dependency with onlyimagick
installed),upgrade.php
will claim that both extensions are missing.I can't recall if this was an issue during the initial installation as well, but it might be worth checking if any other dependency checks also behave the same way as
upgrade.php
currently does.Reproduction steps
imagick
module.upgrade.php
.Expected behavior
upgrade.php
correctly identifies the dependencygd|imagick
to be present.Screenshots
No response
Snipe-IT Version
7.0.4
Operating System
Debian 12 (bookworm)
Web Server
nginx
PHP Version
PHP 8.2.20
Operating System
No response
Browser
No response
Version
No response
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
$ php8.2 -m [PHP Modules] bcmath calendar Core ctype curl date dom exif FFI fileinfo filter ftp gettext hash iconv imagick json ldap libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql pdo_pgsql pgsql Phar posix random readline Reflection session shmop SimpleXML sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl Zend OPcache zip zlib [Zend Modules] Zend OPcache
Additional context
The error is most likely caused by LL288-295. This piece of the code loops over all optional dependencies in a dependency entry (e.g.
gd
andimagick
), and checks for each of the entries if they are available. If it's available, it exits the loop, but if it's not available, it also exits the loop. This section should instead look similar to the following:The text was updated successfully, but these errors were encountered: