Skip to content
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

Fix removed "php_strtolower" for PHP 8.4 #690

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

mvorisek
Copy link

@mvorisek mvorisek commented Sep 25, 2024

@@ -610,7 +610,7 @@ static zval *php_imagick_read_property(zend_object *object, zend_string *member,
if (format) {
retval = rv;
ZVAL_STRING(retval, format);
php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bet it should be used conditionally depending on PHP version

Suggested change
zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
#if PHP_VERSION_ID < 80400
php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
#else
zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
#endif

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other 2 places also needs this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't check php-src, looks like the function exists, so probably it's not required

@mvorisek
Copy link
Author

@Danack can we get this merged?

@Jan-E
Copy link
Contributor

Jan-E commented Oct 12, 2024

I checked the patch and it is working. One thing, though: I still use the same code to update PHP 5.3 (yeah, I know), so I had a #ifdef #else #endif construction anyway.

@mvorisek
Copy link
Author

mvorisek commented Oct 12, 2024

Based on https://github.com/Imagick/imagick/blob/3.7.0/package.xml#L8 PHP 5.3 (and lower) is no longer supported.

@mc-comanescu
Copy link

Could we have this merged pretty please? It hit a popular repo in Ubuntu/Debian and now we can't use imagick. Than you for your work folks.

php --version
PHP Warning:  PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib/php/20240924/imagick.so (/usr/lib/php/20240924/imagick.so: undefined symbol: php_strtolower), /usr/lib/php/20240924/imagick.so.so (/usr/lib/php/20240924/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 8.4.0RC1 (cli) (built: Sep 27 2024 04:53:00) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.0RC1, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.0RC1, Copyright (c), by Zend Technologies

@ShaiMagal
Copy link

Same here :-)

php8.4 -v
PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib/php/20240924/imagick.so (/usr/lib/php/20240924/imagick.so: undefined symbol: php_strtolower), /usr/lib/php/20240924/imagick.so.so (/usr/lib/php/20240924/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 8.4.0RC1 (cli) (built: Sep 27 2024 04:52:34) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.0RC1, Copyright (c) Zend Technologies
with Zend OPcache v8.4.0RC1, Copyright (c), by Zend Technologies

@androidacy-user
Copy link

WordPress uses imagick and certain functions are now broken in 8.4

@mvorisek
Copy link
Author

WordPress uses imagick and certain functions are now broken in 8.4

https://github.com/mvorisek/image-php Docker images can be used which contain most of the extensions, incl. this one and the fix, prebuilt.

@androidacy-user
Copy link

WordPress uses imagick and certain functions are now broken in 8.4

https://github.com/mvorisek/image-php Docker images can be used which contain most of the extensions, incl. this one and the fix, prebuilt.

We don't use WordPress in a docker image nor do we currently plan to expend the effort to migrate. We've rolled back to 8.3 for now, but I thought it would be worth mentioning that WordPress is also currently broken with regards to imagemagick on 8.4

@DRSDavidSoft
Copy link

Do we have to go back to 8.3, or will this get merged soon?

smoser added a commit to wolfi-dev/os that referenced this pull request Nov 21, 2024
First, just add the modules, copying from 8.3 versions.

    $ for p in php-8.3-*.yaml; do
      sed -e 's,epoch: .*,epoch: 0,' \
          -e 's,name: php-8.3-,name: php-8.4-,' \
         "$p" > php-8.4${p#php-8.3};
    done

Then fix some to build with 8.4, cherry picking from upstream.

 * php-8.4-pecl-mcrypt - cherry-pick a PR to build for 8.4
   Grab php/pecl-encryption-mcrypt#19
   which just uses php_mt_rand_range rather than now-removed php_rand.

 * php-8.4-imagick - cherry pick pr to build for 8.4
   Grab Imagick/imagick#690 
   to replace php_strlower with zend_str_tolower

 * php-8.4-xdebug - cherry pick several upstream changes
   NOTE: I have very low confidence in this, other than it builds.
   xdebug is active and likely to release a 3.4.0 release soon
   that has php 8.4 support properly.

   By adding php-8.4-xdebug with updates enabled, we will get
   a PR automatically made and hopefully landed just by dropping
   the cherry-picks here.

 * Drop php-8.4-swoole - not supported upstream yet.
    
   Several changes would be needed to make the 5.1.5
   version of swoole build with php 8.4.
   Upstream explicitly removed support from
   the 5.1 branch swoole/swoole-src#5525
   
   There is likely 6.0.0 release coming soon (beta released 2024-10-17).
   We will have to manually re-add at that point in time.

 * php-8.4-memcached and php-8.4-redis are separated out to another PR
   as they are dependent on php-8.4-igbinary output.
@duckietm
Copy link

Please merge this pull request !

@secrethash
Copy link

@Danack any update on this? Sorry to rush but it's a major roadblock for many projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants