google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.23k stars 284 forks source link

Update usage of abandoned package #8094

Closed aaemnnosttv closed 6 months ago

aaemnnosttv commented 8 months ago

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 of guzzlehttp/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

Implementation Brief

Test Coverage

QA Brief

Changelog entry

tofumatt commented 7 months ago

IB ✅

zutigrm commented 7 months ago

QA:Eng verified ✅

aaemnnosttv commented 6 months ago

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>