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

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

Closed
efelon opened this issue Oct 20, 2022 · 11 comments
Closed

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

efelon opened this issue Oct 20, 2022 · 11 comments

Comments

@efelon
Copy link

efelon commented Oct 20, 2022

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
Copy link
Member

alecpl commented Oct 20, 2022

Looks like some ancient ICU versions might not have this constant defined. guzzle/guzzle#2448

@efelon
Copy link
Author

efelon commented Oct 20, 2022

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
Copy link

tnt commented Nov 10, 2022

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
Copy link
Member

alecpl commented Nov 11, 2022

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
Copy link
Author

efelon commented Nov 22, 2022

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
Copy link
Member

alecpl commented Nov 22, 2022

This really has nothing to do with Guzzle.

@efelon
Copy link
Author

efelon commented Nov 22, 2022

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
Copy link
Member

alecpl commented Nov 22, 2022

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
Copy link
Author

efelon commented Nov 22, 2022

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.

@efelon efelon closed this as completed Nov 22, 2022
@Code-TT
Copy link

Code-TT commented Mar 23, 2023

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

This helped! Thank you!

@Sailing74
Copy link

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.

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

No branches or pull requests

5 participants