Commit da1941b
committed
Graby: Use consistent arguments for
As per <https://www.php.net/manual/en/function.idn-to-ascii.php>, PHP 7.2 deprecated the `INTL_IDNA_VARIANT_2003` constant. But until PHP 7.4, it was still used as the default value of the `$variant` argument and will trigger a deprecation warning (https://github.com/php/php-src/blob/php-7.3.0/ext/intl/idn/idn.c#L318-L320). This in turn broke tests on PHP 7.2 and 7.3:
1x: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated
1x in GrabyTest::testUrlWithAccent from Tests\Graby
This is not an issue on `master` since we require PHP ≥ 7.4 there.
One option would be passing the `INTL_IDNA_VARIANT_UTS46` explicitly to the `$variant` argument so that it is consistent across all supported PHP versions. Unfortunately, this would require raising the requirements to ICU ≥ 4.6, which would break systems that have `intl` extension linked against ancient ICU (allowed on PHP before 7.4: https://github.com/php/php-src/blob/php-7.2.0/ext/intl/idn/idn.c#L85-L87).
Polyfill does support emulating `INTL_IDNA_VARIANT_UTS46` but it will not do anything if the presence of any `intl` extension is detected (https://github.com/symfony/polyfill-intl-idn/blob/v1.26.0/bootstrap.php#L14-L16). So it will not help us when the constant we want does not actually exist.
We could silence the warning with `@` but that is always iffy.
For now, let’s use the polyfill explicitly on PHP 7.2 or 7.3 built with `intl` extension linked against ICU < 4.6. The PHP implementation will be a bit slower but the situation is pretty unlikely in my opinion.idn_to_ascii across PHP versions1 parent 1d2de31 commit da1941b
1 file changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
491 | 492 | | |
492 | 493 | | |
493 | 494 | | |
494 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
495 | 504 | | |
496 | 505 | | |
497 | 506 | | |
| |||
0 commit comments