Closed aaemnnosttv closed 6 months ago
IB ✅
QA:Eng verified ✅
idn_to_utf8
and idn_to_ascii
are tested in URLTest::test_permute_site_hosts
I did a bit of extra testing here just because this has bitten us before when used in an environment without the intl
extension just to make sure the polyfill is working as expected.
Confirmed that idn_to_ascii
didn't exist from PHP
server:~/example.com$ php -r 'var_dump(function_exists("idn_to_ascii"));'
bool(false)
Confirmed idn_to_ascii
was defined by the SK-loaded polyfill 👍
server:~/example.com$ wp shell
wp> $rf = new ReflectionFunction('idn_to_ascii')
=> object(ReflectionFunction)#2939 (1) {
["name"]=>
string(12) "idn_to_ascii"
}
wp> $rf->isUserDefined()
=> bool(true)
wp> $rf->getFileName()
=> string(127) "/.../public/wp-content/plugins/google-site-kit/third-party/symfony/polyfill-intl-idn/bootstrap.php"
wp>
Feature Description
The
true/punycode
package is no longer maintained and should be replaced.Its repository suggests using
symfony/polyfill-intl-idn
as the recommended maintained replacement which is already installed as a dependency ofguzzlehttp/guzzle
. We should update our usage of the old package to use the proper PHP internals where safely polyfilled by the Symfony package.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
true/punycode
package should be removed as a dependencyidn_to_ascii
andidn_to_utf8
symfony/polyfill-intl-idn
package should be requiredImplementation Brief
symfony/polyfill-intl-idn
v1.19.0 as a direct PHP dependency (require
) incomposer.json
.includes/Core/Util/URL.php
, refactor the class to replace the usage ofGoogle\Site_Kit_Dependencies\TrueBV\Punycode
with the native alternatives. which will be safely polyfilled by the aforementioned package.Punycode::PREFIX
,xn--
as a const fieldPunycode_PREFIX
in the class.$punycode->decode
withidn_to_utf8
.$punycode->decode
withidn_to_ascii
.true/punycode
package fromcomposer.json
Test Coverage
QA Brief
permute_site_hosts
behaviour has not changed.Changelog entry
true/punycode
package withsymfony/polyfill-intl-idn
.