Solution-Guzzle idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated
Guzzle is a PHP package that use by many frameworks like CakePHP. With PHP > 7, guzzlehttp gives an error like idn_to_ascii() is deprecated. So we can solve these issues by
1) Downgrade Guzzle
2) Reinstall Packages
3) Upgrade PHP Version
If your issue still exists and then we can try to avoid deprecated errors by adding @ before idn_to_ascii() function, it will prevent to generate deprecation errors for this function. Yes we do not make changes in vendor files and also it's not a good way to handle error but sometimes it works
1) Downgrade Guzzle
2) Reinstall Packages
3) Upgrade PHP Version
If your issue still exists and then we can try to avoid deprecated errors by adding @ before idn_to_ascii() function, it will prevent to generate deprecation errors for this function. Yes we do not make changes in vendor files and also it's not a good way to handle error but sometimes it works
and that's all we wanna do.
Example:
For me its showing error like
Example:
For me its showing error like
idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated
[ROOT/vendor/guzzlehttp/guzzle/src/Utils.php, line 35]
SO i have opened Utils.php file and added @ before function like below code
BEFORE
public static function idnUriConvert(UriInterface $uri, $options = 0) { if ($uri->getHost()) { $idnaVariant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0; $asciiHost = $idnaVariant === 0 ? idn_to_ascii($uri->getHost(), $options) : idn_to_ascii($uri->getHost(), $options, $idnaVariant, $info);
AFTER
public static function idnUriConvert(UriInterface $uri, $options = 0) { if ($uri->getHost()) { $idnaVariant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0; $asciiHost = $idnaVariant === 0 ? @idn_to_ascii($uri->getHost(), $options) : @idn_to_ascii($uri->getHost(), $options, $idnaVariant, $info);
Comments
Post a Comment