roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.86k stars 1.63k forks source link

Undefined constant "INTL_IDNA_VARIANT_UTS46" after php update to 8.1 #8755

Closed efelon closed 1 year ago

efelon commented 2 years ago

Roundcube Webmail 1.6.0 nginx/1.14.2

After switching php from 7.3, where everything worked as expected, to 8.1 I get the following error: (php composer.phar update --no-dev was executed with php8.1 after the switch)

PHP Fatal error: Uncaught Error: Undefined constant "INTL_IDNA_VARIANT_UTS46" in /var/www/webmail/program/lib/Roundcube/rcube_utils.php:1146

I could fix the error like this:

        // $variant = INTL_IDNA_VARIANT_UTS46;
        $variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : null;

Otherwise roundcube refuses to start.

alecpl commented 2 years ago

Looks like some ancient ICU versions might not have this constant defined. https://github.com/guzzle/guzzle/issues/2448

efelon commented 2 years ago

This is in my composer.json: "guzzlehttp/guzzle": "^7.3.0", An this is what composer reports:

# php composer.phar show | grep guzzle
guzzlehttp/guzzle                    7.4.5              Guzzle is a PHP HTTP client library
guzzlehttp/promises                  1.5.1              Guzzle promises library
guzzlehttp/psr7                      2.4.0              PSR-7 message implementation that also provides common utility methods
tnt commented 1 year ago

I could fix the error like this:

        // $variant = INTL_IDNA_VARIANT_UTS46;
        $variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : null;

Thanks for this. Works perfectly for me

alecpl commented 1 year ago

Hmmm... On my PHP 8.1 using null creates problems: PHP Deprecated: idn_to_ascii(): Passing null to parameter #3 ($variant) of type int is deprecated and the result is empty. Using 0 does not print a warning, but causes idn_to_ascii() to return empty result. So, proposed solution does not sound right to me.

I wonder whether INTL_IDNA_VARIANT_2003 constant could be used instead. Does it exist on your systems? However, it's deprecated since PHP 7.2.

efelon commented 1 year ago

Sorry for the late reply @alecpl , no the variable INTL_IDNA_VARIANT_2003 is also not available.

[22-Nov-2022 15:19:08 Europe/Berlin] PHP Fatal error:  Uncaught Error: Undefined constant "INTL_IDNA_VARIANT_2003" in /var/www/webmail/program/lib/Roundcube/rcube_utils.php:1147

In the meantime I tested the same behaviour on Debian bullseye with the same result, but slightly newer version of guzzle:

guzzlehttp/guzzle                  7.5.0              Guzzle is a PHP HTTP c...
guzzlehttp/promises             1.5.2              Guzzle promises library
guzzlehttp/psr7                      2.4.3              PSR-7 message implemen...
alecpl commented 1 year ago

This really has nothing to do with Guzzle.

efelon commented 1 year ago

Couldn't symfony/polyfill-intl-idn provide this variable? Or do you think there is just a OS php package missing?

(found a reference to it here)

alecpl commented 1 year ago

I thought you have 'intl' extension installed, and still got this error. But if do not have it, then you have to install it. It is required.

efelon commented 1 year ago

Yes indeed, php8.1-intl was missing and fixes the error.

I didn't find a reference in the requirements, and on the installation page for Debian I missed it, sorry and thank you for your help.

Code-TT commented 1 year ago

$variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : null;

This helped! Thank you!

Sailing74 commented 8 months ago

Not entirely sure why this issue is closed. I just had the same problem on an Ubuntu 22.04 LTS with Roundcube 1.6.6 pop up. The solution suggested here works to fix the issue.

priitl802 commented 5 months ago

Same thing. $variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : null; saved the day.

Just upgraded php and it's modules to 8.2.19 over 8.2.14 and it broke down, Debian 11, Roundcube 1.6.5.

jbellionjourdan commented 4 months ago

Same today for me with php 8.3.8 on ArchLinux. intl is enabled in /etc/php/php.ini