From 9a0819b9723a0c1b09b3318cecbcd9782f7da013 Mon Sep 17 00:00:00 2001 From: upwardmomentum84 <93800099+upwardmomentum84@users.noreply.github.com> Date: Tue, 2 Dec 2025 11:00:04 -0500 Subject: [PATCH 01/49] Update class-jetpack-plugin-compatibility.php In reference to the Audit Blocked Plugins Project - https://linear.app/a8c/project/audit-blocked-plugins-0e4e3a73bb43/overview . This commit covers all plugins reviewed as part of "Group 1" of the project (categories: Email, Backup, and Miscellaneous). Summary of plugin changes here: https://atomicrequests.wordpress.com/2025/07/14/incompatible-plugins-block-outreach-requests-2025/#comment-68191 Some lines were moved to group in proper categories and sort alphabetically. This is to align with other platform code that blocks incompatible plugins. --- .../class-jetpack-plugin-compatibility.php | 38 +++++-------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php b/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php index 68a2ccff2448..fc58879551a2 100644 --- a/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php +++ b/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php @@ -25,22 +25,18 @@ class Jetpack_Plugin_Compatibility { 'advanced-wp-reset/advanced-wp-reset.php' => '"advanced-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'backup/backup.php' => '"backup" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'better-wp-security/better-wp-security.php' => '"better-wp-security" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'cf7-pipedrive-integration/class-cf7-pipedrive.php' => '"cf7-pipedrive-integration" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', 'database-browser/database-browser.php' => '"database-browser" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'duplicator/duplicator.php' => '"duplicator" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'extended-wp-reset/extended-wp-reset.php' => '"extended-wp-reset" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', 'file-manager-advanced/file_manager_advanced.php' => '"file-manager-advanced" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'file-manager/file-manager.php' => '"file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'hide-my-wp/index.php' => '"hide-my-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'plugins-garbage-collector/plugins-garbage-collector.php' => '"plugins-garbage-collector" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'post-type-switcher/post-type-switcher.php' => '"post-type-switcher" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'reset-wp/reset-wp.php' => '"reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'reset/data_reset.php' => '"reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'secure-file-manager/secure-file-manager.php' => '"secure-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'ultimate-reset/ultimate-reset.php' => '"ultimate-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'ultimate-wp-reset/ultimate-wordpress-reset.php' => '"ultimate-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'username-changer/username-changer.php' => '"username-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'username-updater/username-updater.php' => '"username-updater" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'username-changer/class-username-changer.php' => '"username-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'vamtam-offline-jetpack/vamtam-offline-jetpack.php' => '"vamtam-offline-jetpack" has been deactivated, an active Jetpack Connection is required for your site to operate properly on WordPress.com.', 'wd-youtube/wd-youtube.php' => '"wd-youtube" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', 'wordpress-database-reset/wp-reset.php' => '"wordpress-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', @@ -61,11 +57,13 @@ class Jetpack_Plugin_Compatibility { // Backup. 'backup-wd/backup-wd.php' => '"backup-wd" has been deactivated, WordPress.com handles managing your site backups for you.', - 'backupwordpress/backupwordpress.php' => '"backupwordpress" has been deactivated, WordPress.com handles managing your site backups for you.', 'backwpup/backwpup.php' => '"backwpup" has been deactivated, WordPress.com handles managing your site backups for you.', 'backwpup-pro/backwpup.php' => '"backwpup-pro" has been deactivated, WordPress.com handles managing your site backups for you.', + 'duplicator/duplicator.php' => '"duplicator" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'duplicator-pro/duplicator-pro.php' => '"duplicator-pro" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'jetpack-backup/jetpack-backup.php' => '"jetpack-backup" has been deactivated, WordPress.com handles managing your site backups for you.', - 'wp-db-backup/wp-db-backup.php' => '"wp-db-backup" has been deactivated, WordPress.com handles managing your site backups for you.', + 'siteground-migrator/siteground-migrator.php' => '"siteground-migrator" has been deactivated, WordPress.com handles managing your site backups for you.', + 'wp-backitup/wp-backitup.php' => '"wp-backitup" has been deactivated, WordPress.com handles managing your site backups for you.', // Caching/performance. 'breeze/breeze.php' => '"breeze" has been deactivated, WordPress.com automatically handles caching for your site.', @@ -82,14 +80,14 @@ class Jetpack_Plugin_Compatibility { 'w3-total-cache/w3-total-cache.php' => '"w3-total-cache" has been deactivated, WordPress.com automatically handles caching for your site.', 'wp-cache/wp-cache.php' => '"wp-cache" has been deactivated, WordPress.com automatically handles caching for your site.', 'wp-fastest-cache/wpFastestCache.php' => '"wp-fastest-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-optimizer/wp-optizer.php' => '"wp-optimizer" has been deactivated, "performance" related plugins may break your site or cause issues and are not supported on WordPress.com.', // p9F6qB-66o-p2 + 'wp-optimizer/wp-optimizer.php' => '"wp-optimizer" has been deactivated, "performance" related plugins may break your site or cause issues and are not supported on WordPress.com.', // p9F6qB-66o-p2 + 'wp-scss/wp-scss.php' => '"wp-scss" has been deactivated, WordPress.com automatically handles caching for your site.', 'wp-speed-of-light/wp-speed-of-light.php' => '"wp-speed-of-light" has been deactivated, WordPress.com automatically handles caching for your site.', 'wp-super-cache/wp-cache.php' => '"wp-super-cache" has been deactivated, WordPress.com automatically handles caching for your site.', // SQL heavy. 'another-wordpress-classifieds-plugin/awpcp.php' => '"another-wordpress-classifieds-plugin" has been deactivated, it is known to cause severe database performance issues and is not supported.', 'broken-link-checker/broken-link-checker.php' => '"broken-link-checker" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'leads/leads.php' => '"leads" has been deactivated, it is known to cause severe database performance issues and is not supported.', 'mass-pagesposts-creator/mass-pages-posts-creator.php' => '"mass-pagesposts-creator" has been deactivated, it is known to cause severe database performance issues and is not supported.', 'native-ads-adnow/adnow-widget.php' => '"native-ads-now" has been deactivated, it is known to cause severe database performance issues and is not supported.', 'ol_scrapes/ol_scrapes.php' => '"ol_scrapes" has been deactivated, it is known to cause severe database performance issues and is not supported.', @@ -113,21 +111,16 @@ class Jetpack_Plugin_Compatibility { // Security. 'antihacker/antihacker.php' => '"antihacker" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'deactivate-xml-rpc-service/deactivate-xml-rpc-service.php' => '"deactivate-xml-rpc-service" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', 'disable-xml-rpc-api/disable-xml-rpc-api.php' => '"disable-xml-rpc-api" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'disable-xml-rpc-fully/disable-xml-rpc-fully.php' => '"disable-xml-rpc-fully" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'disable-xml-rpc-unset-x-pingback/index.php' => '"disable-xml-rpc-unset-x-pingback" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'disable-xml-rpc/disable-xml-rpc.php' => '"disable-xml-rpc" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', 'manage-xml-rpc/manage-xml-rpc.php' => '"manage-xml-rpc" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', 'one-click-ssl/ssl.php' => '"one-click-ssl" has been deactivated, because it is not supported on WordPress.com.', + 'really-simple-ssl/rlrsssl-really-simple-ssl.php' => '"really-simple-ssl" is not supported on WordPress.com.', 'really-simple-ssl-pro/really-simple-ssl-pro.php' => '"really-simple-ssl-pro" is not supported on WordPress.com.', 'sg-security/sg-security.php' => '"sg-security" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'simple-xml-rpc-disabler/simple-xml-rpc-disabler.php' => '"simple-xml-rpc-disabler" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', 'stopbadbots/stopbadbots.php' => '"stopbadbots" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', 'wee-remove-xmlrpc-methods/wee-remove-xmlrpc-methods.php' => '"wee-remove-xmlrpc-methods" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', 'wordfence/wordfence.php' => '"wordfence" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', 'wp-hide-security-enhancer/wp-hide.php' => '"wp-hide-security-enhancer" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'wp-security-hardening/wp-hardening.php' => '"wp-security-hardening" has been deactivated. It breaks WordPress.com required plugins.', // p9F6qB-66o-p2 'wp-simple-firewall/wp-simple-firewall.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'wp-simple-firewall/icwp-wpsf.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', @@ -136,9 +129,6 @@ class Jetpack_Plugin_Compatibility { 'mailit/mailit.php' => '"mailit" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', 'send-email-from-admin/send-email-from-admin.php' => '"send-email-from-admin" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', - // Cloning/staging. - 'flo-launch/flo-launch.php' => 'Staging plugins delete data necessary to manage your site and are not supported on WordPress.com. flo-launch has been deactivated.', - // Misc. 'adult-mass-photos-downloader/adult-mass-photos-downloader.php' => '"adult-mass-photos-downloader" is not supported on WordPress.com.', 'adult-mass-videos-embedder/adult-mass-videos-embedder.php' => '"adult-mass-videos-embedder" is not supported on WordPress.com.', @@ -147,12 +137,7 @@ class Jetpack_Plugin_Compatibility { 'blogmatic-poster/index.php' => '"blogmatic-poster" is not supported on WordPress.com.', 'blogmatic/index.php' => '"blogmatic" is not supported on WordPress.com.', 'bwp-minify/bwp-minify.php' => '"bwp-minify" is not supported on WordPress.com.', - 'clearfy/clearfy.php' => '"clearfy" is not supported on WordPress.com.', - 'cornerstone/main.php' => '"cornerstone" is not supported on WordPress.com.', - 'cryptocurrency-pricing-list/cryptocurrency-pricing-list-and-ticker.php' => '"cryptocurrency-pricing-list" is not supported on WordPress.com.', 'db-access-adminer/db-access-adminer.php' => '"db-access-adminer" is not supported on WordPress.com.', - 'event-espresso-decaf/espresso.php' => '"event-espresso-decaf" is not supported on WordPress.com.', - 'facetwp-manipulator/facetwp-manipulator.php' => '"facetwp-manipulator" is not supported on WordPress.com.', 'fast-velocity-minify/fvm.php' => '"fast-velocity-minify" is not supported on WordPress.com.', 'nginx-helper/nginx-helper.php' => '"nginx-helper" is not supported on WordPress.com.', 'p3/p3.php' => '"p3" is not supported on WordPress.com.', @@ -160,21 +145,16 @@ class Jetpack_Plugin_Compatibility { 'plugin-detective/plugin-detective.php' => '"plugin-detective" is not supported on WordPress.com.', 'porn-embed/Porn-Embed.php' => '"porn-embed" is not supported on WordPress.com.', 'propellerads-official/propeller-ads.php' => '"propellerads-official" is not supported on WordPress.com.', - 'really-simple-ssl/rlrsssl-really-simple-ssl.php' => '"really-simple-ssl" is not supported on WordPress.com.', - 'speed-contact-bar/speed-contact-bar.php' => '"speed-contact-bar" is not supported on WordPress.com.', 'trafficzion/trafficzion.php' => '"trafficzion" is not supported on WordPress.com.', 'tubeace/tubeace.php' => '"tubeace" is not supported on WordPress.com.', - 'unplug-jetpack/unplug-jetpack.php' => '"unplug-jetpack" is not supported on WordPress.com.', - 'video-importer/video-importer.php' => '"video-importer" is not supported on WordPress.com.', 'woozone/plugin.php' => '"woozone" is not supported on WordPress.com.', 'wp-cleanfix/index.php' => '"wp-cleanfix" is not supported on WordPress.com.', 'wp-file-upload/wordpress_file_upload.php' => '"wp-file-upload" is not supported on WordPress.com.', 'wp-monero-miner-pro/monero-miner-pro.php' => '"wp-monero-miner-pro" is not supported on WordPress.com.', - 'wp-monero-miner-using-coin-hive/wp-coin-hive.php' => '"wp-monero-miner-using-coin-hive" is not supported on WordPress.com.', 'wp-optimize-by-xtraffic/wp-optimize-by-xtraffic.php' => '"wp-optimize-by-xtraffic" is not supported on WordPress.com.', 'wpematico/wpematico.php' => '"wpematico" is not supported on WordPress.com.', 'wpstagecoach/wpstagecoach.php' => '"wpstagecoach" is not supported on WordPress.com.', // p9F6qB-66o-p2 - 'yuzo-related-post/yuzo_related_post.php' => '"yuzo-related-post" is not supported on WordPress.com.', + 'yuzo-related-post/yuzo.php' => '"yuzo-related-post" is not supported on WordPress.com.', 'zapp-proxy-server/zapp-proxy-server.php' => '"zapp-proxy-server" is not supported on WordPress.com.', // CRM. From df94ea8e080c7d3f4e3f495ae0f938572ee71cfc Mon Sep 17 00:00:00 2001 From: upwardmomentum84 <93800099+upwardmomentum84@users.noreply.github.com> Date: Tue, 2 Dec 2025 11:16:57 -0500 Subject: [PATCH 02/49] Add changelog --- .../wpcomsh/changelog/update-incompatible-plugins-list | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/wpcomsh/changelog/update-incompatible-plugins-list diff --git a/projects/plugins/wpcomsh/changelog/update-incompatible-plugins-list b/projects/plugins/wpcomsh/changelog/update-incompatible-plugins-list new file mode 100644 index 000000000000..617722b0fac4 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/update-incompatible-plugins-list @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Updating incompatible plugins list per Audit Blocked Plugins project for Q4 2025 - https://linear.app/a8c/project/audit-blocked-plugins-0e4e3a73bb43/overview From c7d01e8c7831f43cea00a550eb062063e937fb8c Mon Sep 17 00:00:00 2001 From: upwardmomentum84 <93800099+upwardmomentum84@users.noreply.github.com> Date: Tue, 2 Dec 2025 12:08:15 -0500 Subject: [PATCH 03/49] Used ERROR: The specified bootstrap file "vendor/automattic/jetpack-phpcs-filter/stdin-bootstrap.php" does not exist Run "phpcbf --help" for usage information to try and resolve PHPCS linting test failure. --- .../class-jetpack-plugin-compatibility.php | 704 +++++++++--------- 1 file changed, 357 insertions(+), 347 deletions(-) diff --git a/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php b/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php index fc58879551a2..b52c4bee0232 100644 --- a/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php +++ b/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php @@ -8,351 +8,361 @@ /** * Class Jetpack_Plugin_Compatibility. */ -class Jetpack_Plugin_Compatibility { - /** - * Plugin file locations and html messaging in the format: - * array( - * 'example-plugin/example-plugin.php' => 'example-plugin interferes with Jetpack sync and has been disabled.' - * ), - * The html messaging is presented as a dismissible error admin notice when an unsupported plugin is deactivated. - * - * @var string[] - */ - public $incompatible_plugins = array( - // "reset" - break/interfere with provided functionality. - 'advanced-database-cleaner/advanced-db-cleaner.php' => '"advanced-database-cleaner" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'advanced-reset-wp/advanced-reset-wp.php' => '"advanced-reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'advanced-wp-reset/advanced-wp-reset.php' => '"advanced-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'backup/backup.php' => '"backup" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'better-wp-security/better-wp-security.php' => '"better-wp-security" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'database-browser/database-browser.php' => '"database-browser" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'extended-wp-reset/extended-wp-reset.php' => '"extended-wp-reset" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', - 'file-manager-advanced/file_manager_advanced.php' => '"file-manager-advanced" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'file-manager/file-manager.php' => '"file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'hide-my-wp/index.php' => '"hide-my-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'plugins-garbage-collector/plugins-garbage-collector.php' => '"plugins-garbage-collector" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'reset-wp/reset-wp.php' => '"reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'reset/data_reset.php' => '"reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'secure-file-manager/secure-file-manager.php' => '"secure-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'ultimate-reset/ultimate-reset.php' => '"ultimate-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'ultimate-wp-reset/ultimate-wordpress-reset.php' => '"ultimate-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'username-changer/class-username-changer.php' => '"username-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'vamtam-offline-jetpack/vamtam-offline-jetpack.php' => '"vamtam-offline-jetpack" has been deactivated, an active Jetpack Connection is required for your site to operate properly on WordPress.com.', - 'wd-youtube/wd-youtube.php' => '"wd-youtube" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', - 'wordpress-database-reset/wp-reset.php' => '"wordpress-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wordpress-reset/wordpress-reset.php' => '"wordpress-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-automatic/wp-automatic.php' => '"wp-automatic" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', - 'wp-clone-by-wp-academy/wpclone.php' => '"wp-clone-by-wp-academy" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-config-file-editor/wp-config-file-editor.php' => '"wp-config-file-editor" has been deactivated, it messes up data necessary to manage your site and is not supported on WordPress.com.', - 'wp-dbmanager/wp-dbmanager.php' => '"wp-dbmanager" has been deactivated, it messes up data necessary to manage your site and is not supported on WordPress.com.', - 'wp-file-manager/file_folder_manager.php' => '"wp-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-phpmyadmin-extension/index.php' => '"wp-phpmyadmin-extension" has been deactivated, it interferes with site operation. You can access phpMyAdmin under Settings > Hosting Config', - 'wp-prefix-changer/index.php' => '"wp-prefix-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-reset/wp-reset.php' => '"wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-uninstaller-by-azed/wp-uninstaller-by-azed.php' => '"wp-uninstaller-by-azed" is not supported on WordPress.com.', - 'wpmu-database-reset/wpmu-database-reset.php' => '"wpmu-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wps-hide-login/wps-hide-login.php' => '"wps-hide-login" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'z-inventory-manager/z-inventory-manager.php' => '"z-inventory-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-downgrade/wp-downgrade.php' => '"wp-downgrade" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - - // Backup. - 'backup-wd/backup-wd.php' => '"backup-wd" has been deactivated, WordPress.com handles managing your site backups for you.', - 'backwpup/backwpup.php' => '"backwpup" has been deactivated, WordPress.com handles managing your site backups for you.', - 'backwpup-pro/backwpup.php' => '"backwpup-pro" has been deactivated, WordPress.com handles managing your site backups for you.', - 'duplicator/duplicator.php' => '"duplicator" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'duplicator-pro/duplicator-pro.php' => '"duplicator-pro" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'jetpack-backup/jetpack-backup.php' => '"jetpack-backup" has been deactivated, WordPress.com handles managing your site backups for you.', - 'siteground-migrator/siteground-migrator.php' => '"siteground-migrator" has been deactivated, WordPress.com handles managing your site backups for you.', - 'wp-backitup/wp-backitup.php' => '"wp-backitup" has been deactivated, WordPress.com handles managing your site backups for you.', - - // Caching/performance. - 'breeze/breeze.php' => '"breeze" has been deactivated, WordPress.com automatically handles caching for your site.', - 'cache-enabler/cache-enabler.php' => '"cache-enabler" has been deactivated, WordPress.com automatically handles caching for your site.', - 'comet-cache/comet-cache.php' => '"comet-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'hyper-cache/plugin.php' => '"hyper-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'jch-optimize/jch-optimize.php' => '"jch-optimize" has been deactivated, WordPress.com automatically handles caching for your site.', - 'object-cache-pro/object-cache-pro.php' => '"object-cache-pro" has been deactivated, WordPress.com automatically handles caching for your site.', - 'performance-lab/load.php' => '"performance-lab" has been deactivated, WordPress.com automatically handles caching and database optimization for your site.', - 'powered-cache/powered-cache.php' => '"powered-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'quick-cache/quick-cache.php' => '"quick-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'redis-cache/redis-cache.php' => '"redis-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'sg-cachepress/sg-cachepress.php' => '"sg-cachepress" has been deactivated, WordPress.com automatically handles caching for your site.', - 'w3-total-cache/w3-total-cache.php' => '"w3-total-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-cache/wp-cache.php' => '"wp-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-fastest-cache/wpFastestCache.php' => '"wp-fastest-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-optimizer/wp-optimizer.php' => '"wp-optimizer" has been deactivated, "performance" related plugins may break your site or cause issues and are not supported on WordPress.com.', // p9F6qB-66o-p2 - 'wp-scss/wp-scss.php' => '"wp-scss" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-speed-of-light/wp-speed-of-light.php' => '"wp-speed-of-light" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-super-cache/wp-cache.php' => '"wp-super-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - - // SQL heavy. - 'another-wordpress-classifieds-plugin/awpcp.php' => '"another-wordpress-classifieds-plugin" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'broken-link-checker/broken-link-checker.php' => '"broken-link-checker" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'mass-pagesposts-creator/mass-pages-posts-creator.php' => '"mass-pagesposts-creator" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'native-ads-adnow/adnow-widget.php' => '"native-ads-now" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'ol_scrapes/ol_scrapes.php' => '"ol_scrapes" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'page-visit-counter/page-visit-counter.php' => '"page-visit-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'post-views-counter/post-views-counter.php' => '"post-views-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'tokenad/token-ad.php' => '"tokenad" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'top-10/top-10.php' => '"top-10" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'userpro/index.php' => '"userpro" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wordpress-popular-posts/wordpress-popular-posts.php' => '"wordpress-popular-posts" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-cerber/wp-cerber.php' => '"wp-cerber" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-inject/wpinject.php' => '"wp-inject" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-postviews/wp-postviews.php' => '"wp-postviews" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'wp-rss-aggregator/wp-rss-aggregator.php' => '"wp-rss-aggregator" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-rss-feed-to-post/wp-rss-feed-to-post.php' => '"wp-rss-feed-to-post" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-rss-wordai/wp-rss-wordai.php' => '"wp-rss-wordai" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-session-manager/wp-session-manager.php' => '"wp-session-manager" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-slimstat/wp-slimstat.php' => '"wp-slimstat" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'wp-statistics/wp-statistics.php' => '"wp-statistics" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'wp-ulike/wp-ulike.php' => '"wp-ulike" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'WPRobot5/wprobot.php' => '"WPRobot5" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - - // Security. - 'antihacker/antihacker.php' => '"antihacker" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'disable-xml-rpc-api/disable-xml-rpc-api.php' => '"disable-xml-rpc-api" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'manage-xml-rpc/manage-xml-rpc.php' => '"manage-xml-rpc" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'one-click-ssl/ssl.php' => '"one-click-ssl" has been deactivated, because it is not supported on WordPress.com.', - 'really-simple-ssl/rlrsssl-really-simple-ssl.php' => '"really-simple-ssl" is not supported on WordPress.com.', - 'really-simple-ssl-pro/really-simple-ssl-pro.php' => '"really-simple-ssl-pro" is not supported on WordPress.com.', - 'sg-security/sg-security.php' => '"sg-security" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'stopbadbots/stopbadbots.php' => '"stopbadbots" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'wee-remove-xmlrpc-methods/wee-remove-xmlrpc-methods.php' => '"wee-remove-xmlrpc-methods" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'wordfence/wordfence.php' => '"wordfence" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'wp-hide-security-enhancer/wp-hide.php' => '"wp-hide-security-enhancer" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'wp-simple-firewall/wp-simple-firewall.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-simple-firewall/icwp-wpsf.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - - // Spam. - 'e-mail-broadcasting/e-mail-broadcasting.php' => '"e-mail-broadcasting" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', - 'mailit/mailit.php' => '"mailit" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', - 'send-email-from-admin/send-email-from-admin.php' => '"send-email-from-admin" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', - - // Misc. - 'adult-mass-photos-downloader/adult-mass-photos-downloader.php' => '"adult-mass-photos-downloader" is not supported on WordPress.com.', - 'adult-mass-videos-embedder/adult-mass-videos-embedder.php' => '"adult-mass-videos-embedder" is not supported on WordPress.com.', - 'ari-adminer/ari-adminer.php' => '"ari-adminer" is not supported on WordPress.com.', - 'automatic-video-posts' => '"automatic-video-posts" is not supported on WordPress.com.', - 'blogmatic-poster/index.php' => '"blogmatic-poster" is not supported on WordPress.com.', - 'blogmatic/index.php' => '"blogmatic" is not supported on WordPress.com.', - 'bwp-minify/bwp-minify.php' => '"bwp-minify" is not supported on WordPress.com.', - 'db-access-adminer/db-access-adminer.php' => '"db-access-adminer" is not supported on WordPress.com.', - 'fast-velocity-minify/fvm.php' => '"fast-velocity-minify" is not supported on WordPress.com.', - 'nginx-helper/nginx-helper.php' => '"nginx-helper" is not supported on WordPress.com.', - 'p3/p3.php' => '"p3" is not supported on WordPress.com.', - 'pexlechris-adminer/pexlechris-adminer.php' => '"pexlechris-adminer" is not supported on WordPress.com.', - 'plugin-detective/plugin-detective.php' => '"plugin-detective" is not supported on WordPress.com.', - 'porn-embed/Porn-Embed.php' => '"porn-embed" is not supported on WordPress.com.', - 'propellerads-official/propeller-ads.php' => '"propellerads-official" is not supported on WordPress.com.', - 'trafficzion/trafficzion.php' => '"trafficzion" is not supported on WordPress.com.', - 'tubeace/tubeace.php' => '"tubeace" is not supported on WordPress.com.', - 'woozone/plugin.php' => '"woozone" is not supported on WordPress.com.', - 'wp-cleanfix/index.php' => '"wp-cleanfix" is not supported on WordPress.com.', - 'wp-file-upload/wordpress_file_upload.php' => '"wp-file-upload" is not supported on WordPress.com.', - 'wp-monero-miner-pro/monero-miner-pro.php' => '"wp-monero-miner-pro" is not supported on WordPress.com.', - 'wp-optimize-by-xtraffic/wp-optimize-by-xtraffic.php' => '"wp-optimize-by-xtraffic" is not supported on WordPress.com.', - 'wpematico/wpematico.php' => '"wpematico" is not supported on WordPress.com.', - 'wpstagecoach/wpstagecoach.php' => '"wpstagecoach" is not supported on WordPress.com.', // p9F6qB-66o-p2 - 'yuzo-related-post/yuzo.php' => '"yuzo-related-post" is not supported on WordPress.com.', - 'zapp-proxy-server/zapp-proxy-server.php' => '"zapp-proxy-server" is not supported on WordPress.com.', - - // CRM. - 'civicrm/civicrm.php' => '"civicrm" is not supported on WordPress.com.', // p9F6qB-66o-p2 - ); - - /** - * Admin notices. - * - * @var array - */ - protected $admin_notices = array(); - - /** - * Jetpack_Plugin_Compatibility constructor. - */ - protected function __construct() { - // Disable plugin activation for unsupported plugins. - add_action( 'load-plugins.php', array( $this, 'check_plugin_compatibility' ) ); - // Replace "Activate" plugin link for plugins that should not be activated (plugins.php). - add_filter( 'plugin_action_links', array( $this, 'disable_plugin_activate_link' ), 10, 2 ); - add_filter( 'network_admin_plugin_action_links', array( $this, 'disable_plugin_activate_link' ), 10, 2 ); - // Replace "Install" plugin link for plugins that not should not be activated (plugin-install.php). - add_filter( 'plugin_install_action_links', array( $this, 'disable_plugin_install_link' ), 10, 2 ); - // Print any notices about plugin deactivation. - add_action( 'admin_notices', array( $this, 'incompatible_plugin_notices' ) ); - // Disable My Jetpack page. - add_filter( - 'jetpack_my_jetpack_should_initialize', - function () { - $has_override = has_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option' ); - remove_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option' ); - $should_init = get_option( 'wpcom_admin_interface' ) === 'wp-admin'; - if ( $has_override ) { - add_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option' ); - } - - if ( ! $should_init && class_exists( '\Automattic\Jetpack\My_Jetpack\Initializer' ) ) { - // My Jetpack REST API endpoints are used for more than just My Jetpack UI. - add_action( 'rest_api_init', array( '\Automattic\Jetpack\My_Jetpack\Initializer', 'register_rest_endpoints' ) ); // @phan-suppress-current-line PhanUndeclaredClassInCallable - } - return $should_init; - } - ); - } - - /** - * Public getter to return a singleton instance of Jetpack_Plugin_Compatibility. - */ - public static function get_instance(): Jetpack_Plugin_Compatibility { - static $instance = null; - - if ( null === $instance ) { - $instance = new static(); - } - - return $instance; - } - - /** - * Deactivates incompatible plugins. - */ - public function check_plugin_compatibility() { - foreach ( $this->incompatible_plugins as $plugin => $message ) { - if ( ! is_plugin_active( $plugin ) ) { - continue; - } - - deactivate_plugins( $plugin ); - - $this->admin_notices[] = '

' . esc_html( $message ) . '

'; - unset( $_GET['activate'] ); // phpcs:ignore WordPress.Security.NonceVerification - } - } - - /** - * Displays admin notices. - */ - public function incompatible_plugin_notices() { - foreach ( $this->admin_notices as $notice ) { - echo wp_kses_post( $notice ); - } - } - - /** - * Disables plugin activations links for incompatible plugins. - * - * @param array $actions Plugin actions. - * @param string $plugin_file Plugin file. - * - * @return array Filtered array of plugin actions. - */ - public function disable_plugin_activate_link( $actions, $plugin_file ) { - if ( ! empty( $this->incompatible_plugins[ $plugin_file ] ) ) { - $actions['activate'] = 'Disabled'; - unset( $actions['edit'] ); - } - return $actions; - } - - /** - * Disables plugin install links for incompatible plugins. - * - * @param array $action_links Plugin actions. - * @param array $plugin Plugin information. - * - * @return string[] - */ - public function disable_plugin_install_link( $action_links, $plugin ) { - $needle = "{$plugin['slug']}/"; - foreach ( $this->incompatible_plugins as $disallowed_plugin => $message ) { - /* - * The naming convention of $disallowed_plugin is /.php so we are checking if - * the string $needle is included into $disallowed_plugin from the `0` position. - */ - if ( strpos( $disallowed_plugin, $needle ) === 0 ) { - $action_links = array( 'Not Supported' ); - break; - } - } - - return $action_links; - } - - /** - * Find the incompatible plugins on the site. - * - * @return array - */ - public function find_incompatible_plugins(): array { - // We don't apply the standard Core 'all_plugins' filter, so we are truly looking at all standard plugins. - $standard_plugins = get_plugins(); - - $disallowed_plugins = $this->get_disallowed_plugins(); - - $incompatible_plugins_on_site = array(); - - foreach ( $standard_plugins as $plugin_file => $plugin_details ) { - if ( ! array_key_exists( $plugin_file, $disallowed_plugins ) ) { - continue; - } - - $incompatible_plugins_on_site[ $plugin_file ] = array( - 'message' => $disallowed_plugins[ $plugin_file ], - 'details' => $plugin_details, - 'status' => $this->get_plugin_status( $plugin_file ), - ); - } - - $mu_plugins = get_mu_plugins(); - - foreach ( $mu_plugins as $mu_plugin_file => $mu_plugin_details ) { - if ( ! array_key_exists( $mu_plugin_file, $disallowed_plugins ) ) { - continue; - } - - $incompatible_plugins_on_site[ $mu_plugin_file ] = array( - 'message' => $disallowed_plugins[ $mu_plugin_file ], - 'details' => $mu_plugin_details, - 'status' => 'must-use', - ); - } - - return $incompatible_plugins_on_site; - } - - /** - * Helper function to return disallowed plugins. - * When possible, this function will include platform-level plugins. - * - * @return string[] - */ - protected function get_disallowed_plugins(): array { - if ( ! class_exists( 'Atomic_Platform_Mu_Plugin' ) || ! method_exists( 'Atomic_Platform_Mu_Plugin', 'get_disallowed_plugins' ) ) { - return $this->incompatible_plugins; - } - - $platform_mu_plugin = new Atomic_Platform_Mu_Plugin(); - - // We prefer product-level messages to platform messages when there are conflicts. - return array_merge( $platform_mu_plugin->get_disallowed_plugins(), $this->incompatible_plugins ); - } - - /** - * Helper function to determine the status of a standard plugin. - * - * @param string $plugin_file The full plugin filename. - * @return 'active-network'|'active'|'inactive' - */ - protected function get_plugin_status( string $plugin_file ): string { - if ( is_plugin_active_for_network( $plugin_file ) ) { - return 'active-network'; - } - - if ( is_plugin_active( $plugin_file ) ) { - return 'active'; - } - - return 'inactive'; - } +class Jetpack_Plugin_Compatibility +{ + /** + * Plugin file locations and html messaging in the format: + * array( + * 'example-plugin/example-plugin.php' => 'example-plugin interferes with Jetpack sync and has been disabled.' + * ), + * The html messaging is presented as a dismissible error admin notice when an unsupported plugin is deactivated. + * + * @var string[] + */ + public $incompatible_plugins = array( + // "reset" - break/interfere with provided functionality. + 'advanced-database-cleaner/advanced-db-cleaner.php' => '"advanced-database-cleaner" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'advanced-reset-wp/advanced-reset-wp.php' => '"advanced-reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'advanced-wp-reset/advanced-wp-reset.php' => '"advanced-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'backup/backup.php' => '"backup" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'better-wp-security/better-wp-security.php' => '"better-wp-security" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'database-browser/database-browser.php' => '"database-browser" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'extended-wp-reset/extended-wp-reset.php' => '"extended-wp-reset" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', + 'file-manager-advanced/file_manager_advanced.php' => '"file-manager-advanced" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'file-manager/file-manager.php' => '"file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'hide-my-wp/index.php' => '"hide-my-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'plugins-garbage-collector/plugins-garbage-collector.php' => '"plugins-garbage-collector" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'reset-wp/reset-wp.php' => '"reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'reset/data_reset.php' => '"reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'secure-file-manager/secure-file-manager.php' => '"secure-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'ultimate-reset/ultimate-reset.php' => '"ultimate-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'ultimate-wp-reset/ultimate-wordpress-reset.php' => '"ultimate-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'username-changer/class-username-changer.php' => '"username-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'vamtam-offline-jetpack/vamtam-offline-jetpack.php' => '"vamtam-offline-jetpack" has been deactivated, an active Jetpack Connection is required for your site to operate properly on WordPress.com.', + 'wd-youtube/wd-youtube.php' => '"wd-youtube" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', + 'wordpress-database-reset/wp-reset.php' => '"wordpress-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wordpress-reset/wordpress-reset.php' => '"wordpress-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-automatic/wp-automatic.php' => '"wp-automatic" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', + 'wp-clone-by-wp-academy/wpclone.php' => '"wp-clone-by-wp-academy" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-config-file-editor/wp-config-file-editor.php' => '"wp-config-file-editor" has been deactivated, it messes up data necessary to manage your site and is not supported on WordPress.com.', + 'wp-dbmanager/wp-dbmanager.php' => '"wp-dbmanager" has been deactivated, it messes up data necessary to manage your site and is not supported on WordPress.com.', + 'wp-file-manager/file_folder_manager.php' => '"wp-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-phpmyadmin-extension/index.php' => '"wp-phpmyadmin-extension" has been deactivated, it interferes with site operation. You can access phpMyAdmin under Settings > Hosting Config', + 'wp-prefix-changer/index.php' => '"wp-prefix-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-reset/wp-reset.php' => '"wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-uninstaller-by-azed/wp-uninstaller-by-azed.php' => '"wp-uninstaller-by-azed" is not supported on WordPress.com.', + 'wpmu-database-reset/wpmu-database-reset.php' => '"wpmu-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wps-hide-login/wps-hide-login.php' => '"wps-hide-login" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'z-inventory-manager/z-inventory-manager.php' => '"z-inventory-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-downgrade/wp-downgrade.php' => '"wp-downgrade" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + + // Backup. + 'backup-wd/backup-wd.php' => '"backup-wd" has been deactivated, WordPress.com handles managing your site backups for you.', + 'backwpup/backwpup.php' => '"backwpup" has been deactivated, WordPress.com handles managing your site backups for you.', + 'backwpup-pro/backwpup.php' => '"backwpup-pro" has been deactivated, WordPress.com handles managing your site backups for you.', + 'duplicator/duplicator.php' => '"duplicator" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'duplicator-pro/duplicator-pro.php' => '"duplicator-pro" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'jetpack-backup/jetpack-backup.php' => '"jetpack-backup" has been deactivated, WordPress.com handles managing your site backups for you.', + 'siteground-migrator/siteground-migrator.php' => '"siteground-migrator" has been deactivated, WordPress.com handles managing your site backups for you.', + 'wp-backitup/wp-backitup.php' => '"wp-backitup" has been deactivated, WordPress.com handles managing your site backups for you.', + + // Caching/performance. + 'breeze/breeze.php' => '"breeze" has been deactivated, WordPress.com automatically handles caching for your site.', + 'cache-enabler/cache-enabler.php' => '"cache-enabler" has been deactivated, WordPress.com automatically handles caching for your site.', + 'comet-cache/comet-cache.php' => '"comet-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'hyper-cache/plugin.php' => '"hyper-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'jch-optimize/jch-optimize.php' => '"jch-optimize" has been deactivated, WordPress.com automatically handles caching for your site.', + 'object-cache-pro/object-cache-pro.php' => '"object-cache-pro" has been deactivated, WordPress.com automatically handles caching for your site.', + 'performance-lab/load.php' => '"performance-lab" has been deactivated, WordPress.com automatically handles caching and database optimization for your site.', + 'powered-cache/powered-cache.php' => '"powered-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'quick-cache/quick-cache.php' => '"quick-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'redis-cache/redis-cache.php' => '"redis-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'sg-cachepress/sg-cachepress.php' => '"sg-cachepress" has been deactivated, WordPress.com automatically handles caching for your site.', + 'w3-total-cache/w3-total-cache.php' => '"w3-total-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-cache/wp-cache.php' => '"wp-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-fastest-cache/wpFastestCache.php' => '"wp-fastest-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-optimizer/wp-optimizer.php' => '"wp-optimizer" has been deactivated, "performance" related plugins may break your site or cause issues and are not supported on WordPress.com.', // p9F6qB-66o-p2 + 'wp-scss/wp-scss.php' => '"wp-scss" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-speed-of-light/wp-speed-of-light.php' => '"wp-speed-of-light" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-super-cache/wp-cache.php' => '"wp-super-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + + // SQL heavy. + 'another-wordpress-classifieds-plugin/awpcp.php' => '"another-wordpress-classifieds-plugin" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'broken-link-checker/broken-link-checker.php' => '"broken-link-checker" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'mass-pagesposts-creator/mass-pages-posts-creator.php' => '"mass-pagesposts-creator" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'native-ads-adnow/adnow-widget.php' => '"native-ads-now" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'ol_scrapes/ol_scrapes.php' => '"ol_scrapes" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'page-visit-counter/page-visit-counter.php' => '"page-visit-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'post-views-counter/post-views-counter.php' => '"post-views-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'tokenad/token-ad.php' => '"tokenad" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'top-10/top-10.php' => '"top-10" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'userpro/index.php' => '"userpro" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wordpress-popular-posts/wordpress-popular-posts.php' => '"wordpress-popular-posts" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-cerber/wp-cerber.php' => '"wp-cerber" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-inject/wpinject.php' => '"wp-inject" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-postviews/wp-postviews.php' => '"wp-postviews" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'wp-rss-aggregator/wp-rss-aggregator.php' => '"wp-rss-aggregator" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-rss-feed-to-post/wp-rss-feed-to-post.php' => '"wp-rss-feed-to-post" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-rss-wordai/wp-rss-wordai.php' => '"wp-rss-wordai" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-session-manager/wp-session-manager.php' => '"wp-session-manager" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-slimstat/wp-slimstat.php' => '"wp-slimstat" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'wp-statistics/wp-statistics.php' => '"wp-statistics" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'wp-ulike/wp-ulike.php' => '"wp-ulike" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'WPRobot5/wprobot.php' => '"WPRobot5" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + + // Security. + 'antihacker/antihacker.php' => '"antihacker" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'disable-xml-rpc-api/disable-xml-rpc-api.php' => '"disable-xml-rpc-api" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', + 'manage-xml-rpc/manage-xml-rpc.php' => '"manage-xml-rpc" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', + 'one-click-ssl/ssl.php' => '"one-click-ssl" has been deactivated, because it is not supported on WordPress.com.', + 'really-simple-ssl/rlrsssl-really-simple-ssl.php' => '"really-simple-ssl" is not supported on WordPress.com.', + 'really-simple-ssl-pro/really-simple-ssl-pro.php' => '"really-simple-ssl-pro" is not supported on WordPress.com.', + 'sg-security/sg-security.php' => '"sg-security" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'stopbadbots/stopbadbots.php' => '"stopbadbots" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'wee-remove-xmlrpc-methods/wee-remove-xmlrpc-methods.php' => '"wee-remove-xmlrpc-methods" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', + 'wordfence/wordfence.php' => '"wordfence" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'wp-hide-security-enhancer/wp-hide.php' => '"wp-hide-security-enhancer" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'wp-simple-firewall/wp-simple-firewall.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-simple-firewall/icwp-wpsf.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + + // Spam. + 'e-mail-broadcasting/e-mail-broadcasting.php' => '"e-mail-broadcasting" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', + 'mailit/mailit.php' => '"mailit" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', + 'send-email-from-admin/send-email-from-admin.php' => '"send-email-from-admin" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', + + // Misc. + 'adult-mass-photos-downloader/adult-mass-photos-downloader.php' => '"adult-mass-photos-downloader" is not supported on WordPress.com.', + 'adult-mass-videos-embedder/adult-mass-videos-embedder.php' => '"adult-mass-videos-embedder" is not supported on WordPress.com.', + 'ari-adminer/ari-adminer.php' => '"ari-adminer" is not supported on WordPress.com.', + 'automatic-video-posts' => '"automatic-video-posts" is not supported on WordPress.com.', + 'blogmatic-poster/index.php' => '"blogmatic-poster" is not supported on WordPress.com.', + 'blogmatic/index.php' => '"blogmatic" is not supported on WordPress.com.', + 'bwp-minify/bwp-minify.php' => '"bwp-minify" is not supported on WordPress.com.', + 'db-access-adminer/db-access-adminer.php' => '"db-access-adminer" is not supported on WordPress.com.', + 'fast-velocity-minify/fvm.php' => '"fast-velocity-minify" is not supported on WordPress.com.', + 'nginx-helper/nginx-helper.php' => '"nginx-helper" is not supported on WordPress.com.', + 'p3/p3.php' => '"p3" is not supported on WordPress.com.', + 'pexlechris-adminer/pexlechris-adminer.php' => '"pexlechris-adminer" is not supported on WordPress.com.', + 'plugin-detective/plugin-detective.php' => '"plugin-detective" is not supported on WordPress.com.', + 'porn-embed/Porn-Embed.php' => '"porn-embed" is not supported on WordPress.com.', + 'propellerads-official/propeller-ads.php' => '"propellerads-official" is not supported on WordPress.com.', + 'trafficzion/trafficzion.php' => '"trafficzion" is not supported on WordPress.com.', + 'tubeace/tubeace.php' => '"tubeace" is not supported on WordPress.com.', + 'woozone/plugin.php' => '"woozone" is not supported on WordPress.com.', + 'wp-cleanfix/index.php' => '"wp-cleanfix" is not supported on WordPress.com.', + 'wp-file-upload/wordpress_file_upload.php' => '"wp-file-upload" is not supported on WordPress.com.', + 'wp-monero-miner-pro/monero-miner-pro.php' => '"wp-monero-miner-pro" is not supported on WordPress.com.', + 'wp-optimize-by-xtraffic/wp-optimize-by-xtraffic.php' => '"wp-optimize-by-xtraffic" is not supported on WordPress.com.', + 'wpematico/wpematico.php' => '"wpematico" is not supported on WordPress.com.', + 'wpstagecoach/wpstagecoach.php' => '"wpstagecoach" is not supported on WordPress.com.', // p9F6qB-66o-p2 + 'yuzo-related-post/yuzo.php' => '"yuzo-related-post" is not supported on WordPress.com.', + 'zapp-proxy-server/zapp-proxy-server.php' => '"zapp-proxy-server" is not supported on WordPress.com.', + + // CRM. + 'civicrm/civicrm.php' => '"civicrm" is not supported on WordPress.com.', // p9F6qB-66o-p2 + ); + + /** + * Admin notices. + * + * @var array + */ + protected $admin_notices = array(); + + /** + * Jetpack_Plugin_Compatibility constructor. + */ + protected function __construct() + { + // Disable plugin activation for unsupported plugins. + add_action('load-plugins.php', array( $this, 'check_plugin_compatibility' )); + // Replace "Activate" plugin link for plugins that should not be activated (plugins.php). + add_filter('plugin_action_links', array( $this, 'disable_plugin_activate_link' ), 10, 2); + add_filter('network_admin_plugin_action_links', array( $this, 'disable_plugin_activate_link' ), 10, 2); + // Replace "Install" plugin link for plugins that not should not be activated (plugin-install.php). + add_filter('plugin_install_action_links', array( $this, 'disable_plugin_install_link' ), 10, 2); + // Print any notices about plugin deactivation. + add_action('admin_notices', array( $this, 'incompatible_plugin_notices' )); + // Disable My Jetpack page. + add_filter( + 'jetpack_my_jetpack_should_initialize', + function () { + $has_override = has_filter('pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option'); + remove_filter('pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option'); + $should_init = get_option('wpcom_admin_interface') === 'wp-admin'; + if ($has_override ) { + add_filter('pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option'); + } + + if (! $should_init && class_exists('\Automattic\Jetpack\My_Jetpack\Initializer') ) { + // My Jetpack REST API endpoints are used for more than just My Jetpack UI. + add_action('rest_api_init', array( '\Automattic\Jetpack\My_Jetpack\Initializer', 'register_rest_endpoints' )); // @phan-suppress-current-line PhanUndeclaredClassInCallable + } + return $should_init; + } + ); + } + + /** + * Public getter to return a singleton instance of Jetpack_Plugin_Compatibility. + */ + public static function get_instance(): Jetpack_Plugin_Compatibility + { + static $instance = null; + + if (null === $instance ) { + $instance = new static(); + } + + return $instance; + } + + /** + * Deactivates incompatible plugins. + */ + public function check_plugin_compatibility() + { + foreach ( $this->incompatible_plugins as $plugin => $message ) { + if (! is_plugin_active($plugin) ) { + continue; + } + + deactivate_plugins($plugin); + + $this->admin_notices[] = '

' . esc_html($message) . '

'; + unset($_GET['activate']); // phpcs:ignore WordPress.Security.NonceVerification + } + } + + /** + * Displays admin notices. + */ + public function incompatible_plugin_notices() + { + foreach ( $this->admin_notices as $notice ) { + echo wp_kses_post($notice); + } + } + + /** + * Disables plugin activations links for incompatible plugins. + * + * @param array $actions Plugin actions. + * @param string $plugin_file Plugin file. + * + * @return array Filtered array of plugin actions. + */ + public function disable_plugin_activate_link( $actions, $plugin_file ) + { + if (! empty($this->incompatible_plugins[ $plugin_file ]) ) { + $actions['activate'] = 'Disabled'; + unset($actions['edit']); + } + return $actions; + } + + /** + * Disables plugin install links for incompatible plugins. + * + * @param array $action_links Plugin actions. + * @param array $plugin Plugin information. + * + * @return string[] + */ + public function disable_plugin_install_link( $action_links, $plugin ) + { + $needle = "{$plugin['slug']}/"; + foreach ( $this->incompatible_plugins as $disallowed_plugin => $message ) { + /* + * The naming convention of $disallowed_plugin is /.php so we are checking if + * the string $needle is included into $disallowed_plugin from the `0` position. + */ + if (strpos($disallowed_plugin, $needle) === 0 ) { + $action_links = array( 'Not Supported' ); + break; + } + } + + return $action_links; + } + + /** + * Find the incompatible plugins on the site. + * + * @return array + */ + public function find_incompatible_plugins(): array + { + // We don't apply the standard Core 'all_plugins' filter, so we are truly looking at all standard plugins. + $standard_plugins = get_plugins(); + + $disallowed_plugins = $this->get_disallowed_plugins(); + + $incompatible_plugins_on_site = array(); + + foreach ( $standard_plugins as $plugin_file => $plugin_details ) { + if (! array_key_exists($plugin_file, $disallowed_plugins) ) { + continue; + } + + $incompatible_plugins_on_site[ $plugin_file ] = array( + 'message' => $disallowed_plugins[ $plugin_file ], + 'details' => $plugin_details, + 'status' => $this->get_plugin_status($plugin_file), + ); + } + + $mu_plugins = get_mu_plugins(); + + foreach ( $mu_plugins as $mu_plugin_file => $mu_plugin_details ) { + if (! array_key_exists($mu_plugin_file, $disallowed_plugins) ) { + continue; + } + + $incompatible_plugins_on_site[ $mu_plugin_file ] = array( + 'message' => $disallowed_plugins[ $mu_plugin_file ], + 'details' => $mu_plugin_details, + 'status' => 'must-use', + ); + } + + return $incompatible_plugins_on_site; + } + + /** + * Helper function to return disallowed plugins. + * When possible, this function will include platform-level plugins. + * + * @return string[] + */ + protected function get_disallowed_plugins(): array + { + if (! class_exists('Atomic_Platform_Mu_Plugin') || ! method_exists('Atomic_Platform_Mu_Plugin', 'get_disallowed_plugins') ) { + return $this->incompatible_plugins; + } + + $platform_mu_plugin = new Atomic_Platform_Mu_Plugin(); + + // We prefer product-level messages to platform messages when there are conflicts. + return array_merge($platform_mu_plugin->get_disallowed_plugins(), $this->incompatible_plugins); + } + + /** + * Helper function to determine the status of a standard plugin. + * + * @param string $plugin_file The full plugin filename. + * @return 'active-network'|'active'|'inactive' + */ + protected function get_plugin_status( string $plugin_file ): string + { + if (is_plugin_active_for_network($plugin_file) ) { + return 'active-network'; + } + + if (is_plugin_active($plugin_file) ) { + return 'active'; + } + + return 'inactive'; + } } From 06ae385d762595898abe86d1c769d49226a50217 Mon Sep 17 00:00:00 2001 From: upwardmomentum84 <93800099+upwardmomentum84@users.noreply.github.com> Date: Tue, 2 Dec 2025 12:12:45 -0500 Subject: [PATCH 04/49] Revert "Used ERROR: The specified bootstrap file "vendor/automattic/jetpack-phpcs-filter/stdin-bootstrap.php" does not exist" This reverts commit c7d01e8c7831f43cea00a550eb062063e937fb8c. --- .../class-jetpack-plugin-compatibility.php | 704 +++++++++--------- 1 file changed, 347 insertions(+), 357 deletions(-) diff --git a/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php b/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php index b52c4bee0232..fc58879551a2 100644 --- a/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php +++ b/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php @@ -8,361 +8,351 @@ /** * Class Jetpack_Plugin_Compatibility. */ -class Jetpack_Plugin_Compatibility -{ - /** - * Plugin file locations and html messaging in the format: - * array( - * 'example-plugin/example-plugin.php' => 'example-plugin interferes with Jetpack sync and has been disabled.' - * ), - * The html messaging is presented as a dismissible error admin notice when an unsupported plugin is deactivated. - * - * @var string[] - */ - public $incompatible_plugins = array( - // "reset" - break/interfere with provided functionality. - 'advanced-database-cleaner/advanced-db-cleaner.php' => '"advanced-database-cleaner" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'advanced-reset-wp/advanced-reset-wp.php' => '"advanced-reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'advanced-wp-reset/advanced-wp-reset.php' => '"advanced-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'backup/backup.php' => '"backup" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'better-wp-security/better-wp-security.php' => '"better-wp-security" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'database-browser/database-browser.php' => '"database-browser" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'extended-wp-reset/extended-wp-reset.php' => '"extended-wp-reset" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', - 'file-manager-advanced/file_manager_advanced.php' => '"file-manager-advanced" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'file-manager/file-manager.php' => '"file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'hide-my-wp/index.php' => '"hide-my-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'plugins-garbage-collector/plugins-garbage-collector.php' => '"plugins-garbage-collector" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'reset-wp/reset-wp.php' => '"reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'reset/data_reset.php' => '"reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'secure-file-manager/secure-file-manager.php' => '"secure-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'ultimate-reset/ultimate-reset.php' => '"ultimate-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'ultimate-wp-reset/ultimate-wordpress-reset.php' => '"ultimate-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'username-changer/class-username-changer.php' => '"username-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'vamtam-offline-jetpack/vamtam-offline-jetpack.php' => '"vamtam-offline-jetpack" has been deactivated, an active Jetpack Connection is required for your site to operate properly on WordPress.com.', - 'wd-youtube/wd-youtube.php' => '"wd-youtube" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', - 'wordpress-database-reset/wp-reset.php' => '"wordpress-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wordpress-reset/wordpress-reset.php' => '"wordpress-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-automatic/wp-automatic.php' => '"wp-automatic" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', - 'wp-clone-by-wp-academy/wpclone.php' => '"wp-clone-by-wp-academy" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-config-file-editor/wp-config-file-editor.php' => '"wp-config-file-editor" has been deactivated, it messes up data necessary to manage your site and is not supported on WordPress.com.', - 'wp-dbmanager/wp-dbmanager.php' => '"wp-dbmanager" has been deactivated, it messes up data necessary to manage your site and is not supported on WordPress.com.', - 'wp-file-manager/file_folder_manager.php' => '"wp-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-phpmyadmin-extension/index.php' => '"wp-phpmyadmin-extension" has been deactivated, it interferes with site operation. You can access phpMyAdmin under Settings > Hosting Config', - 'wp-prefix-changer/index.php' => '"wp-prefix-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-reset/wp-reset.php' => '"wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-uninstaller-by-azed/wp-uninstaller-by-azed.php' => '"wp-uninstaller-by-azed" is not supported on WordPress.com.', - 'wpmu-database-reset/wpmu-database-reset.php' => '"wpmu-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wps-hide-login/wps-hide-login.php' => '"wps-hide-login" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'z-inventory-manager/z-inventory-manager.php' => '"z-inventory-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-downgrade/wp-downgrade.php' => '"wp-downgrade" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - - // Backup. - 'backup-wd/backup-wd.php' => '"backup-wd" has been deactivated, WordPress.com handles managing your site backups for you.', - 'backwpup/backwpup.php' => '"backwpup" has been deactivated, WordPress.com handles managing your site backups for you.', - 'backwpup-pro/backwpup.php' => '"backwpup-pro" has been deactivated, WordPress.com handles managing your site backups for you.', - 'duplicator/duplicator.php' => '"duplicator" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'duplicator-pro/duplicator-pro.php' => '"duplicator-pro" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'jetpack-backup/jetpack-backup.php' => '"jetpack-backup" has been deactivated, WordPress.com handles managing your site backups for you.', - 'siteground-migrator/siteground-migrator.php' => '"siteground-migrator" has been deactivated, WordPress.com handles managing your site backups for you.', - 'wp-backitup/wp-backitup.php' => '"wp-backitup" has been deactivated, WordPress.com handles managing your site backups for you.', - - // Caching/performance. - 'breeze/breeze.php' => '"breeze" has been deactivated, WordPress.com automatically handles caching for your site.', - 'cache-enabler/cache-enabler.php' => '"cache-enabler" has been deactivated, WordPress.com automatically handles caching for your site.', - 'comet-cache/comet-cache.php' => '"comet-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'hyper-cache/plugin.php' => '"hyper-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'jch-optimize/jch-optimize.php' => '"jch-optimize" has been deactivated, WordPress.com automatically handles caching for your site.', - 'object-cache-pro/object-cache-pro.php' => '"object-cache-pro" has been deactivated, WordPress.com automatically handles caching for your site.', - 'performance-lab/load.php' => '"performance-lab" has been deactivated, WordPress.com automatically handles caching and database optimization for your site.', - 'powered-cache/powered-cache.php' => '"powered-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'quick-cache/quick-cache.php' => '"quick-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'redis-cache/redis-cache.php' => '"redis-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'sg-cachepress/sg-cachepress.php' => '"sg-cachepress" has been deactivated, WordPress.com automatically handles caching for your site.', - 'w3-total-cache/w3-total-cache.php' => '"w3-total-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-cache/wp-cache.php' => '"wp-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-fastest-cache/wpFastestCache.php' => '"wp-fastest-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-optimizer/wp-optimizer.php' => '"wp-optimizer" has been deactivated, "performance" related plugins may break your site or cause issues and are not supported on WordPress.com.', // p9F6qB-66o-p2 - 'wp-scss/wp-scss.php' => '"wp-scss" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-speed-of-light/wp-speed-of-light.php' => '"wp-speed-of-light" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-super-cache/wp-cache.php' => '"wp-super-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - - // SQL heavy. - 'another-wordpress-classifieds-plugin/awpcp.php' => '"another-wordpress-classifieds-plugin" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'broken-link-checker/broken-link-checker.php' => '"broken-link-checker" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'mass-pagesposts-creator/mass-pages-posts-creator.php' => '"mass-pagesposts-creator" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'native-ads-adnow/adnow-widget.php' => '"native-ads-now" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'ol_scrapes/ol_scrapes.php' => '"ol_scrapes" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'page-visit-counter/page-visit-counter.php' => '"page-visit-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'post-views-counter/post-views-counter.php' => '"post-views-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'tokenad/token-ad.php' => '"tokenad" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'top-10/top-10.php' => '"top-10" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'userpro/index.php' => '"userpro" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wordpress-popular-posts/wordpress-popular-posts.php' => '"wordpress-popular-posts" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-cerber/wp-cerber.php' => '"wp-cerber" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-inject/wpinject.php' => '"wp-inject" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-postviews/wp-postviews.php' => '"wp-postviews" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'wp-rss-aggregator/wp-rss-aggregator.php' => '"wp-rss-aggregator" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-rss-feed-to-post/wp-rss-feed-to-post.php' => '"wp-rss-feed-to-post" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-rss-wordai/wp-rss-wordai.php' => '"wp-rss-wordai" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-session-manager/wp-session-manager.php' => '"wp-session-manager" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-slimstat/wp-slimstat.php' => '"wp-slimstat" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'wp-statistics/wp-statistics.php' => '"wp-statistics" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'wp-ulike/wp-ulike.php' => '"wp-ulike" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'WPRobot5/wprobot.php' => '"WPRobot5" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - - // Security. - 'antihacker/antihacker.php' => '"antihacker" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'disable-xml-rpc-api/disable-xml-rpc-api.php' => '"disable-xml-rpc-api" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'manage-xml-rpc/manage-xml-rpc.php' => '"manage-xml-rpc" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'one-click-ssl/ssl.php' => '"one-click-ssl" has been deactivated, because it is not supported on WordPress.com.', - 'really-simple-ssl/rlrsssl-really-simple-ssl.php' => '"really-simple-ssl" is not supported on WordPress.com.', - 'really-simple-ssl-pro/really-simple-ssl-pro.php' => '"really-simple-ssl-pro" is not supported on WordPress.com.', - 'sg-security/sg-security.php' => '"sg-security" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'stopbadbots/stopbadbots.php' => '"stopbadbots" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'wee-remove-xmlrpc-methods/wee-remove-xmlrpc-methods.php' => '"wee-remove-xmlrpc-methods" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'wordfence/wordfence.php' => '"wordfence" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'wp-hide-security-enhancer/wp-hide.php' => '"wp-hide-security-enhancer" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'wp-simple-firewall/wp-simple-firewall.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-simple-firewall/icwp-wpsf.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - - // Spam. - 'e-mail-broadcasting/e-mail-broadcasting.php' => '"e-mail-broadcasting" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', - 'mailit/mailit.php' => '"mailit" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', - 'send-email-from-admin/send-email-from-admin.php' => '"send-email-from-admin" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', - - // Misc. - 'adult-mass-photos-downloader/adult-mass-photos-downloader.php' => '"adult-mass-photos-downloader" is not supported on WordPress.com.', - 'adult-mass-videos-embedder/adult-mass-videos-embedder.php' => '"adult-mass-videos-embedder" is not supported on WordPress.com.', - 'ari-adminer/ari-adminer.php' => '"ari-adminer" is not supported on WordPress.com.', - 'automatic-video-posts' => '"automatic-video-posts" is not supported on WordPress.com.', - 'blogmatic-poster/index.php' => '"blogmatic-poster" is not supported on WordPress.com.', - 'blogmatic/index.php' => '"blogmatic" is not supported on WordPress.com.', - 'bwp-minify/bwp-minify.php' => '"bwp-minify" is not supported on WordPress.com.', - 'db-access-adminer/db-access-adminer.php' => '"db-access-adminer" is not supported on WordPress.com.', - 'fast-velocity-minify/fvm.php' => '"fast-velocity-minify" is not supported on WordPress.com.', - 'nginx-helper/nginx-helper.php' => '"nginx-helper" is not supported on WordPress.com.', - 'p3/p3.php' => '"p3" is not supported on WordPress.com.', - 'pexlechris-adminer/pexlechris-adminer.php' => '"pexlechris-adminer" is not supported on WordPress.com.', - 'plugin-detective/plugin-detective.php' => '"plugin-detective" is not supported on WordPress.com.', - 'porn-embed/Porn-Embed.php' => '"porn-embed" is not supported on WordPress.com.', - 'propellerads-official/propeller-ads.php' => '"propellerads-official" is not supported on WordPress.com.', - 'trafficzion/trafficzion.php' => '"trafficzion" is not supported on WordPress.com.', - 'tubeace/tubeace.php' => '"tubeace" is not supported on WordPress.com.', - 'woozone/plugin.php' => '"woozone" is not supported on WordPress.com.', - 'wp-cleanfix/index.php' => '"wp-cleanfix" is not supported on WordPress.com.', - 'wp-file-upload/wordpress_file_upload.php' => '"wp-file-upload" is not supported on WordPress.com.', - 'wp-monero-miner-pro/monero-miner-pro.php' => '"wp-monero-miner-pro" is not supported on WordPress.com.', - 'wp-optimize-by-xtraffic/wp-optimize-by-xtraffic.php' => '"wp-optimize-by-xtraffic" is not supported on WordPress.com.', - 'wpematico/wpematico.php' => '"wpematico" is not supported on WordPress.com.', - 'wpstagecoach/wpstagecoach.php' => '"wpstagecoach" is not supported on WordPress.com.', // p9F6qB-66o-p2 - 'yuzo-related-post/yuzo.php' => '"yuzo-related-post" is not supported on WordPress.com.', - 'zapp-proxy-server/zapp-proxy-server.php' => '"zapp-proxy-server" is not supported on WordPress.com.', - - // CRM. - 'civicrm/civicrm.php' => '"civicrm" is not supported on WordPress.com.', // p9F6qB-66o-p2 - ); - - /** - * Admin notices. - * - * @var array - */ - protected $admin_notices = array(); - - /** - * Jetpack_Plugin_Compatibility constructor. - */ - protected function __construct() - { - // Disable plugin activation for unsupported plugins. - add_action('load-plugins.php', array( $this, 'check_plugin_compatibility' )); - // Replace "Activate" plugin link for plugins that should not be activated (plugins.php). - add_filter('plugin_action_links', array( $this, 'disable_plugin_activate_link' ), 10, 2); - add_filter('network_admin_plugin_action_links', array( $this, 'disable_plugin_activate_link' ), 10, 2); - // Replace "Install" plugin link for plugins that not should not be activated (plugin-install.php). - add_filter('plugin_install_action_links', array( $this, 'disable_plugin_install_link' ), 10, 2); - // Print any notices about plugin deactivation. - add_action('admin_notices', array( $this, 'incompatible_plugin_notices' )); - // Disable My Jetpack page. - add_filter( - 'jetpack_my_jetpack_should_initialize', - function () { - $has_override = has_filter('pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option'); - remove_filter('pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option'); - $should_init = get_option('wpcom_admin_interface') === 'wp-admin'; - if ($has_override ) { - add_filter('pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option'); - } - - if (! $should_init && class_exists('\Automattic\Jetpack\My_Jetpack\Initializer') ) { - // My Jetpack REST API endpoints are used for more than just My Jetpack UI. - add_action('rest_api_init', array( '\Automattic\Jetpack\My_Jetpack\Initializer', 'register_rest_endpoints' )); // @phan-suppress-current-line PhanUndeclaredClassInCallable - } - return $should_init; - } - ); - } - - /** - * Public getter to return a singleton instance of Jetpack_Plugin_Compatibility. - */ - public static function get_instance(): Jetpack_Plugin_Compatibility - { - static $instance = null; - - if (null === $instance ) { - $instance = new static(); - } - - return $instance; - } - - /** - * Deactivates incompatible plugins. - */ - public function check_plugin_compatibility() - { - foreach ( $this->incompatible_plugins as $plugin => $message ) { - if (! is_plugin_active($plugin) ) { - continue; - } - - deactivate_plugins($plugin); - - $this->admin_notices[] = '

' . esc_html($message) . '

'; - unset($_GET['activate']); // phpcs:ignore WordPress.Security.NonceVerification - } - } - - /** - * Displays admin notices. - */ - public function incompatible_plugin_notices() - { - foreach ( $this->admin_notices as $notice ) { - echo wp_kses_post($notice); - } - } - - /** - * Disables plugin activations links for incompatible plugins. - * - * @param array $actions Plugin actions. - * @param string $plugin_file Plugin file. - * - * @return array Filtered array of plugin actions. - */ - public function disable_plugin_activate_link( $actions, $plugin_file ) - { - if (! empty($this->incompatible_plugins[ $plugin_file ]) ) { - $actions['activate'] = 'Disabled'; - unset($actions['edit']); - } - return $actions; - } - - /** - * Disables plugin install links for incompatible plugins. - * - * @param array $action_links Plugin actions. - * @param array $plugin Plugin information. - * - * @return string[] - */ - public function disable_plugin_install_link( $action_links, $plugin ) - { - $needle = "{$plugin['slug']}/"; - foreach ( $this->incompatible_plugins as $disallowed_plugin => $message ) { - /* - * The naming convention of $disallowed_plugin is /.php so we are checking if - * the string $needle is included into $disallowed_plugin from the `0` position. - */ - if (strpos($disallowed_plugin, $needle) === 0 ) { - $action_links = array( 'Not Supported' ); - break; - } - } - - return $action_links; - } - - /** - * Find the incompatible plugins on the site. - * - * @return array - */ - public function find_incompatible_plugins(): array - { - // We don't apply the standard Core 'all_plugins' filter, so we are truly looking at all standard plugins. - $standard_plugins = get_plugins(); - - $disallowed_plugins = $this->get_disallowed_plugins(); - - $incompatible_plugins_on_site = array(); - - foreach ( $standard_plugins as $plugin_file => $plugin_details ) { - if (! array_key_exists($plugin_file, $disallowed_plugins) ) { - continue; - } - - $incompatible_plugins_on_site[ $plugin_file ] = array( - 'message' => $disallowed_plugins[ $plugin_file ], - 'details' => $plugin_details, - 'status' => $this->get_plugin_status($plugin_file), - ); - } - - $mu_plugins = get_mu_plugins(); - - foreach ( $mu_plugins as $mu_plugin_file => $mu_plugin_details ) { - if (! array_key_exists($mu_plugin_file, $disallowed_plugins) ) { - continue; - } - - $incompatible_plugins_on_site[ $mu_plugin_file ] = array( - 'message' => $disallowed_plugins[ $mu_plugin_file ], - 'details' => $mu_plugin_details, - 'status' => 'must-use', - ); - } - - return $incompatible_plugins_on_site; - } - - /** - * Helper function to return disallowed plugins. - * When possible, this function will include platform-level plugins. - * - * @return string[] - */ - protected function get_disallowed_plugins(): array - { - if (! class_exists('Atomic_Platform_Mu_Plugin') || ! method_exists('Atomic_Platform_Mu_Plugin', 'get_disallowed_plugins') ) { - return $this->incompatible_plugins; - } - - $platform_mu_plugin = new Atomic_Platform_Mu_Plugin(); - - // We prefer product-level messages to platform messages when there are conflicts. - return array_merge($platform_mu_plugin->get_disallowed_plugins(), $this->incompatible_plugins); - } - - /** - * Helper function to determine the status of a standard plugin. - * - * @param string $plugin_file The full plugin filename. - * @return 'active-network'|'active'|'inactive' - */ - protected function get_plugin_status( string $plugin_file ): string - { - if (is_plugin_active_for_network($plugin_file) ) { - return 'active-network'; - } - - if (is_plugin_active($plugin_file) ) { - return 'active'; - } - - return 'inactive'; - } +class Jetpack_Plugin_Compatibility { + /** + * Plugin file locations and html messaging in the format: + * array( + * 'example-plugin/example-plugin.php' => 'example-plugin interferes with Jetpack sync and has been disabled.' + * ), + * The html messaging is presented as a dismissible error admin notice when an unsupported plugin is deactivated. + * + * @var string[] + */ + public $incompatible_plugins = array( + // "reset" - break/interfere with provided functionality. + 'advanced-database-cleaner/advanced-db-cleaner.php' => '"advanced-database-cleaner" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'advanced-reset-wp/advanced-reset-wp.php' => '"advanced-reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'advanced-wp-reset/advanced-wp-reset.php' => '"advanced-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'backup/backup.php' => '"backup" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'better-wp-security/better-wp-security.php' => '"better-wp-security" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'database-browser/database-browser.php' => '"database-browser" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'extended-wp-reset/extended-wp-reset.php' => '"extended-wp-reset" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', + 'file-manager-advanced/file_manager_advanced.php' => '"file-manager-advanced" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'file-manager/file-manager.php' => '"file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'hide-my-wp/index.php' => '"hide-my-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'plugins-garbage-collector/plugins-garbage-collector.php' => '"plugins-garbage-collector" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'reset-wp/reset-wp.php' => '"reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'reset/data_reset.php' => '"reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'secure-file-manager/secure-file-manager.php' => '"secure-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'ultimate-reset/ultimate-reset.php' => '"ultimate-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'ultimate-wp-reset/ultimate-wordpress-reset.php' => '"ultimate-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'username-changer/class-username-changer.php' => '"username-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'vamtam-offline-jetpack/vamtam-offline-jetpack.php' => '"vamtam-offline-jetpack" has been deactivated, an active Jetpack Connection is required for your site to operate properly on WordPress.com.', + 'wd-youtube/wd-youtube.php' => '"wd-youtube" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', + 'wordpress-database-reset/wp-reset.php' => '"wordpress-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wordpress-reset/wordpress-reset.php' => '"wordpress-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-automatic/wp-automatic.php' => '"wp-automatic" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', + 'wp-clone-by-wp-academy/wpclone.php' => '"wp-clone-by-wp-academy" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-config-file-editor/wp-config-file-editor.php' => '"wp-config-file-editor" has been deactivated, it messes up data necessary to manage your site and is not supported on WordPress.com.', + 'wp-dbmanager/wp-dbmanager.php' => '"wp-dbmanager" has been deactivated, it messes up data necessary to manage your site and is not supported on WordPress.com.', + 'wp-file-manager/file_folder_manager.php' => '"wp-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-phpmyadmin-extension/index.php' => '"wp-phpmyadmin-extension" has been deactivated, it interferes with site operation. You can access phpMyAdmin under Settings > Hosting Config', + 'wp-prefix-changer/index.php' => '"wp-prefix-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-reset/wp-reset.php' => '"wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-uninstaller-by-azed/wp-uninstaller-by-azed.php' => '"wp-uninstaller-by-azed" is not supported on WordPress.com.', + 'wpmu-database-reset/wpmu-database-reset.php' => '"wpmu-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wps-hide-login/wps-hide-login.php' => '"wps-hide-login" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'z-inventory-manager/z-inventory-manager.php' => '"z-inventory-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-downgrade/wp-downgrade.php' => '"wp-downgrade" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + + // Backup. + 'backup-wd/backup-wd.php' => '"backup-wd" has been deactivated, WordPress.com handles managing your site backups for you.', + 'backwpup/backwpup.php' => '"backwpup" has been deactivated, WordPress.com handles managing your site backups for you.', + 'backwpup-pro/backwpup.php' => '"backwpup-pro" has been deactivated, WordPress.com handles managing your site backups for you.', + 'duplicator/duplicator.php' => '"duplicator" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'duplicator-pro/duplicator-pro.php' => '"duplicator-pro" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'jetpack-backup/jetpack-backup.php' => '"jetpack-backup" has been deactivated, WordPress.com handles managing your site backups for you.', + 'siteground-migrator/siteground-migrator.php' => '"siteground-migrator" has been deactivated, WordPress.com handles managing your site backups for you.', + 'wp-backitup/wp-backitup.php' => '"wp-backitup" has been deactivated, WordPress.com handles managing your site backups for you.', + + // Caching/performance. + 'breeze/breeze.php' => '"breeze" has been deactivated, WordPress.com automatically handles caching for your site.', + 'cache-enabler/cache-enabler.php' => '"cache-enabler" has been deactivated, WordPress.com automatically handles caching for your site.', + 'comet-cache/comet-cache.php' => '"comet-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'hyper-cache/plugin.php' => '"hyper-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'jch-optimize/jch-optimize.php' => '"jch-optimize" has been deactivated, WordPress.com automatically handles caching for your site.', + 'object-cache-pro/object-cache-pro.php' => '"object-cache-pro" has been deactivated, WordPress.com automatically handles caching for your site.', + 'performance-lab/load.php' => '"performance-lab" has been deactivated, WordPress.com automatically handles caching and database optimization for your site.', + 'powered-cache/powered-cache.php' => '"powered-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'quick-cache/quick-cache.php' => '"quick-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'redis-cache/redis-cache.php' => '"redis-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'sg-cachepress/sg-cachepress.php' => '"sg-cachepress" has been deactivated, WordPress.com automatically handles caching for your site.', + 'w3-total-cache/w3-total-cache.php' => '"w3-total-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-cache/wp-cache.php' => '"wp-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-fastest-cache/wpFastestCache.php' => '"wp-fastest-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-optimizer/wp-optimizer.php' => '"wp-optimizer" has been deactivated, "performance" related plugins may break your site or cause issues and are not supported on WordPress.com.', // p9F6qB-66o-p2 + 'wp-scss/wp-scss.php' => '"wp-scss" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-speed-of-light/wp-speed-of-light.php' => '"wp-speed-of-light" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-super-cache/wp-cache.php' => '"wp-super-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + + // SQL heavy. + 'another-wordpress-classifieds-plugin/awpcp.php' => '"another-wordpress-classifieds-plugin" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'broken-link-checker/broken-link-checker.php' => '"broken-link-checker" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'mass-pagesposts-creator/mass-pages-posts-creator.php' => '"mass-pagesposts-creator" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'native-ads-adnow/adnow-widget.php' => '"native-ads-now" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'ol_scrapes/ol_scrapes.php' => '"ol_scrapes" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'page-visit-counter/page-visit-counter.php' => '"page-visit-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'post-views-counter/post-views-counter.php' => '"post-views-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'tokenad/token-ad.php' => '"tokenad" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'top-10/top-10.php' => '"top-10" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'userpro/index.php' => '"userpro" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wordpress-popular-posts/wordpress-popular-posts.php' => '"wordpress-popular-posts" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-cerber/wp-cerber.php' => '"wp-cerber" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-inject/wpinject.php' => '"wp-inject" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-postviews/wp-postviews.php' => '"wp-postviews" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'wp-rss-aggregator/wp-rss-aggregator.php' => '"wp-rss-aggregator" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-rss-feed-to-post/wp-rss-feed-to-post.php' => '"wp-rss-feed-to-post" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-rss-wordai/wp-rss-wordai.php' => '"wp-rss-wordai" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-session-manager/wp-session-manager.php' => '"wp-session-manager" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-slimstat/wp-slimstat.php' => '"wp-slimstat" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'wp-statistics/wp-statistics.php' => '"wp-statistics" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'wp-ulike/wp-ulike.php' => '"wp-ulike" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'WPRobot5/wprobot.php' => '"WPRobot5" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + + // Security. + 'antihacker/antihacker.php' => '"antihacker" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'disable-xml-rpc-api/disable-xml-rpc-api.php' => '"disable-xml-rpc-api" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', + 'manage-xml-rpc/manage-xml-rpc.php' => '"manage-xml-rpc" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', + 'one-click-ssl/ssl.php' => '"one-click-ssl" has been deactivated, because it is not supported on WordPress.com.', + 'really-simple-ssl/rlrsssl-really-simple-ssl.php' => '"really-simple-ssl" is not supported on WordPress.com.', + 'really-simple-ssl-pro/really-simple-ssl-pro.php' => '"really-simple-ssl-pro" is not supported on WordPress.com.', + 'sg-security/sg-security.php' => '"sg-security" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'stopbadbots/stopbadbots.php' => '"stopbadbots" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'wee-remove-xmlrpc-methods/wee-remove-xmlrpc-methods.php' => '"wee-remove-xmlrpc-methods" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', + 'wordfence/wordfence.php' => '"wordfence" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'wp-hide-security-enhancer/wp-hide.php' => '"wp-hide-security-enhancer" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'wp-simple-firewall/wp-simple-firewall.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-simple-firewall/icwp-wpsf.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + + // Spam. + 'e-mail-broadcasting/e-mail-broadcasting.php' => '"e-mail-broadcasting" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', + 'mailit/mailit.php' => '"mailit" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', + 'send-email-from-admin/send-email-from-admin.php' => '"send-email-from-admin" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', + + // Misc. + 'adult-mass-photos-downloader/adult-mass-photos-downloader.php' => '"adult-mass-photos-downloader" is not supported on WordPress.com.', + 'adult-mass-videos-embedder/adult-mass-videos-embedder.php' => '"adult-mass-videos-embedder" is not supported on WordPress.com.', + 'ari-adminer/ari-adminer.php' => '"ari-adminer" is not supported on WordPress.com.', + 'automatic-video-posts' => '"automatic-video-posts" is not supported on WordPress.com.', + 'blogmatic-poster/index.php' => '"blogmatic-poster" is not supported on WordPress.com.', + 'blogmatic/index.php' => '"blogmatic" is not supported on WordPress.com.', + 'bwp-minify/bwp-minify.php' => '"bwp-minify" is not supported on WordPress.com.', + 'db-access-adminer/db-access-adminer.php' => '"db-access-adminer" is not supported on WordPress.com.', + 'fast-velocity-minify/fvm.php' => '"fast-velocity-minify" is not supported on WordPress.com.', + 'nginx-helper/nginx-helper.php' => '"nginx-helper" is not supported on WordPress.com.', + 'p3/p3.php' => '"p3" is not supported on WordPress.com.', + 'pexlechris-adminer/pexlechris-adminer.php' => '"pexlechris-adminer" is not supported on WordPress.com.', + 'plugin-detective/plugin-detective.php' => '"plugin-detective" is not supported on WordPress.com.', + 'porn-embed/Porn-Embed.php' => '"porn-embed" is not supported on WordPress.com.', + 'propellerads-official/propeller-ads.php' => '"propellerads-official" is not supported on WordPress.com.', + 'trafficzion/trafficzion.php' => '"trafficzion" is not supported on WordPress.com.', + 'tubeace/tubeace.php' => '"tubeace" is not supported on WordPress.com.', + 'woozone/plugin.php' => '"woozone" is not supported on WordPress.com.', + 'wp-cleanfix/index.php' => '"wp-cleanfix" is not supported on WordPress.com.', + 'wp-file-upload/wordpress_file_upload.php' => '"wp-file-upload" is not supported on WordPress.com.', + 'wp-monero-miner-pro/monero-miner-pro.php' => '"wp-monero-miner-pro" is not supported on WordPress.com.', + 'wp-optimize-by-xtraffic/wp-optimize-by-xtraffic.php' => '"wp-optimize-by-xtraffic" is not supported on WordPress.com.', + 'wpematico/wpematico.php' => '"wpematico" is not supported on WordPress.com.', + 'wpstagecoach/wpstagecoach.php' => '"wpstagecoach" is not supported on WordPress.com.', // p9F6qB-66o-p2 + 'yuzo-related-post/yuzo.php' => '"yuzo-related-post" is not supported on WordPress.com.', + 'zapp-proxy-server/zapp-proxy-server.php' => '"zapp-proxy-server" is not supported on WordPress.com.', + + // CRM. + 'civicrm/civicrm.php' => '"civicrm" is not supported on WordPress.com.', // p9F6qB-66o-p2 + ); + + /** + * Admin notices. + * + * @var array + */ + protected $admin_notices = array(); + + /** + * Jetpack_Plugin_Compatibility constructor. + */ + protected function __construct() { + // Disable plugin activation for unsupported plugins. + add_action( 'load-plugins.php', array( $this, 'check_plugin_compatibility' ) ); + // Replace "Activate" plugin link for plugins that should not be activated (plugins.php). + add_filter( 'plugin_action_links', array( $this, 'disable_plugin_activate_link' ), 10, 2 ); + add_filter( 'network_admin_plugin_action_links', array( $this, 'disable_plugin_activate_link' ), 10, 2 ); + // Replace "Install" plugin link for plugins that not should not be activated (plugin-install.php). + add_filter( 'plugin_install_action_links', array( $this, 'disable_plugin_install_link' ), 10, 2 ); + // Print any notices about plugin deactivation. + add_action( 'admin_notices', array( $this, 'incompatible_plugin_notices' ) ); + // Disable My Jetpack page. + add_filter( + 'jetpack_my_jetpack_should_initialize', + function () { + $has_override = has_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option' ); + remove_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option' ); + $should_init = get_option( 'wpcom_admin_interface' ) === 'wp-admin'; + if ( $has_override ) { + add_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option' ); + } + + if ( ! $should_init && class_exists( '\Automattic\Jetpack\My_Jetpack\Initializer' ) ) { + // My Jetpack REST API endpoints are used for more than just My Jetpack UI. + add_action( 'rest_api_init', array( '\Automattic\Jetpack\My_Jetpack\Initializer', 'register_rest_endpoints' ) ); // @phan-suppress-current-line PhanUndeclaredClassInCallable + } + return $should_init; + } + ); + } + + /** + * Public getter to return a singleton instance of Jetpack_Plugin_Compatibility. + */ + public static function get_instance(): Jetpack_Plugin_Compatibility { + static $instance = null; + + if ( null === $instance ) { + $instance = new static(); + } + + return $instance; + } + + /** + * Deactivates incompatible plugins. + */ + public function check_plugin_compatibility() { + foreach ( $this->incompatible_plugins as $plugin => $message ) { + if ( ! is_plugin_active( $plugin ) ) { + continue; + } + + deactivate_plugins( $plugin ); + + $this->admin_notices[] = '

' . esc_html( $message ) . '

'; + unset( $_GET['activate'] ); // phpcs:ignore WordPress.Security.NonceVerification + } + } + + /** + * Displays admin notices. + */ + public function incompatible_plugin_notices() { + foreach ( $this->admin_notices as $notice ) { + echo wp_kses_post( $notice ); + } + } + + /** + * Disables plugin activations links for incompatible plugins. + * + * @param array $actions Plugin actions. + * @param string $plugin_file Plugin file. + * + * @return array Filtered array of plugin actions. + */ + public function disable_plugin_activate_link( $actions, $plugin_file ) { + if ( ! empty( $this->incompatible_plugins[ $plugin_file ] ) ) { + $actions['activate'] = 'Disabled'; + unset( $actions['edit'] ); + } + return $actions; + } + + /** + * Disables plugin install links for incompatible plugins. + * + * @param array $action_links Plugin actions. + * @param array $plugin Plugin information. + * + * @return string[] + */ + public function disable_plugin_install_link( $action_links, $plugin ) { + $needle = "{$plugin['slug']}/"; + foreach ( $this->incompatible_plugins as $disallowed_plugin => $message ) { + /* + * The naming convention of $disallowed_plugin is /.php so we are checking if + * the string $needle is included into $disallowed_plugin from the `0` position. + */ + if ( strpos( $disallowed_plugin, $needle ) === 0 ) { + $action_links = array( 'Not Supported' ); + break; + } + } + + return $action_links; + } + + /** + * Find the incompatible plugins on the site. + * + * @return array + */ + public function find_incompatible_plugins(): array { + // We don't apply the standard Core 'all_plugins' filter, so we are truly looking at all standard plugins. + $standard_plugins = get_plugins(); + + $disallowed_plugins = $this->get_disallowed_plugins(); + + $incompatible_plugins_on_site = array(); + + foreach ( $standard_plugins as $plugin_file => $plugin_details ) { + if ( ! array_key_exists( $plugin_file, $disallowed_plugins ) ) { + continue; + } + + $incompatible_plugins_on_site[ $plugin_file ] = array( + 'message' => $disallowed_plugins[ $plugin_file ], + 'details' => $plugin_details, + 'status' => $this->get_plugin_status( $plugin_file ), + ); + } + + $mu_plugins = get_mu_plugins(); + + foreach ( $mu_plugins as $mu_plugin_file => $mu_plugin_details ) { + if ( ! array_key_exists( $mu_plugin_file, $disallowed_plugins ) ) { + continue; + } + + $incompatible_plugins_on_site[ $mu_plugin_file ] = array( + 'message' => $disallowed_plugins[ $mu_plugin_file ], + 'details' => $mu_plugin_details, + 'status' => 'must-use', + ); + } + + return $incompatible_plugins_on_site; + } + + /** + * Helper function to return disallowed plugins. + * When possible, this function will include platform-level plugins. + * + * @return string[] + */ + protected function get_disallowed_plugins(): array { + if ( ! class_exists( 'Atomic_Platform_Mu_Plugin' ) || ! method_exists( 'Atomic_Platform_Mu_Plugin', 'get_disallowed_plugins' ) ) { + return $this->incompatible_plugins; + } + + $platform_mu_plugin = new Atomic_Platform_Mu_Plugin(); + + // We prefer product-level messages to platform messages when there are conflicts. + return array_merge( $platform_mu_plugin->get_disallowed_plugins(), $this->incompatible_plugins ); + } + + /** + * Helper function to determine the status of a standard plugin. + * + * @param string $plugin_file The full plugin filename. + * @return 'active-network'|'active'|'inactive' + */ + protected function get_plugin_status( string $plugin_file ): string { + if ( is_plugin_active_for_network( $plugin_file ) ) { + return 'active-network'; + } + + if ( is_plugin_active( $plugin_file ) ) { + return 'active'; + } + + return 'inactive'; + } } From e2a8989e986080d542f34e59cb023d8cbbb2855d Mon Sep 17 00:00:00 2001 From: Automattic Bot Date: Tue, 2 Dec 2025 18:38:15 +0100 Subject: [PATCH 05/49] Update Eslint packages (#46167) * Update Eslint packages * eslint-config-target-es: Enable new rules * Fix new lints related to JS deps vs dev deps vs peer deps --------- Co-authored-by: Renovate Bot Co-authored-by: Brad Jorsch --- package.json | 2 +- pnpm-lock.yaml | 650 ++++++++---------- .../changelog/renovate-eslint-packages | 5 + .../js-packages/eslint-changed/package.json | 1 + .../eslint-config-target-es/CHANGELOG.md | 2 +- .../changelog/renovate-eslint-packages#2 | 4 + .../changelog/renovate-eslint-packages#3 | 4 + .../eslint-config-target-es/package.json | 4 +- .../eslint-config-target-es/src/rulesMap.js | 10 + .../scan/changelog/renovate-eslint-packages | 4 + .../scan/changelog/renovate-eslint-packages#2 | 4 + projects/js-packages/scan/package.json | 7 +- .../changelog/renovate-eslint-packages | 4 + .../js-packages/social-logos/package.json | 6 +- .../changelog/renovate-eslint-packages | 5 + projects/packages/videopress/package.json | 2 - .../changelog/renovate-eslint-packages | 5 + projects/plugins/inspect/package.json | 3 - tools/js-tools/package.json | 24 +- 19 files changed, 337 insertions(+), 409 deletions(-) create mode 100644 projects/js-packages/eslint-changed/changelog/renovate-eslint-packages create mode 100644 projects/js-packages/eslint-config-target-es/changelog/renovate-eslint-packages#2 create mode 100644 projects/js-packages/eslint-config-target-es/changelog/renovate-eslint-packages#3 create mode 100644 projects/js-packages/scan/changelog/renovate-eslint-packages create mode 100644 projects/js-packages/scan/changelog/renovate-eslint-packages#2 create mode 100644 projects/js-packages/social-logos/changelog/renovate-eslint-packages create mode 100644 projects/packages/videopress/changelog/renovate-eslint-packages create mode 100644 projects/plugins/inspect/changelog/renovate-eslint-packages diff --git a/package.json b/package.json index b9412fe6327a..dd0644fc399c 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "version-packages": "bash ./tools/version-packages.sh" }, "devDependencies": { - "eslint": "9.38.0", + "eslint": "9.39.1", "husky": "9.1.7", "jetpack-cli": "workspace:*", "jetpack-js-tools": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9cf474328382..30c612b05d74 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -214,8 +214,8 @@ importers: .: devDependencies: eslint: - specifier: 9.38.0 - version: 9.38.0 + specifier: 9.39.1 + version: 9.39.1 husky: specifier: 9.1.7 version: 9.1.7 @@ -999,6 +999,9 @@ importers: specifier: 0.8.1 version: 0.8.1 devDependencies: + eslint: + specifier: '>=7.0.0' + version: 9.39.1 jest: specifier: 30.2.0 version: 30.2.0 @@ -1022,11 +1025,11 @@ importers: specifier: 6.36.0 version: 6.36.0 eslint: - specifier: 9.38.0 - version: 9.38.0 + specifier: 9.39.1 + version: 9.39.1 eslint-plugin-es-x: - specifier: 9.1.2 - version: 9.1.2(eslint@9.38.0) + specifier: 9.2.0 + version: 9.2.0(eslint@9.39.1) globals: specifier: 16.5.0 version: 16.5.0 @@ -1638,12 +1641,6 @@ importers: debug: specifier: 4.4.1 version: 4.4.1 - react: - specifier: ^18.2.0 - version: 18.3.1 - react-dom: - specifier: ^18.2.0 - version: 18.3.1(react@18.3.1) devDependencies: '@storybook/addon-docs': specifier: 10.0.8 @@ -1669,6 +1666,12 @@ importers: jest-environment-jsdom: specifier: 30.2.0 version: 30.2.0 + react: + specifier: ^18.2.0 + version: 18.3.1 + react-dom: + specifier: ^18.2.0 + version: 18.3.1(react@18.3.1) storybook: specifier: 10.0.8 version: 10.0.8(@testing-library/dom@10.4.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -1799,12 +1802,6 @@ importers: prop-types: specifier: ^15.8.1 version: 15.8.1 - react: - specifier: 18.3.1 - version: 18.3.1 - react-dom: - specifier: 18.3.1 - version: 18.3.1(react@18.3.1) devDependencies: '@types/react': specifier: 18.3.26 @@ -1815,6 +1812,12 @@ importers: glob: specifier: 11.1.0 version: 11.1.0 + react: + specifier: ^18.3.1 + version: 18.3.1 + react-dom: + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) svg2ttf: specifier: ^6.0.3 version: 6.0.3 @@ -3957,9 +3960,6 @@ importers: '@automattic/jetpack-api': specifier: workspace:* version: link:../../js-packages/api - '@automattic/jetpack-base-styles': - specifier: workspace:* - version: link:../../js-packages/base-styles '@automattic/jetpack-components': specifier: workspace:* version: link:../../js-packages/components @@ -3969,9 +3969,6 @@ importers: '@automattic/jetpack-script-data': specifier: workspace:* version: link:../../js-packages/script-data - '@automattic/jetpack-shared-extension-utils': - specifier: workspace:* - version: link:../../js-packages/shared-extension-utils '@wordpress/api-fetch': specifier: 7.36.0 version: 7.36.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) @@ -4057,6 +4054,12 @@ importers: '@automattic/calypso-color-schemes': specifier: 4.0.0 version: 4.0.0 + '@automattic/jetpack-base-styles': + specifier: workspace:* + version: link:../../js-packages/base-styles + '@automattic/jetpack-shared-extension-utils': + specifier: workspace:* + version: link:../../js-packages/shared-extension-utils '@automattic/jetpack-webpack-config': specifier: workspace:* version: link:../../js-packages/webpack-config @@ -4796,10 +4799,6 @@ importers: version: 6.0.1(webpack@5.101.3) projects/plugins/inspect: - dependencies: - tslib: - specifier: 2.8.1 - version: 2.8.1 devDependencies: '@babel/core': specifier: 7.28.4 @@ -4846,6 +4845,9 @@ importers: svelte-preprocess: specifier: 6.0.2 version: 6.0.2(@babel/core@7.28.4)(postcss@8.5.6)(sass-embedded@1.87.0)(svelte@4.2.19)(typescript@5.9.3) + tslib: + specifier: 2.8.1 + version: 2.8.1 typescript: specifier: 5.9.3 version: 5.9.3 @@ -5937,17 +5939,17 @@ importers: specifier: 7.27.1 version: 7.27.1(@babel/core@7.28.4) '@eslint/compat': - specifier: 1.4.0 - version: 1.4.0(eslint@9.38.0) + specifier: 1.4.1 + version: 1.4.1(eslint@9.39.1) '@eslint/eslintrc': - specifier: 3.3.1 - version: 3.3.1 + specifier: 3.3.3 + version: 3.3.3 '@eslint/js': - specifier: 9.38.0 - version: 9.38.0 + specifier: 9.39.1 + version: 9.39.1 '@eslint/json': - specifier: 0.13.2 - version: 0.13.2 + specifier: 0.14.0 + version: 0.14.0 '@octokit/auth-token': specifier: 5.1.2 version: 5.1.2 @@ -5956,13 +5958,13 @@ importers: version: 21.1.1 '@tanstack/eslint-plugin-query': specifier: 5.91.2 - version: 5.91.2(eslint@9.38.0)(typescript@5.9.3) + version: 5.91.2(eslint@9.39.1)(typescript@5.9.3) '@testing-library/jest-dom': specifier: 6.9.1 version: 6.9.1 '@wordpress/eslint-plugin': specifier: 22.22.0 - version: 22.22.0(@babel/core@7.28.4)(eslint-config-prettier@10.1.8(eslint@9.38.0))(eslint-plugin-import@2.32.0)(eslint-plugin-jest@29.0.1(eslint@9.38.0)(jest@30.2.0)(typescript@5.9.3))(eslint-plugin-jsdoc@51.4.1(eslint@9.38.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.38.0))(eslint-plugin-playwright@2.2.2(eslint@9.38.0))(eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.38.0))(eslint@9.38.0)(wp-prettier@3.0.3))(eslint-plugin-react-hooks@5.2.0(eslint@9.38.0))(eslint-plugin-react@7.37.5(eslint@9.38.0))(eslint@9.38.0)(typescript@5.9.3)(wp-prettier@3.0.3) + version: 22.22.0(@babel/core@7.28.4)(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint-plugin-import@2.32.0)(eslint-plugin-jest@29.2.1(eslint@9.39.1)(jest@30.2.0)(typescript@5.9.3))(eslint-plugin-jsdoc@51.4.1(eslint@9.39.1))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.39.1))(eslint-plugin-playwright@2.4.0(eslint@9.39.1))(eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint@9.39.1)(wp-prettier@3.0.3))(eslint-plugin-react-hooks@5.2.0(eslint@9.39.1))(eslint-plugin-react@7.37.5(eslint@9.39.1))(eslint@9.39.1)(typescript@5.9.3)(wp-prettier@3.0.3) '@wordpress/jest-console': specifier: 8.36.0 version: 8.36.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b)(jest@30.2.0) @@ -5982,62 +5984,62 @@ importers: specifier: 2.4.1 version: 2.4.1 eslint: - specifier: 9.38.0 - version: 9.38.0 + specifier: 9.39.1 + version: 9.39.1 eslint-config-prettier: specifier: 10.1.8 - version: 10.1.8(eslint@9.38.0) + version: 10.1.8(eslint@9.39.1) eslint-import-resolver-typescript: specifier: 4.4.4 - version: 4.4.4(eslint-plugin-import@2.32.0)(eslint@9.38.0) + version: 4.4.4(eslint-plugin-import@2.32.0)(eslint@9.39.1) eslint-json-compat-utils: specifier: 0.2.1 - version: 0.2.1(@eslint/json@0.13.2)(eslint@9.38.0)(jsonc-eslint-parser@2.4.1) + version: 0.2.1(@eslint/json@0.14.0)(eslint@9.39.1)(jsonc-eslint-parser@2.4.1) eslint-plugin-es-x: - specifier: 9.1.2 - version: 9.1.2(eslint@9.38.0) + specifier: 9.2.0 + version: 9.2.0(eslint@9.39.1) eslint-plugin-import: specifier: 2.32.0 - version: 2.32.0(eslint-import-resolver-typescript@4.4.4)(eslint@9.38.0) + version: 2.32.0(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1) eslint-plugin-jest: - specifier: 29.0.1 - version: 29.0.1(eslint@9.38.0)(jest@30.2.0)(typescript@5.9.3) + specifier: 29.2.1 + version: 29.2.1(eslint@9.39.1)(jest@30.2.0)(typescript@5.9.3) eslint-plugin-jest-dom: specifier: 5.5.0 - version: 5.5.0(eslint@9.38.0) + version: 5.5.0(eslint@9.39.1) eslint-plugin-jsdoc: specifier: 51.4.1 - version: 51.4.1(eslint@9.38.0) + version: 51.4.1(eslint@9.39.1) eslint-plugin-jsx-a11y: specifier: 6.10.2 - version: 6.10.2(eslint@9.38.0) + version: 6.10.2(eslint@9.39.1) eslint-plugin-lodash: specifier: 8.0.0 - version: 8.0.0(eslint@9.38.0) + version: 8.0.0(eslint@9.39.1) eslint-plugin-n: specifier: 17.23.1 - version: 17.23.1(eslint@9.38.0)(typescript@5.9.3) + version: 17.23.1(eslint@9.39.1)(typescript@5.9.3) eslint-plugin-package-json: - specifier: 0.59.0 - version: 0.59.0(eslint@9.38.0)(jsonc-eslint-parser@2.4.1) + specifier: 0.85.0 + version: 0.85.0(eslint@9.39.1)(jsonc-eslint-parser@2.4.1) eslint-plugin-playwright: - specifier: 2.2.2 - version: 2.2.2(eslint@9.38.0) + specifier: 2.4.0 + version: 2.4.0(eslint@9.39.1) eslint-plugin-prettier: specifier: 5.5.4 - version: 5.5.4(eslint-config-prettier@10.1.8(eslint@9.38.0))(eslint@9.38.0)(wp-prettier@3.0.3) + version: 5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint@9.39.1)(wp-prettier@3.0.3) eslint-plugin-react: specifier: 7.37.5 - version: 7.37.5(eslint@9.38.0) + version: 7.37.5(eslint@9.39.1) eslint-plugin-react-hooks: specifier: 5.2.0 - version: 5.2.0(eslint@9.38.0) + version: 5.2.0(eslint@9.39.1) eslint-plugin-svelte: - specifier: 3.12.5 - version: 3.12.5(eslint@9.38.0)(svelte@4.2.19) + specifier: 3.13.0 + version: 3.13.0(eslint@9.39.1)(svelte@4.2.19) eslint-plugin-testing-library: - specifier: 7.13.3 - version: 7.13.3(eslint@9.38.0)(typescript@5.9.3) + specifier: 7.13.5 + version: 7.13.5(eslint@9.39.1)(typescript@5.9.3) eslint-plugin-you-dont-need-lodash-underscore: specifier: 6.14.0 version: 6.14.0 @@ -6096,8 +6098,8 @@ importers: specifier: 5.9.3 version: 5.9.3 typescript-eslint: - specifier: 8.46.2 - version: 8.46.2(eslint@9.38.0)(typescript@5.9.3) + specifier: 8.48.0 + version: 8.48.0(eslint@9.39.1)(typescript@5.9.3) yaml: specifier: 2.2.2 version: 2.2.2 @@ -7376,8 +7378,8 @@ packages: resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - '@eslint/compat@1.4.0': - resolution: {integrity: sha512-DEzm5dKeDBPm3r08Ixli/0cmxr8LkRdwxMRUIJBlSCpAwSrvFEJpVBzV+66JhDxiaqKxnRzCXhtiMiczF7Hglg==} + '@eslint/compat@1.4.1': + resolution: {integrity: sha512-cfO82V9zxxGBxcQDr1lfaYB7wykTa0b00mGa36FrJl7iTFd0Z2cHfEYuxcBRP/iNijCsWsEkA+jzT8hGYmv33w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.40 || 9 @@ -7393,38 +7395,26 @@ packages: resolution: {integrity: sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/core@0.15.2': - resolution: {integrity: sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/core@0.16.0': - resolution: {integrity: sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/core@0.17.0': resolution: {integrity: sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/eslintrc@3.3.1': - resolution: {integrity: sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==} + '@eslint/eslintrc@3.3.3': + resolution: {integrity: sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/js@9.38.0': - resolution: {integrity: sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A==} + '@eslint/js@9.39.1': + resolution: {integrity: sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/json@0.13.2': - resolution: {integrity: sha512-yWLyRE18rHgHXhWigRpiyv1LDPkvWtC6oa7QHXW7YdP6gosJoq7BiLZW2yCs9U7zN7X4U3ZeOJjepA10XAOIMw==} + '@eslint/json@0.14.0': + resolution: {integrity: sha512-rvR/EZtvUG3p9uqrSmcDJPYSH7atmWr0RnFWN6m917MAPx82+zQgPUmDu0whPFG6XTyM0vB/hR6c1Q63OaYtCQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/object-schema@2.1.7': resolution: {integrity: sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/plugin-kit@0.3.5': - resolution: {integrity: sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/plugin-kit@0.4.1': resolution: {integrity: sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -9481,100 +9471,63 @@ packages: '@types/yauzl@2.10.3': resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} - '@typescript-eslint/eslint-plugin@8.46.2': - resolution: {integrity: sha512-ZGBMToy857/NIPaaCucIUQgqueOiq7HeAKkhlvqVV4lm089zUFW6ikRySx2v+cAhKeUCPuWVHeimyk6Dw1iY3w==} + '@typescript-eslint/eslint-plugin@8.48.0': + resolution: {integrity: sha512-XxXP5tL1txl13YFtrECECQYeZjBZad4fyd3cFV4a19LkAY/bIp9fev3US4S5fDVV2JaYFiKAZ/GRTOLer+mbyQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': ^8.46.2 + '@typescript-eslint/parser': ^8.48.0 eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/parser@8.46.2': - resolution: {integrity: sha512-BnOroVl1SgrPLywqxyqdJ4l3S2MsKVLDVxZvjI1Eoe8ev2r3kGDo+PcMihNmDE+6/KjkTubSJnmqGZZjQSBq/g==} + '@typescript-eslint/parser@8.48.0': + resolution: {integrity: sha512-jCzKdm/QK0Kg4V4IK/oMlRZlY+QOcdjv89U2NgKHZk1CYTj82/RVSx1mV/0gqCVMJ/DA+Zf/S4NBWNF8GQ+eqQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/project-service@8.46.2': - resolution: {integrity: sha512-PULOLZ9iqwI7hXcmL4fVfIsBi6AN9YxRc0frbvmg8f+4hQAjQ5GYNKK0DIArNo+rOKmR/iBYwkpBmnIwin4wBg==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/project-service@8.46.4': - resolution: {integrity: sha512-nPiRSKuvtTN+no/2N1kt2tUh/HoFzeEgOm9fQ6XQk4/ApGqjx0zFIIaLJ6wooR1HIoozvj2j6vTi/1fgAz7UYQ==} + '@typescript-eslint/project-service@8.48.0': + resolution: {integrity: sha512-Ne4CTZyRh1BecBf84siv42wv5vQvVmgtk8AuiEffKTUo3DrBaGYZueJSxxBZ8fjk/N3DrgChH4TOdIOwOwiqqw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/scope-manager@8.46.2': - resolution: {integrity: sha512-LF4b/NmGvdWEHD2H4MsHD8ny6JpiVNDzrSZr3CsckEgCbAGZbYM4Cqxvi9L+WqDMT+51Ozy7lt2M+d0JLEuBqA==} + '@typescript-eslint/scope-manager@8.48.0': + resolution: {integrity: sha512-uGSSsbrtJrLduti0Q1Q9+BF1/iFKaxGoQwjWOIVNJv0o6omrdyR8ct37m4xIl5Zzpkp69Kkmvom7QFTtue89YQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/scope-manager@8.46.4': - resolution: {integrity: sha512-tMDbLGXb1wC+McN1M6QeDx7P7c0UWO5z9CXqp7J8E+xGcJuUuevWKxuG8j41FoweS3+L41SkyKKkia16jpX7CA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@typescript-eslint/tsconfig-utils@8.46.2': - resolution: {integrity: sha512-a7QH6fw4S57+F5y2FIxxSDyi5M4UfGF+Jl1bCGd7+L4KsaUY80GsiF/t0UoRFDHAguKlBaACWJRmdrc6Xfkkag==} + '@typescript-eslint/tsconfig-utils@8.48.0': + resolution: {integrity: sha512-WNebjBdFdyu10sR1M4OXTt2OkMd5KWIL+LLfeH9KhgP+jzfDV/LI3eXzwJ1s9+Yc0Kzo2fQCdY/OpdusCMmh6w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/tsconfig-utils@8.46.4': - resolution: {integrity: sha512-+/XqaZPIAk6Cjg7NWgSGe27X4zMGqrFqZ8atJsX3CWxH/jACqWnrWI68h7nHQld0y+k9eTTjb9r+KU4twLoo9A==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/type-utils@8.46.2': - resolution: {integrity: sha512-HbPM4LbaAAt/DjxXaG9yiS9brOOz6fabal4uvUmaUYe6l3K1phQDMQKBRUrr06BQkxkvIZVVHttqiybM9nJsLA==} + '@typescript-eslint/type-utils@8.48.0': + resolution: {integrity: sha512-zbeVaVqeXhhab6QNEKfK96Xyc7UQuoFWERhEnj3mLVnUWrQnv15cJNseUni7f3g557gm0e46LZ6IJ4NJVOgOpw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/types@8.46.2': - resolution: {integrity: sha512-lNCWCbq7rpg7qDsQrd3D6NyWYu+gkTENkG5IKYhUIcxSb59SQC/hEQ+MrG4sTgBVghTonNWq42bA/d4yYumldQ==} + '@typescript-eslint/types@8.48.0': + resolution: {integrity: sha512-cQMcGQQH7kwKoVswD1xdOytxQR60MWKM1di26xSUtxehaDs/32Zpqsu5WJlXTtTTqyAVK8R7hvsUnIXRS+bjvA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/types@8.46.4': - resolution: {integrity: sha512-USjyxm3gQEePdUwJBFjjGNG18xY9A2grDVGuk7/9AkjIF1L+ZrVnwR5VAU5JXtUnBL/Nwt3H31KlRDaksnM7/w==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@typescript-eslint/typescript-estree@8.46.2': - resolution: {integrity: sha512-f7rW7LJ2b7Uh2EiQ+7sza6RDZnajbNbemn54Ob6fRwQbgcIn+GWfyuHDHRYgRoZu1P4AayVScrRW+YfbTvPQoQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/typescript-estree@8.46.4': - resolution: {integrity: sha512-7oV2qEOr1d4NWNmpXLR35LvCfOkTNymY9oyW+lUHkmCno7aOmIf/hMaydnJBUTBMRCOGZh8YjkFOc8dadEoNGA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '>=4.8.4 <6.0.0' - - '@typescript-eslint/utils@8.46.2': - resolution: {integrity: sha512-sExxzucx0Tud5tE0XqR0lT0psBQvEpnpiul9XbGUB1QwpWJJAps1O/Z7hJxLGiZLBKMCutjTzDgmd1muEhBnVg==} + '@typescript-eslint/typescript-estree@8.48.0': + resolution: {integrity: sha512-ljHab1CSO4rGrQIAyizUS6UGHHCiAYhbfcIZ1zVJr5nMryxlXMVWS3duFPSKvSUbFPwkXMFk1k0EMIjub4sRRQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/utils@8.46.4': - resolution: {integrity: sha512-AbSv11fklGXV6T28dp2Me04Uw90R2iJ30g2bgLz529Koehrmkbs1r7paFqr1vPCZi7hHwYxYtxfyQMRC8QaVSg==} + '@typescript-eslint/utils@8.48.0': + resolution: {integrity: sha512-yTJO1XuGxCsSfIVt1+1UrLHtue8xz16V8apzPYI06W0HbEbEWHxHXgZaAgavIkoh+GeV6hKKd5jm0sS6OYxWXQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - '@typescript-eslint/visitor-keys@8.46.2': - resolution: {integrity: sha512-tUFMXI4gxzzMXt4xpGJEsBsTox0XbNQ1y94EwlD/CuZwFcQP79xfQqMhau9HsRc/J0cAPA/HZt1dZPtGn9V/7w==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@typescript-eslint/visitor-keys@8.46.4': - resolution: {integrity: sha512-/++5CYLQqsO9HFGLI7APrxBJYo+5OCMpViuhV8q5/Qa3o5mMrF//eQHks+PXcsAVaLdn817fMuS7zqoXNNZGaw==} + '@typescript-eslint/visitor-keys@8.48.0': + resolution: {integrity: sha512-T0XJMaRPOH3+LBbAfzR2jalckP1MSG/L9eUtY0DEzUyVaXJ/t6zN0nR7co5kz0Jko/nkSYCBRkz1djvjajVTTg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@ungap/structured-clone@1.3.0': @@ -12040,8 +11993,8 @@ packages: peerDependencies: eslint: '>=8' - eslint-plugin-es-x@9.1.2: - resolution: {integrity: sha512-v019GsVMydtD8e0QazxOtwQRtmKVZgkpykvUwaKH8otLHaLsnV6txRrQWN4MeGn8W1A00Dh8N0R41uiIyvMsYA==} + eslint-plugin-es-x@9.2.0: + resolution: {integrity: sha512-mQrBhl8pvoKih9ohoK5t0v4ihugf3NJEKIXtEokz0BPEcTTjDssntXREgrVbLOM/G6tcUcjGfptyuQ8eNnXzwQ==} engines: {node: ^20.19.0 || >=22.12.0} peerDependencies: eslint: '>=9.29.0' @@ -12066,8 +12019,8 @@ packages: '@testing-library/dom': optional: true - eslint-plugin-jest@29.0.1: - resolution: {integrity: sha512-EE44T0OSMCeXhDrrdsbKAhprobKkPtJTbQz5yEktysNpHeDZTAL1SfDTNKmcFfJkY6yrQLtTKZALrD3j/Gpmiw==} + eslint-plugin-jest@29.2.1: + resolution: {integrity: sha512-0WLIezrIxitUGbjMIGwznVzSIp0uFJV0PZ2fiSvpyVcxe+QMXKUt7MRhUpzdbctnnLwiOTOFkACplgB0wAglFw==} engines: {node: ^20.12.0 || ^22.0.0 || >=24.0.0} peerDependencies: '@typescript-eslint/eslint-plugin': ^8.0.0 @@ -12103,16 +12056,16 @@ packages: peerDependencies: eslint: '>=8.23.0' - eslint-plugin-package-json@0.59.0: - resolution: {integrity: sha512-4xdVhL3b7LqQQh8cvN3hX8HkAVM6cxZoXqyN4ZE4kN9NuJ21sgnj1IGS19/bmIgCdGBhmsWGXbbyD1H9mjZfMA==} + eslint-plugin-package-json@0.85.0: + resolution: {integrity: sha512-MrOxFvhbqLuk4FIPG9v3u9Amn0n137J8LKILHvgfxK3rRyAHEVzuZM0CtpXFTx7cx4LzmAzONtlpjbM0UFNuTA==} engines: {node: ^20.19.0 || >=22.12.0} peerDependencies: eslint: '>=8.0.0' jsonc-eslint-parser: ^2.0.0 - eslint-plugin-playwright@2.2.2: - resolution: {integrity: sha512-j0jKpndIPOXRRP9uMkwb9l/nSmModOU3452nrFdgFJoEv/435J1onk8+aITzjDW8DfypxgmVaDMdmVIa6F7I0w==} - engines: {node: '>=16.6.0'} + eslint-plugin-playwright@2.4.0: + resolution: {integrity: sha512-MWNXfXlLfwXAjj4Z80PvCCFCXgCYy5OCHan57Z/beGrjkJ3maG1GanuGX8Ck6T6fagplBx2ZdkifxSfByftaTQ==} + engines: {node: '>=16.9.0'} peerDependencies: eslint: '>=8.40.0' @@ -12142,8 +12095,8 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7 - eslint-plugin-svelte@3.12.5: - resolution: {integrity: sha512-4KRG84eAHQfYd9OjZ1K7sCHy0nox+9KwT+s5WCCku3jTim5RV4tVENob274nCwIaApXsYPKAUAZFBxKZ3Wyfjw==} + eslint-plugin-svelte@3.13.0: + resolution: {integrity: sha512-2ohCCQJJTNbIpQCSDSTWj+FN0OVfPmSO03lmSNT7ytqMaWF6kpT86LdzDqtm4sh7TVPl/OEWJ/d7R87bXP2Vjg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.1 || ^9.0.0 @@ -12152,9 +12105,9 @@ packages: svelte: optional: true - eslint-plugin-testing-library@7.13.3: - resolution: {integrity: sha512-STwyXN7GnHulgsfdXVd5iC8fFCJVRQj2AcKtMmQOsA8G4oMnSCOX1p3MjbrDQ9fmwVf5wZy6vboTOTFobWuxOA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0, pnpm: ^9.14.0} + eslint-plugin-testing-library@7.13.5: + resolution: {integrity: sha512-75rUmtNnXeO9cyMwG78vXxGEB7muIQ+IwcwBTma+M9KFc68SFaMKevGydObsUgX+IFef4lRLO/ysR9JqK1odyg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -12188,8 +12141,8 @@ packages: resolution: {integrity: sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - eslint@9.38.0: - resolution: {integrity: sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw==} + eslint@9.39.1: + resolution: {integrity: sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true peerDependencies: @@ -14476,8 +14429,8 @@ packages: package-json-from-dist@1.0.1: resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} - package-json-validator@0.31.0: - resolution: {integrity: sha512-kAVO0fNFWI2xpmthogYHnHjCtg0nJvwm9yjd9nnrR5OKIts5fmNMK2OhhjnLD1/ohJNodhCa5tZm8AolOgkfMg==} + package-json-validator@0.59.0: + resolution: {integrity: sha512-WBTDKtO9pBa9GmA1sPbQHqlWxRdnHNfLFIIA49PPgV7px/rG27gHX57DWy77qyu374fla4veaIHy+gA+qRRuug==} engines: {node: ^20.19.0 || >=22.12.0} hasBin: true @@ -16707,8 +16660,8 @@ packages: typescript-compare@0.0.2: resolution: {integrity: sha512-8ja4j7pMHkfLJQO2/8tut7ub+J3Lw2S3061eJLFQcvs3tsmJKp8KG5NtpLn7KcY2w08edF74BSVN7qJS0U6oHA==} - typescript-eslint@8.46.2: - resolution: {integrity: sha512-vbw8bOmiuYNdzzV3lsiWv6sRwjyuKJMQqWulBOU7M0RrxedXledX8G8kBbQeiOYDnTfiXz0Y4081E1QMNB6iQg==} + typescript-eslint@8.48.0: + resolution: {integrity: sha512-fcKOvQD9GUn3Xw63EgiDqhvWJ5jsyZUaekl3KVpGsDJnN46WJTe3jWxtQP9lMZm1LJNkFLlTaWAxK2vUQR+cqw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -16908,9 +16861,9 @@ packages: validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} - validate-npm-package-name@6.0.2: - resolution: {integrity: sha512-IUoow1YUtvoBBC06dXs8bR8B9vuA3aJfmQNKMoaPG/OFsPmoQvw8xh+6Ye25Gx9DQhoEom3Pcu9MKHerm/NpUQ==} - engines: {node: ^18.17.0 || >=20.5.0} + validate-npm-package-name@7.0.0: + resolution: {integrity: sha512-bwVk/OK+Qu108aJcMAEiU4yavHUI7aN20TgZNBj9MR2iU1zPUl1Z1Otr7771ExfYTPTvfN8ZJ1pbr5Iklgt4xg==} + engines: {node: ^20.17.0 || >=22.9.0} varint@6.0.0: resolution: {integrity: sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==} @@ -17689,11 +17642,11 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/eslint-parser@7.28.5(@babel/core@7.28.4)(eslint@9.38.0)': + '@babel/eslint-parser@7.28.5(@babel/core@7.28.4)(eslint@9.39.1)': dependencies: '@babel/core': 7.28.4 '@nicolo-ribaudo/eslint-scope-5-internals': 5.1.1-v1 - eslint: 9.38.0 + eslint: 9.39.1 eslint-visitor-keys: 2.1.0 semver: 6.3.1 @@ -18964,7 +18917,7 @@ snapshots: '@es-joy/jsdoccomment@0.52.0': dependencies: '@types/estree': 1.0.8 - '@typescript-eslint/types': 8.46.4 + '@typescript-eslint/types': 8.48.0 comment-parser: 1.4.1 esquery: 1.6.0 jsdoc-type-pratt-parser: 4.1.0 @@ -19047,18 +19000,18 @@ snapshots: '@esbuild/win32-x64@0.25.9': optional: true - '@eslint-community/eslint-utils@4.9.0(eslint@9.38.0)': + '@eslint-community/eslint-utils@4.9.0(eslint@9.39.1)': dependencies: - eslint: 9.38.0 + eslint: 9.39.1 eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.12.2': {} - '@eslint/compat@1.4.0(eslint@9.38.0)': + '@eslint/compat@1.4.1(eslint@9.39.1)': dependencies: - '@eslint/core': 0.16.0 + '@eslint/core': 0.17.0 optionalDependencies: - eslint: 9.38.0 + eslint: 9.39.1 '@eslint/config-array@0.21.1': dependencies: @@ -19072,19 +19025,11 @@ snapshots: dependencies: '@eslint/core': 0.17.0 - '@eslint/core@0.15.2': - dependencies: - '@types/json-schema': 7.0.15 - - '@eslint/core@0.16.0': - dependencies: - '@types/json-schema': 7.0.15 - '@eslint/core@0.17.0': dependencies: '@types/json-schema': 7.0.15 - '@eslint/eslintrc@3.3.1': + '@eslint/eslintrc@3.3.3': dependencies: ajv: 6.12.6 debug: 4.4.3 @@ -19098,22 +19043,17 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@9.38.0': {} + '@eslint/js@9.39.1': {} - '@eslint/json@0.13.2': + '@eslint/json@0.14.0': dependencies: - '@eslint/core': 0.15.2 - '@eslint/plugin-kit': 0.3.5 + '@eslint/core': 0.17.0 + '@eslint/plugin-kit': 0.4.1 '@humanwhocodes/momoa': 3.3.10 natural-compare: 1.4.0 '@eslint/object-schema@2.1.7': {} - '@eslint/plugin-kit@0.3.5': - dependencies: - '@eslint/core': 0.15.2 - levn: 0.4.1 - '@eslint/plugin-kit@0.4.1': dependencies: '@eslint/core': 0.17.0 @@ -21298,10 +21238,10 @@ snapshots: '@tannin/sprintf@1.3.3': {} - '@tanstack/eslint-plugin-query@5.91.2(eslint@9.38.0)(typescript@5.9.3)': + '@tanstack/eslint-plugin-query@5.91.2(eslint@9.39.1)(typescript@5.9.3)': dependencies: - '@typescript-eslint/utils': 8.46.4(eslint@9.38.0)(typescript@5.9.3) - eslint: 9.38.0 + '@typescript-eslint/utils': 8.48.0(eslint@9.39.1)(typescript@5.9.3) + eslint: 9.39.1 transitivePeerDependencies: - supports-color - typescript @@ -21721,15 +21661,15 @@ snapshots: '@types/node': 20.19.24 optional: true - '@typescript-eslint/eslint-plugin@8.46.2(@typescript-eslint/parser@8.46.2(eslint@9.38.0)(typescript@5.9.3))(eslint@9.38.0)(typescript@5.9.3)': + '@typescript-eslint/eslint-plugin@8.48.0(@typescript-eslint/parser@8.48.0(eslint@9.39.1)(typescript@5.9.3))(eslint@9.39.1)(typescript@5.9.3)': dependencies: '@eslint-community/regexpp': 4.12.2 - '@typescript-eslint/parser': 8.46.2(eslint@9.38.0)(typescript@5.9.3) - '@typescript-eslint/scope-manager': 8.46.2 - '@typescript-eslint/type-utils': 8.46.2(eslint@9.38.0)(typescript@5.9.3) - '@typescript-eslint/utils': 8.46.2(eslint@9.38.0)(typescript@5.9.3) - '@typescript-eslint/visitor-keys': 8.46.2 - eslint: 9.38.0 + '@typescript-eslint/parser': 8.48.0(eslint@9.39.1)(typescript@5.9.3) + '@typescript-eslint/scope-manager': 8.48.0 + '@typescript-eslint/type-utils': 8.48.0(eslint@9.39.1)(typescript@5.9.3) + '@typescript-eslint/utils': 8.48.0(eslint@9.39.1)(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.48.0 + eslint: 9.39.1 graphemer: 1.4.0 ignore: 7.0.0 natural-compare: 1.4.0 @@ -21738,132 +21678,79 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.46.2(eslint@9.38.0)(typescript@5.9.3)': - dependencies: - '@typescript-eslint/scope-manager': 8.46.2 - '@typescript-eslint/types': 8.46.2 - '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) - '@typescript-eslint/visitor-keys': 8.46.2 - debug: 4.4.3 - eslint: 9.38.0 - typescript: 5.9.3 - transitivePeerDependencies: - - supports-color - - '@typescript-eslint/project-service@8.46.2(typescript@5.9.3)': + '@typescript-eslint/parser@8.48.0(eslint@9.39.1)(typescript@5.9.3)': dependencies: - '@typescript-eslint/tsconfig-utils': 8.46.4(typescript@5.9.3) - '@typescript-eslint/types': 8.46.4 + '@typescript-eslint/scope-manager': 8.48.0 + '@typescript-eslint/types': 8.48.0 + '@typescript-eslint/typescript-estree': 8.48.0(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.48.0 debug: 4.4.3 + eslint: 9.39.1 typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/project-service@8.46.4(typescript@5.9.3)': + '@typescript-eslint/project-service@8.48.0(typescript@5.9.3)': dependencies: - '@typescript-eslint/tsconfig-utils': 8.46.4(typescript@5.9.3) - '@typescript-eslint/types': 8.46.4 + '@typescript-eslint/tsconfig-utils': 8.48.0(typescript@5.9.3) + '@typescript-eslint/types': 8.48.0 debug: 4.4.3 typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.46.2': + '@typescript-eslint/scope-manager@8.48.0': dependencies: - '@typescript-eslint/types': 8.46.2 - '@typescript-eslint/visitor-keys': 8.46.2 + '@typescript-eslint/types': 8.48.0 + '@typescript-eslint/visitor-keys': 8.48.0 - '@typescript-eslint/scope-manager@8.46.4': - dependencies: - '@typescript-eslint/types': 8.46.4 - '@typescript-eslint/visitor-keys': 8.46.4 - - '@typescript-eslint/tsconfig-utils@8.46.2(typescript@5.9.3)': - dependencies: - typescript: 5.9.3 - - '@typescript-eslint/tsconfig-utils@8.46.4(typescript@5.9.3)': + '@typescript-eslint/tsconfig-utils@8.48.0(typescript@5.9.3)': dependencies: typescript: 5.9.3 - '@typescript-eslint/type-utils@8.46.2(eslint@9.38.0)(typescript@5.9.3)': + '@typescript-eslint/type-utils@8.48.0(eslint@9.39.1)(typescript@5.9.3)': dependencies: - '@typescript-eslint/types': 8.46.2 - '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) - '@typescript-eslint/utils': 8.46.2(eslint@9.38.0)(typescript@5.9.3) + '@typescript-eslint/types': 8.48.0 + '@typescript-eslint/typescript-estree': 8.48.0(typescript@5.9.3) + '@typescript-eslint/utils': 8.48.0(eslint@9.39.1)(typescript@5.9.3) debug: 4.4.3 - eslint: 9.38.0 + eslint: 9.39.1 ts-api-utils: 2.1.0(typescript@5.9.3) typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/types@8.46.2': {} - - '@typescript-eslint/types@8.46.4': {} + '@typescript-eslint/types@8.48.0': {} - '@typescript-eslint/typescript-estree@8.46.2(typescript@5.9.3)': + '@typescript-eslint/typescript-estree@8.48.0(typescript@5.9.3)': dependencies: - '@typescript-eslint/project-service': 8.46.2(typescript@5.9.3) - '@typescript-eslint/tsconfig-utils': 8.46.2(typescript@5.9.3) - '@typescript-eslint/types': 8.46.2 - '@typescript-eslint/visitor-keys': 8.46.2 + '@typescript-eslint/project-service': 8.48.0(typescript@5.9.3) + '@typescript-eslint/tsconfig-utils': 8.48.0(typescript@5.9.3) + '@typescript-eslint/types': 8.48.0 + '@typescript-eslint/visitor-keys': 8.48.0 debug: 4.4.3 - fast-glob: 3.3.3 - is-glob: 4.0.3 - minimatch: 9.0.5 - semver: 7.7.3 - ts-api-utils: 2.1.0(typescript@5.9.3) - typescript: 5.9.3 - transitivePeerDependencies: - - supports-color - - '@typescript-eslint/typescript-estree@8.46.4(typescript@5.9.3)': - dependencies: - '@typescript-eslint/project-service': 8.46.4(typescript@5.9.3) - '@typescript-eslint/tsconfig-utils': 8.46.4(typescript@5.9.3) - '@typescript-eslint/types': 8.46.4 - '@typescript-eslint/visitor-keys': 8.46.4 - debug: 4.4.3 - fast-glob: 3.3.3 - is-glob: 4.0.3 minimatch: 9.0.5 semver: 7.7.3 + tinyglobby: 0.2.15 ts-api-utils: 2.1.0(typescript@5.9.3) typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.46.2(eslint@9.38.0)(typescript@5.9.3)': + '@typescript-eslint/utils@8.48.0(eslint@9.39.1)(typescript@5.9.3)': dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.38.0) - '@typescript-eslint/scope-manager': 8.46.2 - '@typescript-eslint/types': 8.46.2 - '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) - eslint: 9.38.0 + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) + '@typescript-eslint/scope-manager': 8.48.0 + '@typescript-eslint/types': 8.48.0 + '@typescript-eslint/typescript-estree': 8.48.0(typescript@5.9.3) + eslint: 9.39.1 typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.46.4(eslint@9.38.0)(typescript@5.9.3)': + '@typescript-eslint/visitor-keys@8.48.0': dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.38.0) - '@typescript-eslint/scope-manager': 8.46.4 - '@typescript-eslint/types': 8.46.4 - '@typescript-eslint/typescript-estree': 8.46.4(typescript@5.9.3) - eslint: 9.38.0 - typescript: 5.9.3 - transitivePeerDependencies: - - supports-color - - '@typescript-eslint/visitor-keys@8.46.2': - dependencies: - '@typescript-eslint/types': 8.46.2 - eslint-visitor-keys: 4.2.1 - - '@typescript-eslint/visitor-keys@8.46.4': - dependencies: - '@typescript-eslint/types': 8.46.4 + '@typescript-eslint/types': 8.48.0 eslint-visitor-keys: 4.2.1 '@ungap/structured-clone@1.3.0': {} @@ -23629,24 +23516,24 @@ snapshots: '@wordpress/escape-html@3.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)': {} - '@wordpress/eslint-plugin@22.22.0(@babel/core@7.28.4)(eslint-config-prettier@10.1.8(eslint@9.38.0))(eslint-plugin-import@2.32.0)(eslint-plugin-jest@29.0.1(eslint@9.38.0)(jest@30.2.0)(typescript@5.9.3))(eslint-plugin-jsdoc@51.4.1(eslint@9.38.0))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.38.0))(eslint-plugin-playwright@2.2.2(eslint@9.38.0))(eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.38.0))(eslint@9.38.0)(wp-prettier@3.0.3))(eslint-plugin-react-hooks@5.2.0(eslint@9.38.0))(eslint-plugin-react@7.37.5(eslint@9.38.0))(eslint@9.38.0)(typescript@5.9.3)(wp-prettier@3.0.3)': + '@wordpress/eslint-plugin@22.22.0(@babel/core@7.28.4)(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint-plugin-import@2.32.0)(eslint-plugin-jest@29.2.1(eslint@9.39.1)(jest@30.2.0)(typescript@5.9.3))(eslint-plugin-jsdoc@51.4.1(eslint@9.39.1))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.39.1))(eslint-plugin-playwright@2.4.0(eslint@9.39.1))(eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint@9.39.1)(wp-prettier@3.0.3))(eslint-plugin-react-hooks@5.2.0(eslint@9.39.1))(eslint-plugin-react@7.37.5(eslint@9.39.1))(eslint@9.39.1)(typescript@5.9.3)(wp-prettier@3.0.3)': dependencies: '@babel/core': 7.28.4 - '@babel/eslint-parser': 7.28.5(@babel/core@7.28.4)(eslint@9.38.0) + '@babel/eslint-parser': 7.28.5(@babel/core@7.28.4)(eslint@9.39.1) '@wordpress/babel-preset-default': 8.36.0 '@wordpress/prettier-config': 4.36.0(wp-prettier@3.0.3) cosmiconfig: 7.1.0 - eslint: 9.38.0 - eslint-config-prettier: 10.1.8(eslint@9.38.0) - eslint-import-resolver-typescript: 4.4.4(eslint-plugin-import@2.32.0)(eslint@9.38.0) - eslint-plugin-import: 2.32.0(eslint-import-resolver-typescript@4.4.4)(eslint@9.38.0) - eslint-plugin-jest: 29.0.1(eslint@9.38.0)(jest@30.2.0)(typescript@5.9.3) - eslint-plugin-jsdoc: 51.4.1(eslint@9.38.0) - eslint-plugin-jsx-a11y: 6.10.2(eslint@9.38.0) - eslint-plugin-playwright: 2.2.2(eslint@9.38.0) - eslint-plugin-prettier: 5.5.4(eslint-config-prettier@10.1.8(eslint@9.38.0))(eslint@9.38.0)(wp-prettier@3.0.3) - eslint-plugin-react: 7.37.5(eslint@9.38.0) - eslint-plugin-react-hooks: 5.2.0(eslint@9.38.0) + eslint: 9.39.1 + eslint-config-prettier: 10.1.8(eslint@9.39.1) + eslint-import-resolver-typescript: 4.4.4(eslint-plugin-import@2.32.0)(eslint@9.39.1) + eslint-plugin-import: 2.32.0(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1) + eslint-plugin-jest: 29.2.1(eslint@9.39.1)(jest@30.2.0)(typescript@5.9.3) + eslint-plugin-jsdoc: 51.4.1(eslint@9.39.1) + eslint-plugin-jsx-a11y: 6.10.2(eslint@9.39.1) + eslint-plugin-playwright: 2.4.0(eslint@9.39.1) + eslint-plugin-prettier: 5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint@9.39.1)(wp-prettier@3.0.3) + eslint-plugin-react: 7.37.5(eslint@9.39.1) + eslint-plugin-react-hooks: 5.2.0(eslint@9.39.1) globals: 13.24.0 requireindex: 1.2.0 optionalDependencies: @@ -26374,18 +26261,18 @@ snapshots: optionalDependencies: source-map: 0.6.1 - eslint-compat-utils@0.5.1(eslint@9.38.0): + eslint-compat-utils@0.5.1(eslint@9.39.1): dependencies: - eslint: 9.38.0 + eslint: 9.39.1 semver: 7.7.3 - eslint-config-prettier@10.1.8(eslint@9.38.0): + eslint-config-prettier@10.1.8(eslint@9.39.1): dependencies: - eslint: 9.38.0 + eslint: 9.39.1 - eslint-fix-utils@0.4.0(eslint@9.38.0): + eslint-fix-utils@0.4.0(eslint@9.39.1): dependencies: - eslint: 9.38.0 + eslint: 9.39.1 eslint-import-context@0.1.9(unrs-resolver@1.11.1): dependencies: @@ -26402,10 +26289,10 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@4.4.4(eslint-plugin-import@2.32.0)(eslint@9.38.0): + eslint-import-resolver-typescript@4.4.4(eslint-plugin-import@2.32.0)(eslint@9.39.1): dependencies: debug: 4.4.3 - eslint: 9.38.0 + eslint: 9.39.1 eslint-import-context: 0.1.9(unrs-resolver@1.11.1) get-tsconfig: 4.13.0 is-bun-module: 2.0.0 @@ -26413,43 +26300,43 @@ snapshots: tinyglobby: 0.2.15 unrs-resolver: 1.11.1 optionalDependencies: - eslint-plugin-import: 2.32.0(eslint-import-resolver-typescript@4.4.4)(eslint@9.38.0) + eslint-plugin-import: 2.32.0(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1) transitivePeerDependencies: - supports-color - eslint-json-compat-utils@0.2.1(@eslint/json@0.13.2)(eslint@9.38.0)(jsonc-eslint-parser@2.4.1): + eslint-json-compat-utils@0.2.1(@eslint/json@0.14.0)(eslint@9.39.1)(jsonc-eslint-parser@2.4.1): dependencies: - eslint: 9.38.0 + eslint: 9.39.1 esquery: 1.6.0 jsonc-eslint-parser: 2.4.1 optionalDependencies: - '@eslint/json': 0.13.2 + '@eslint/json': 0.14.0 - eslint-module-utils@2.12.1(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@4.4.4)(eslint@9.38.0): + eslint-module-utils@2.12.1(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1): dependencies: debug: 3.2.7 optionalDependencies: - eslint: 9.38.0 + eslint: 9.39.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 4.4.4(eslint-plugin-import@2.32.0)(eslint@9.38.0) + eslint-import-resolver-typescript: 4.4.4(eslint-plugin-import@2.32.0)(eslint@9.39.1) transitivePeerDependencies: - supports-color - eslint-plugin-es-x@7.8.0(eslint@9.38.0): + eslint-plugin-es-x@7.8.0(eslint@9.39.1): dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.38.0) + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) '@eslint-community/regexpp': 4.12.2 - eslint: 9.38.0 - eslint-compat-utils: 0.5.1(eslint@9.38.0) + eslint: 9.39.1 + eslint-compat-utils: 0.5.1(eslint@9.39.1) - eslint-plugin-es-x@9.1.2(eslint@9.38.0): + eslint-plugin-es-x@9.2.0(eslint@9.39.1): dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.38.0) + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) '@eslint-community/regexpp': 4.12.2 - eslint: 9.38.0 - eslint-type-tracer: 0.4.1(eslint@9.38.0) + eslint: 9.39.1 + eslint-type-tracer: 0.4.1(eslint@9.39.1) - eslint-plugin-import@2.32.0(eslint-import-resolver-typescript@4.4.4)(eslint@9.38.0): + eslint-plugin-import@2.32.0(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.9 @@ -26458,9 +26345,9 @@ snapshots: array.prototype.flatmap: 1.3.3 debug: 3.2.7 doctrine: 2.1.0 - eslint: 9.38.0 + eslint: 9.39.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.1(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@4.4.4)(eslint@9.38.0) + eslint-module-utils: 2.12.1(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -26476,30 +26363,30 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-jest-dom@5.5.0(eslint@9.38.0): + eslint-plugin-jest-dom@5.5.0(eslint@9.39.1): dependencies: '@babel/runtime': 7.28.4 - eslint: 9.38.0 + eslint: 9.39.1 requireindex: 1.2.0 - eslint-plugin-jest@29.0.1(eslint@9.38.0)(jest@30.2.0)(typescript@5.9.3): + eslint-plugin-jest@29.2.1(eslint@9.39.1)(jest@30.2.0)(typescript@5.9.3): dependencies: - '@typescript-eslint/utils': 8.46.4(eslint@9.38.0)(typescript@5.9.3) - eslint: 9.38.0 + '@typescript-eslint/utils': 8.48.0(eslint@9.39.1)(typescript@5.9.3) + eslint: 9.39.1 optionalDependencies: jest: 30.2.0 transitivePeerDependencies: - supports-color - typescript - eslint-plugin-jsdoc@51.4.1(eslint@9.38.0): + eslint-plugin-jsdoc@51.4.1(eslint@9.39.1): dependencies: '@es-joy/jsdoccomment': 0.52.0 are-docs-informative: 0.0.2 comment-parser: 1.4.1 debug: 4.4.3 escape-string-regexp: 4.0.0 - eslint: 9.38.0 + eslint: 9.39.1 espree: 10.4.0 esquery: 1.6.0 parse-imports-exports: 0.2.4 @@ -26508,7 +26395,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-jsx-a11y@6.10.2(eslint@9.38.0): + eslint-plugin-jsx-a11y@6.10.2(eslint@9.39.1): dependencies: aria-query: 5.3.2 array-includes: 3.1.9 @@ -26518,7 +26405,7 @@ snapshots: axobject-query: 4.1.0 damerau-levenshtein: 1.0.8 emoji-regex: 9.2.2 - eslint: 9.38.0 + eslint: 9.39.1 hasown: 2.0.2 jsx-ast-utils: 3.3.5 language-tags: 1.0.9 @@ -26527,17 +26414,17 @@ snapshots: safe-regex-test: 1.1.0 string.prototype.includes: 2.0.1 - eslint-plugin-lodash@8.0.0(eslint@9.38.0): + eslint-plugin-lodash@8.0.0(eslint@9.39.1): dependencies: - eslint: 9.38.0 + eslint: 9.39.1 lodash: 4.17.21 - eslint-plugin-n@17.23.1(eslint@9.38.0)(typescript@5.9.3): + eslint-plugin-n@17.23.1(eslint@9.39.1)(typescript@5.9.3): dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.38.0) + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) enhanced-resolve: 5.18.3 - eslint: 9.38.0 - eslint-plugin-es-x: 7.8.0(eslint@9.38.0) + eslint: 9.39.1 + eslint-plugin-es-x: 7.8.0(eslint@9.39.1) get-tsconfig: 4.13.0 globals: 15.15.0 globrex: 0.1.2 @@ -26547,42 +26434,42 @@ snapshots: transitivePeerDependencies: - typescript - eslint-plugin-package-json@0.59.0(eslint@9.38.0)(jsonc-eslint-parser@2.4.1): + eslint-plugin-package-json@0.85.0(eslint@9.39.1)(jsonc-eslint-parser@2.4.1): dependencies: '@altano/repository-tools': 2.0.1 change-case: 5.4.4 detect-indent: 7.0.2 detect-newline: 4.0.1 - eslint: 9.38.0 - eslint-fix-utils: 0.4.0(eslint@9.38.0) + eslint: 9.39.1 + eslint-fix-utils: 0.4.0(eslint@9.39.1) jsonc-eslint-parser: 2.4.1 - package-json-validator: 0.31.0 + package-json-validator: 0.59.0 semver: 7.7.3 sort-object-keys: 2.0.1 sort-package-json: 3.4.0 - validate-npm-package-name: 6.0.2 + validate-npm-package-name: 7.0.0 transitivePeerDependencies: - '@types/estree' - eslint-plugin-playwright@2.2.2(eslint@9.38.0): + eslint-plugin-playwright@2.4.0(eslint@9.39.1): dependencies: - eslint: 9.38.0 - globals: 13.24.0 + eslint: 9.39.1 + globals: 16.5.0 - eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.38.0))(eslint@9.38.0)(wp-prettier@3.0.3): + eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint@9.39.1)(wp-prettier@3.0.3): dependencies: - eslint: 9.38.0 + eslint: 9.39.1 prettier: wp-prettier@3.0.3 prettier-linter-helpers: 1.0.0 synckit: 0.11.11 optionalDependencies: - eslint-config-prettier: 10.1.8(eslint@9.38.0) + eslint-config-prettier: 10.1.8(eslint@9.39.1) - eslint-plugin-react-hooks@5.2.0(eslint@9.38.0): + eslint-plugin-react-hooks@5.2.0(eslint@9.39.1): dependencies: - eslint: 9.38.0 + eslint: 9.39.1 - eslint-plugin-react@7.37.5(eslint@9.38.0): + eslint-plugin-react@7.37.5(eslint@9.39.1): dependencies: array-includes: 3.1.9 array.prototype.findlast: 1.2.5 @@ -26590,7 +26477,7 @@ snapshots: array.prototype.tosorted: 1.1.4 doctrine: 2.1.0 es-iterator-helpers: 1.2.1 - eslint: 9.38.0 + eslint: 9.39.1 estraverse: 5.3.0 hasown: 2.0.2 jsx-ast-utils: 3.3.5 @@ -26604,11 +26491,11 @@ snapshots: string.prototype.matchall: 4.0.12 string.prototype.repeat: 1.0.0 - eslint-plugin-svelte@3.12.5(eslint@9.38.0)(svelte@4.2.19): + eslint-plugin-svelte@3.13.0(eslint@9.39.1)(svelte@4.2.19): dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.38.0) + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) '@jridgewell/sourcemap-codec': 1.5.5 - eslint: 9.38.0 + eslint: 9.39.1 esutils: 2.0.3 globals: 16.5.0 known-css-properties: 0.37.0 @@ -26622,11 +26509,11 @@ snapshots: transitivePeerDependencies: - ts-node - eslint-plugin-testing-library@7.13.3(eslint@9.38.0)(typescript@5.9.3): + eslint-plugin-testing-library@7.13.5(eslint@9.39.1)(typescript@5.9.3): dependencies: - '@typescript-eslint/scope-manager': 8.46.4 - '@typescript-eslint/utils': 8.46.4(eslint@9.38.0)(typescript@5.9.3) - eslint: 9.38.0 + '@typescript-eslint/scope-manager': 8.48.0 + '@typescript-eslint/utils': 8.48.0(eslint@9.39.1)(typescript@5.9.3) + eslint: 9.39.1 transitivePeerDependencies: - supports-color - typescript @@ -26645,10 +26532,10 @@ snapshots: esrecurse: 4.3.0 estraverse: 5.3.0 - eslint-type-tracer@0.4.1(eslint@9.38.0): + eslint-type-tracer@0.4.1(eslint@9.39.1): dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.38.0) - eslint: 9.38.0 + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) + eslint: 9.39.1 eslint-visitor-keys@2.1.0: {} @@ -26656,15 +26543,15 @@ snapshots: eslint-visitor-keys@4.2.1: {} - eslint@9.38.0: + eslint@9.39.1: dependencies: - '@eslint-community/eslint-utils': 4.9.0(eslint@9.38.0) + '@eslint-community/eslint-utils': 4.9.0(eslint@9.39.1) '@eslint-community/regexpp': 4.12.2 '@eslint/config-array': 0.21.1 '@eslint/config-helpers': 0.4.2 - '@eslint/core': 0.16.0 - '@eslint/eslintrc': 3.3.1 - '@eslint/js': 9.38.0 + '@eslint/core': 0.17.0 + '@eslint/eslintrc': 3.3.3 + '@eslint/js': 9.39.1 '@eslint/plugin-kit': 0.4.1 '@humanfs/node': 0.16.7 '@humanwhocodes/module-importer': 1.0.1 @@ -29596,10 +29483,11 @@ snapshots: package-json-from-dist@1.0.1: {} - package-json-validator@0.31.0: + package-json-validator@0.59.0: dependencies: semver: 7.7.3 validate-npm-package-license: 3.0.4 + validate-npm-package-name: 7.0.0 yargs: 18.0.0 param-case@3.0.4: @@ -32022,13 +31910,13 @@ snapshots: dependencies: typescript-logic: 0.0.0 - typescript-eslint@8.46.2(eslint@9.38.0)(typescript@5.9.3): + typescript-eslint@8.48.0(eslint@9.39.1)(typescript@5.9.3): dependencies: - '@typescript-eslint/eslint-plugin': 8.46.2(@typescript-eslint/parser@8.46.2(eslint@9.38.0)(typescript@5.9.3))(eslint@9.38.0)(typescript@5.9.3) - '@typescript-eslint/parser': 8.46.2(eslint@9.38.0)(typescript@5.9.3) - '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) - '@typescript-eslint/utils': 8.46.2(eslint@9.38.0)(typescript@5.9.3) - eslint: 9.38.0 + '@typescript-eslint/eslint-plugin': 8.48.0(@typescript-eslint/parser@8.48.0(eslint@9.39.1)(typescript@5.9.3))(eslint@9.39.1)(typescript@5.9.3) + '@typescript-eslint/parser': 8.48.0(eslint@9.39.1)(typescript@5.9.3) + '@typescript-eslint/typescript-estree': 8.48.0(typescript@5.9.3) + '@typescript-eslint/utils': 8.48.0(eslint@9.39.1)(typescript@5.9.3) + eslint: 9.39.1 typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -32249,7 +32137,7 @@ snapshots: spdx-correct: 3.2.0 spdx-expression-parse: 3.0.1 - validate-npm-package-name@6.0.2: {} + validate-npm-package-name@7.0.0: {} varint@6.0.0: {} diff --git a/projects/js-packages/eslint-changed/changelog/renovate-eslint-packages b/projects/js-packages/eslint-changed/changelog/renovate-eslint-packages new file mode 100644 index 000000000000..f2479b2800fa --- /dev/null +++ b/projects/js-packages/eslint-changed/changelog/renovate-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: New eslint sniff wants all peer deps to also be dev deps. Do that, even though we get eslint from the monorepo root. + + diff --git a/projects/js-packages/eslint-changed/package.json b/projects/js-packages/eslint-changed/package.json index 56179a892b8b..6e607c741e56 100644 --- a/projects/js-packages/eslint-changed/package.json +++ b/projects/js-packages/eslint-changed/package.json @@ -31,6 +31,7 @@ "parse-diff": "0.8.1" }, "devDependencies": { + "eslint": ">=7.0.0", "jest": "30.2.0" }, "peerDependencies": { diff --git a/projects/js-packages/eslint-config-target-es/CHANGELOG.md b/projects/js-packages/eslint-config-target-es/CHANGELOG.md index 54df4a05486b..fb2c5f5b43c9 100644 --- a/projects/js-packages/eslint-config-target-es/CHANGELOG.md +++ b/projects/js-packages/eslint-config-target-es/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [4.0.0] - 2025-08-06 ### Added -- Enable new rules from `eslint-plugin-es-x'. [#44288] +- Enable new rules from `eslint-plugin-es-x`. [#44288] ### Changed - Update package dependencies. [#43522] [#43578] [#44020] [#44148] [#44217] [#44276] [#44288] [#44289] [#44355] [#44508] diff --git a/projects/js-packages/eslint-config-target-es/changelog/renovate-eslint-packages#2 b/projects/js-packages/eslint-config-target-es/changelog/renovate-eslint-packages#2 new file mode 100644 index 000000000000..45028352a802 --- /dev/null +++ b/projects/js-packages/eslint-config-target-es/changelog/renovate-eslint-packages#2 @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Update package dependencies. diff --git a/projects/js-packages/eslint-config-target-es/changelog/renovate-eslint-packages#3 b/projects/js-packages/eslint-config-target-es/changelog/renovate-eslint-packages#3 new file mode 100644 index 000000000000..c370decbb055 --- /dev/null +++ b/projects/js-packages/eslint-config-target-es/changelog/renovate-eslint-packages#3 @@ -0,0 +1,4 @@ +Significance: major +Type: added + +Enable new rules from `eslint-plugin-es-x`. diff --git a/projects/js-packages/eslint-config-target-es/package.json b/projects/js-packages/eslint-config-target-es/package.json index 219ce93c2bdd..2f44b0840e68 100644 --- a/projects/js-packages/eslint-config-target-es/package.json +++ b/projects/js-packages/eslint-config-target-es/package.json @@ -45,8 +45,8 @@ }, "devDependencies": { "@wordpress/browserslist-config": "6.36.0", - "eslint": "9.38.0", - "eslint-plugin-es-x": "9.1.2", + "eslint": "9.39.1", + "eslint-plugin-es-x": "9.2.0", "globals": "16.5.0", "jest": "30.2.0" }, diff --git a/projects/js-packages/eslint-config-target-es/src/rulesMap.js b/projects/js-packages/eslint-config-target-es/src/rulesMap.js index 27ba961f46fe..cb4a59b92d29 100644 --- a/projects/js-packages/eslint-config-target-es/src/rulesMap.js +++ b/projects/js-packages/eslint-config-target-es/src/rulesMap.js @@ -6,6 +6,16 @@ module.exports = { 'no-asyncdisposablestack': 'javascript.builtins.AsyncDisposableStack.AsyncDisposableStack', 'no-disposablestack': 'javascript.builtins.DisposableStack.DisposableStack', 'no-error-iserror': 'javascript.builtins.Error.isError', + 'no-intl-locale-prototype-firstdayofweek': false, // No compat data yet. + 'no-intl-locale-prototype-getcalendars': 'javascript.builtins.Intl.Locale.getCalendars', + 'no-intl-locale-prototype-getcollations': 'javascript.builtins.Intl.Locale.getCollations', + 'no-intl-locale-prototype-gethourcycles': 'javascript.builtins.Intl.Locale.getHourCycles', + 'no-intl-locale-prototype-getnumberingsystems': + 'javascript.builtins.Intl.Locale.getNumberingSystems', + 'no-intl-locale-prototype-gettextinfo': 'javascript.builtins.Intl.Locale.getTextInfo', + 'no-intl-locale-prototype-gettimezones': 'javascript.builtins.Intl.Locale.getTimeZones', + 'no-intl-locale-prototype-getweekinfo': 'javascript.builtins.Intl.Locale.getWeekInfo', + 'no-iterator-concat': false, // No compat data yet. 'no-suppressederror': 'javascript.builtins.SuppressedError.SuppressedError', 'no-symbol-asyncdispose': 'javascript.builtins.Symbol.asyncDispose', 'no-symbol-dispose': 'javascript.builtins.Symbol.dispose', diff --git a/projects/js-packages/scan/changelog/renovate-eslint-packages b/projects/js-packages/scan/changelog/renovate-eslint-packages new file mode 100644 index 000000000000..97bc90c2a393 --- /dev/null +++ b/projects/js-packages/scan/changelog/renovate-eslint-packages @@ -0,0 +1,4 @@ +Significance: patch +Type: removed + +Remove peer dependency on `@wordpress/i18n`, as it already has a non-peer dependency on the package. diff --git a/projects/js-packages/scan/changelog/renovate-eslint-packages#2 b/projects/js-packages/scan/changelog/renovate-eslint-packages#2 new file mode 100644 index 000000000000..29b8c0b6e9e9 --- /dev/null +++ b/projects/js-packages/scan/changelog/renovate-eslint-packages#2 @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +`react` and `react-dom` should be peer dependencies, not direct dependencies. diff --git a/projects/js-packages/scan/package.json b/projects/js-packages/scan/package.json index 0e6df2bba5ba..5e622689868d 100644 --- a/projects/js-packages/scan/package.json +++ b/projects/js-packages/scan/package.json @@ -44,9 +44,7 @@ "@wordpress/i18n": "6.9.0", "@wordpress/icons": "11.3.0", "@wordpress/url": "4.36.0", - "debug": "4.4.1", - "react": "^18.2.0", - "react-dom": "^18.2.0" + "debug": "4.4.1" }, "devDependencies": { "@storybook/addon-docs": "10.0.8", @@ -57,11 +55,12 @@ "@types/react": "18.3.26", "jest": "30.2.0", "jest-environment-jsdom": "30.2.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", "storybook": "10.0.8", "typescript": "5.9.3" }, "peerDependencies": { - "@wordpress/i18n": "6.9.0", "react": "^18.2.0", "react-dom": "^18.2.0" } diff --git a/projects/js-packages/social-logos/changelog/renovate-eslint-packages b/projects/js-packages/social-logos/changelog/renovate-eslint-packages new file mode 100644 index 000000000000..29b8c0b6e9e9 --- /dev/null +++ b/projects/js-packages/social-logos/changelog/renovate-eslint-packages @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +`react` and `react-dom` should be peer dependencies, not direct dependencies. diff --git a/projects/js-packages/social-logos/package.json b/projects/js-packages/social-logos/package.json index 76deb0d908b1..237b6358e61c 100644 --- a/projects/js-packages/social-logos/package.json +++ b/projects/js-packages/social-logos/package.json @@ -31,14 +31,14 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "prop-types": "^15.8.1", - "react": "18.3.1", - "react-dom": "18.3.1" + "prop-types": "^15.8.1" }, "devDependencies": { "@types/react": "18.3.26", "@types/react-dom": "18.3.7", "glob": "11.1.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", "svg2ttf": "^6.0.3", "svgicons2svgfont": "^15.0.0", "svgo": "^4.0.0", diff --git a/projects/packages/videopress/changelog/renovate-eslint-packages b/projects/packages/videopress/changelog/renovate-eslint-packages new file mode 100644 index 000000000000..b86610b19a09 --- /dev/null +++ b/projects/packages/videopress/changelog/renovate-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Fix JS packages that were declared as both dependencies and dev dependencies. Note it doesn't really matter which is used for PHP packages. + + diff --git a/projects/packages/videopress/package.json b/projects/packages/videopress/package.json index 89ed6678ceef..e74bb6a9b1e5 100644 --- a/projects/packages/videopress/package.json +++ b/projects/packages/videopress/package.json @@ -27,11 +27,9 @@ "dependencies": { "@automattic/jetpack-analytics": "workspace:*", "@automattic/jetpack-api": "workspace:*", - "@automattic/jetpack-base-styles": "workspace:*", "@automattic/jetpack-components": "workspace:*", "@automattic/jetpack-connection": "workspace:*", "@automattic/jetpack-script-data": "workspace:*", - "@automattic/jetpack-shared-extension-utils": "workspace:*", "@wordpress/api-fetch": "7.36.0", "@wordpress/blob": "4.36.0", "@wordpress/block-editor": "15.9.0", diff --git a/projects/plugins/inspect/changelog/renovate-eslint-packages b/projects/plugins/inspect/changelog/renovate-eslint-packages new file mode 100644 index 000000000000..3449a8fc6f33 --- /dev/null +++ b/projects/plugins/inspect/changelog/renovate-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Fix JS packages that were declared as both dependencies and dev dependencies. Note it doesn't really matter which is used for plugins. + + diff --git a/projects/plugins/inspect/package.json b/projects/plugins/inspect/package.json index 8e83daf39a36..efc14a77faf8 100644 --- a/projects/plugins/inspect/package.json +++ b/projects/plugins/inspect/package.json @@ -23,9 +23,6 @@ "clean": "rm -rf app-ui/build/", "typecheck": "tsc --noEmit" }, - "dependencies": { - "tslib": "2.8.1" - }, "devDependencies": { "@babel/core": "7.28.4", "@babel/preset-env": "7.28.3", diff --git a/tools/js-tools/package.json b/tools/js-tools/package.json index 34ad0b81df44..3eaa1a29891a 100644 --- a/tools/js-tools/package.json +++ b/tools/js-tools/package.json @@ -14,10 +14,10 @@ "@babel/core": "7.28.4", "@babel/preset-react": "7.27.1", "@babel/preset-typescript": "7.27.1", - "@eslint/compat": "1.4.0", - "@eslint/eslintrc": "3.3.1", - "@eslint/js": "9.38.0", - "@eslint/json": "0.13.2", + "@eslint/compat": "1.4.1", + "@eslint/eslintrc": "3.3.3", + "@eslint/js": "9.39.1", + "@eslint/json": "0.14.0", "@octokit/auth-token": "5.1.2", "@octokit/rest": "21.1.1", "@tanstack/eslint-plugin-query": "5.91.2", @@ -29,25 +29,25 @@ "chalk": "5.6.2", "debug": "4.4.1", "enquirer": "2.4.1", - "eslint": "9.38.0", + "eslint": "9.39.1", "eslint-config-prettier": "10.1.8", "eslint-import-resolver-typescript": "4.4.4", "eslint-json-compat-utils": "0.2.1", - "eslint-plugin-es-x": "9.1.2", + "eslint-plugin-es-x": "9.2.0", "eslint-plugin-import": "2.32.0", - "eslint-plugin-jest": "29.0.1", + "eslint-plugin-jest": "29.2.1", "eslint-plugin-jest-dom": "5.5.0", "eslint-plugin-jsdoc": "51.4.1", "eslint-plugin-jsx-a11y": "6.10.2", "eslint-plugin-lodash": "8.0.0", "eslint-plugin-n": "17.23.1", - "eslint-plugin-package-json": "0.59.0", - "eslint-plugin-playwright": "2.2.2", + "eslint-plugin-package-json": "0.85.0", + "eslint-plugin-playwright": "2.4.0", "eslint-plugin-prettier": "5.5.4", "eslint-plugin-react": "7.37.5", "eslint-plugin-react-hooks": "5.2.0", - "eslint-plugin-svelte": "3.12.5", - "eslint-plugin-testing-library": "7.13.3", + "eslint-plugin-svelte": "3.13.0", + "eslint-plugin-testing-library": "7.13.5", "eslint-plugin-you-dont-need-lodash-underscore": "6.14.0", "glob": "11.1.0", "globals": "16.5.0", @@ -67,7 +67,7 @@ "svelte": "4.2.19", "svelte-eslint-parser": "1.1.3", "typescript": "5.9.3", - "typescript-eslint": "8.46.2", + "typescript-eslint": "8.48.0", "yaml": "2.2.2" } } From ba7a7cdd31fcf41f078793ce711de36eb95d9855 Mon Sep 17 00:00:00 2001 From: Enej Bajgoric Date: Tue, 2 Dec 2025 10:06:01 -0800 Subject: [PATCH 06/49] Form: Fixes the flickering when moving between different responses. (#46159) * Forms: fix the flickring of the dashboard as we move between different * changelog * Fix typo in changelog Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Mikael Korpela Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../packages/forms/changelog/fix-forms-flickering | 4 ++++ .../packages/forms/src/dashboard/inbox/stage/index.js | 11 +++-------- 2 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 projects/packages/forms/changelog/fix-forms-flickering diff --git a/projects/packages/forms/changelog/fix-forms-flickering b/projects/packages/forms/changelog/fix-forms-flickering new file mode 100644 index 000000000000..989502ac8409 --- /dev/null +++ b/projects/packages/forms/changelog/fix-forms-flickering @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Forms: Fix the flickering between the sidebar loading on different browser widths diff --git a/projects/packages/forms/src/dashboard/inbox/stage/index.js b/projects/packages/forms/src/dashboard/inbox/stage/index.js index 8741756503bd..af8dc633564f 100644 --- a/projects/packages/forms/src/dashboard/inbox/stage/index.js +++ b/projects/packages/forms/src/dashboard/inbox/stage/index.js @@ -46,7 +46,6 @@ import { import { useView, defaultLayouts } from './views.js'; const EMPTY_ARRAY = []; -const MOBILE_BREAKPOINT = 780; const updateSidebarWidth = () => { const wrapper = document.querySelector( '.dataviews-wrapper' ); @@ -94,7 +93,7 @@ export default function InboxView() { }, { box: 'border-box' } ); - const isMobile = containerWidth <= MOBILE_BREAKPOINT; + const selectedResponses = searchParams.get( 'r' ); const isMobileViewport = useViewportMatch( 'medium', '<' ); const [ isResponseModalOpen, setIsResponseModalOpen ] = useState( false ); @@ -227,11 +226,7 @@ export default function InboxView() { } // Update sidebar if item changed or needs refresh - if ( - ! sidePanelItem || - getItemId( sidePanelItem ) !== getItemId( recordToShow ) || - sidePanelItem !== recordToShow - ) { + if ( ! sidePanelItem || getItemId( sidePanelItem ) !== getItemId( recordToShow ) ) { setSidePanelItem( recordToShow ); } }, [ isMobileViewport, records, selection, sidePanelItem ] ); @@ -561,7 +556,7 @@ export default function InboxView() { sidePanelItem={ sidePanelItem } setSidePanelItem={ setSidePanelItem } isLoadingData={ isLoadingData } - isMobile={ isMobile } + isMobile={ isMobileViewport } onChangeSelection={ onChangeSelection } selection={ selection } /> From 598a4e27b12b975a19f956d1a3c699f25ca358ae Mon Sep 17 00:00:00 2001 From: Enej Bajgoric Date: Tue, 2 Dec 2025 10:06:17 -0800 Subject: [PATCH 07/49] Forms: removes a php warning on forms where the $page global is set to a non integer (#46141) * Forms: Fix contact form ID computation for non-integer page values Ensures the page number defaults to 1 if $page is not an integer when computing the contact form's ID, preventing potential issues with invalid page values. * changelog * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * user is_numeric instead --------- Co-authored-by: Miguel Lezama Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../forms/changelog/fix-php-warning-on-forms | 4 ++++ .../src/contact-form/class-contact-form.php | 3 ++- .../tests/php/contact-form/Contact_Form_Test.php | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 projects/packages/forms/changelog/fix-php-warning-on-forms diff --git a/projects/packages/forms/changelog/fix-php-warning-on-forms b/projects/packages/forms/changelog/fix-php-warning-on-forms new file mode 100644 index 000000000000..b68eddb8c208 --- /dev/null +++ b/projects/packages/forms/changelog/fix-php-warning-on-forms @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + + Forms: fix PHP warning when global gets overwritten diff --git a/projects/packages/forms/src/contact-form/class-contact-form.php b/projects/packages/forms/src/contact-form/class-contact-form.php index dd8d82bd07b6..27955204ebf9 100644 --- a/projects/packages/forms/src/contact-form/class-contact-form.php +++ b/projects/packages/forms/src/contact-form/class-contact-form.php @@ -169,7 +169,8 @@ public function __construct( $attributes, $content = null, $set_id = true ) { } if ( $set_id ) { - $attributes['id'] = self::compute_id( $attributes, $this->current_post, $page ); + $page_number = is_numeric( $page ) ? intval( $page ) : 1; + $attributes['id'] = self::compute_id( $attributes, $this->current_post, $page_number ); } $this->hash = sha1( wp_json_encode( $attributes ) ); diff --git a/projects/packages/forms/tests/php/contact-form/Contact_Form_Test.php b/projects/packages/forms/tests/php/contact-form/Contact_Form_Test.php index fda08567bd17..ad3b5e1cc963 100644 --- a/projects/packages/forms/tests/php/contact-form/Contact_Form_Test.php +++ b/projects/packages/forms/tests/php/contact-form/Contact_Form_Test.php @@ -2446,6 +2446,22 @@ public function test_get_default_to_with_invalid_post_author() { $this->assertEquals( get_option( 'admin_email' ), $result ); } + /** + * Tests that the constructor handles non-integer $page global without warnings. + */ + public function test_constructor_handles_non_integer_page_global() { + global $page; + $original_page = $page; + $page = 'not-an-integer'; // Simulating theme overwriting $page + + $attributes = array( 'to' => 'test@example.com' ); + $form = new Contact_Form( $attributes ); + + // Verify no warnings and form is created successfully + $this->assertInstanceOf( Contact_Form::class, $form ); + $page = $original_page; // Restore original value + } + /** * Tests get_default_to method with null post author ID. */ From 71523a9463ca15d05d4c8d7118dabcd576148885 Mon Sep 17 00:00:00 2001 From: upwardmomentum84 <93800099+upwardmomentum84@users.noreply.github.com> Date: Tue, 2 Dec 2025 13:30:22 -0500 Subject: [PATCH 08/49] Update class-jetpack-plugin-compatibility.php after using PHPCBF --- .../class-jetpack-plugin-compatibility.php | 239 +++++++++--------- 1 file changed, 120 insertions(+), 119 deletions(-) diff --git a/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php b/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php index fc58879551a2..960ec32378ac 100644 --- a/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php +++ b/projects/plugins/wpcomsh/class-jetpack-plugin-compatibility.php @@ -9,6 +9,7 @@ * Class Jetpack_Plugin_Compatibility. */ class Jetpack_Plugin_Compatibility { + /** * Plugin file locations and html messaging in the format: * array( @@ -21,144 +22,144 @@ class Jetpack_Plugin_Compatibility { public $incompatible_plugins = array( // "reset" - break/interfere with provided functionality. 'advanced-database-cleaner/advanced-db-cleaner.php' => '"advanced-database-cleaner" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'advanced-reset-wp/advanced-reset-wp.php' => '"advanced-reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'advanced-wp-reset/advanced-wp-reset.php' => '"advanced-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'backup/backup.php' => '"backup" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'better-wp-security/better-wp-security.php' => '"better-wp-security" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'database-browser/database-browser.php' => '"database-browser" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'extended-wp-reset/extended-wp-reset.php' => '"extended-wp-reset" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', - 'file-manager-advanced/file_manager_advanced.php' => '"file-manager-advanced" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'file-manager/file-manager.php' => '"file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'hide-my-wp/index.php' => '"hide-my-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'advanced-reset-wp/advanced-reset-wp.php' => '"advanced-reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'advanced-wp-reset/advanced-wp-reset.php' => '"advanced-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'backup/backup.php' => '"backup" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'better-wp-security/better-wp-security.php' => '"better-wp-security" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'database-browser/database-browser.php' => '"database-browser" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'extended-wp-reset/extended-wp-reset.php' => '"extended-wp-reset" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', + 'file-manager-advanced/file_manager_advanced.php' => '"file-manager-advanced" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'file-manager/file-manager.php' => '"file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'hide-my-wp/index.php' => '"hide-my-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'plugins-garbage-collector/plugins-garbage-collector.php' => '"plugins-garbage-collector" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'reset-wp/reset-wp.php' => '"reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'reset/data_reset.php' => '"reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'secure-file-manager/secure-file-manager.php' => '"secure-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'ultimate-reset/ultimate-reset.php' => '"ultimate-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'ultimate-wp-reset/ultimate-wordpress-reset.php' => '"ultimate-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'username-changer/class-username-changer.php' => '"username-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'reset-wp/reset-wp.php' => '"reset-wp" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'reset/data_reset.php' => '"reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'secure-file-manager/secure-file-manager.php' => '"secure-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'ultimate-reset/ultimate-reset.php' => '"ultimate-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'ultimate-wp-reset/ultimate-wordpress-reset.php' => '"ultimate-wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'username-changer/class-username-changer.php' => '"username-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'vamtam-offline-jetpack/vamtam-offline-jetpack.php' => '"vamtam-offline-jetpack" has been deactivated, an active Jetpack Connection is required for your site to operate properly on WordPress.com.', - 'wd-youtube/wd-youtube.php' => '"wd-youtube" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', - 'wordpress-database-reset/wp-reset.php' => '"wordpress-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wordpress-reset/wordpress-reset.php' => '"wordpress-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-automatic/wp-automatic.php' => '"wp-automatic" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', - 'wp-clone-by-wp-academy/wpclone.php' => '"wp-clone-by-wp-academy" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-config-file-editor/wp-config-file-editor.php' => '"wp-config-file-editor" has been deactivated, it messes up data necessary to manage your site and is not supported on WordPress.com.', - 'wp-dbmanager/wp-dbmanager.php' => '"wp-dbmanager" has been deactivated, it messes up data necessary to manage your site and is not supported on WordPress.com.', - 'wp-file-manager/file_folder_manager.php' => '"wp-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-phpmyadmin-extension/index.php' => '"wp-phpmyadmin-extension" has been deactivated, it interferes with site operation. You can access phpMyAdmin under Settings > Hosting Config', - 'wp-prefix-changer/index.php' => '"wp-prefix-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-reset/wp-reset.php' => '"wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wd-youtube/wd-youtube.php' => '"wd-youtube" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', + 'wordpress-database-reset/wp-reset.php' => '"wordpress-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wordpress-reset/wordpress-reset.php' => '"wordpress-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-automatic/wp-automatic.php' => '"wp-automatic" has been deactivated, it interferes with site operation and is not supported on WordPress.com.', + 'wp-clone-by-wp-academy/wpclone.php' => '"wp-clone-by-wp-academy" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-config-file-editor/wp-config-file-editor.php' => '"wp-config-file-editor" has been deactivated, it interferes with data necessary to manage your site and is not supported on WordPress.com.', + 'wp-dbmanager/wp-dbmanager.php' => '"wp-dbmanager" has been deactivated, it interferes with data necessary to manage your site and is not supported on WordPress.com.', + 'wp-file-manager/file_folder_manager.php' => '"wp-file-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-phpmyadmin-extension/index.php' => '"wp-phpmyadmin-extension" has been deactivated, it interferes with site operation. You can access phpMyAdmin under Settings > Hosting Config', + 'wp-prefix-changer/index.php' => '"wp-prefix-changer" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-reset/wp-reset.php' => '"wp-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', 'wp-uninstaller-by-azed/wp-uninstaller-by-azed.php' => '"wp-uninstaller-by-azed" is not supported on WordPress.com.', - 'wpmu-database-reset/wpmu-database-reset.php' => '"wpmu-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wps-hide-login/wps-hide-login.php' => '"wps-hide-login" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'z-inventory-manager/z-inventory-manager.php' => '"z-inventory-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-downgrade/wp-downgrade.php' => '"wp-downgrade" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wpmu-database-reset/wpmu-database-reset.php' => '"wpmu-database-reset" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wps-hide-login/wps-hide-login.php' => '"wps-hide-login" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'z-inventory-manager/z-inventory-manager.php' => '"z-inventory-manager" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-downgrade/wp-downgrade.php' => '"wp-downgrade" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', // Backup. - 'backup-wd/backup-wd.php' => '"backup-wd" has been deactivated, WordPress.com handles managing your site backups for you.', - 'backwpup/backwpup.php' => '"backwpup" has been deactivated, WordPress.com handles managing your site backups for you.', - 'backwpup-pro/backwpup.php' => '"backwpup-pro" has been deactivated, WordPress.com handles managing your site backups for you.', - 'duplicator/duplicator.php' => '"duplicator" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'duplicator-pro/duplicator-pro.php' => '"duplicator-pro" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'jetpack-backup/jetpack-backup.php' => '"jetpack-backup" has been deactivated, WordPress.com handles managing your site backups for you.', - 'siteground-migrator/siteground-migrator.php' => '"siteground-migrator" has been deactivated, WordPress.com handles managing your site backups for you.', - 'wp-backitup/wp-backitup.php' => '"wp-backitup" has been deactivated, WordPress.com handles managing your site backups for you.', + 'backup-wd/backup-wd.php' => '"backup-wd" has been deactivated, WordPress.com handles managing your site backups for you.', + 'backwpup/backwpup.php' => '"backwpup" has been deactivated, WordPress.com handles managing your site backups for you.', + 'backwpup-pro/backwpup.php' => '"backwpup-pro" has been deactivated, WordPress.com handles managing your site backups for you.', + 'duplicator/duplicator.php' => '"duplicator" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'duplicator-pro/duplicator-pro.php' => '"duplicator-pro" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'jetpack-backup/jetpack-backup.php' => '"jetpack-backup" has been deactivated, WordPress.com handles managing your site backups for you.', + 'siteground-migrator/siteground-migrator.php' => '"siteground-migrator" has been deactivated, WordPress.com handles managing your site backups for you.', + 'wp-backitup/wp-backitup.php' => '"wp-backitup" has been deactivated, WordPress.com handles managing your site backups for you.', // Caching/performance. - 'breeze/breeze.php' => '"breeze" has been deactivated, WordPress.com automatically handles caching for your site.', - 'cache-enabler/cache-enabler.php' => '"cache-enabler" has been deactivated, WordPress.com automatically handles caching for your site.', - 'comet-cache/comet-cache.php' => '"comet-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'hyper-cache/plugin.php' => '"hyper-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'jch-optimize/jch-optimize.php' => '"jch-optimize" has been deactivated, WordPress.com automatically handles caching for your site.', - 'object-cache-pro/object-cache-pro.php' => '"object-cache-pro" has been deactivated, WordPress.com automatically handles caching for your site.', - 'performance-lab/load.php' => '"performance-lab" has been deactivated, WordPress.com automatically handles caching and database optimization for your site.', - 'powered-cache/powered-cache.php' => '"powered-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'quick-cache/quick-cache.php' => '"quick-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'redis-cache/redis-cache.php' => '"redis-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'sg-cachepress/sg-cachepress.php' => '"sg-cachepress" has been deactivated, WordPress.com automatically handles caching for your site.', - 'w3-total-cache/w3-total-cache.php' => '"w3-total-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-cache/wp-cache.php' => '"wp-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-fastest-cache/wpFastestCache.php' => '"wp-fastest-cache" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-optimizer/wp-optimizer.php' => '"wp-optimizer" has been deactivated, "performance" related plugins may break your site or cause issues and are not supported on WordPress.com.', // p9F6qB-66o-p2 - 'wp-scss/wp-scss.php' => '"wp-scss" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-speed-of-light/wp-speed-of-light.php' => '"wp-speed-of-light" has been deactivated, WordPress.com automatically handles caching for your site.', - 'wp-super-cache/wp-cache.php' => '"wp-super-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'breeze/breeze.php' => '"breeze" has been deactivated, WordPress.com automatically handles caching for your site.', + 'cache-enabler/cache-enabler.php' => '"cache-enabler" has been deactivated, WordPress.com automatically handles caching for your site.', + 'comet-cache/comet-cache.php' => '"comet-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'hyper-cache/plugin.php' => '"hyper-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'jch-optimize/jch-optimize.php' => '"jch-optimize" has been deactivated, WordPress.com automatically handles caching for your site.', + 'object-cache-pro/object-cache-pro.php' => '"object-cache-pro" has been deactivated, WordPress.com automatically handles caching for your site.', + 'performance-lab/load.php' => '"performance-lab" has been deactivated, WordPress.com automatically handles caching and database optimization for your site.', + 'powered-cache/powered-cache.php' => '"powered-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'quick-cache/quick-cache.php' => '"quick-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'redis-cache/redis-cache.php' => '"redis-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'sg-cachepress/sg-cachepress.php' => '"sg-cachepress" has been deactivated, WordPress.com automatically handles caching for your site.', + 'w3-total-cache/w3-total-cache.php' => '"w3-total-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-cache/wp-cache.php' => '"wp-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-fastest-cache/wpFastestCache.php' => '"wp-fastest-cache" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-optimizer/wp-optimizer.php' => '"wp-optimizer" has been deactivated, "performance" related plugins may break your site or cause issues and are not supported on WordPress.com.', + 'wp-scss/wp-scss.php' => '"wp-scss" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-speed-of-light/wp-speed-of-light.php' => '"wp-speed-of-light" has been deactivated, WordPress.com automatically handles caching for your site.', + 'wp-super-cache/wp-cache.php' => '"wp-super-cache" has been deactivated, WordPress.com automatically handles caching for your site.', // SQL heavy. - 'another-wordpress-classifieds-plugin/awpcp.php' => '"another-wordpress-classifieds-plugin" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'broken-link-checker/broken-link-checker.php' => '"broken-link-checker" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'another-wordpress-classifieds-plugin/awpcp.php' => '"another-wordpress-classifieds-plugin" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'broken-link-checker/broken-link-checker.php' => '"broken-link-checker" has been deactivated, it is known to cause severe database performance issues and is not supported.', 'mass-pagesposts-creator/mass-pages-posts-creator.php' => '"mass-pagesposts-creator" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'native-ads-adnow/adnow-widget.php' => '"native-ads-now" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'ol_scrapes/ol_scrapes.php' => '"ol_scrapes" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'page-visit-counter/page-visit-counter.php' => '"page-visit-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'post-views-counter/post-views-counter.php' => '"post-views-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'tokenad/token-ad.php' => '"tokenad" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'top-10/top-10.php' => '"top-10" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'userpro/index.php' => '"userpro" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'native-ads-adnow/adnow-widget.php' => '"native-ads-now" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'ol_scrapes/ol_scrapes.php' => '"ol_scrapes" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'page-visit-counter/page-visit-counter.php' => '"page-visit-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'post-views-counter/post-views-counter.php' => '"post-views-counter" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'tokenad/token-ad.php' => '"tokenad" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'top-10/top-10.php' => '"top-10" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'userpro/index.php' => '"userpro" has been deactivated, it is known to cause severe database performance issues and is not supported.', 'wordpress-popular-posts/wordpress-popular-posts.php' => '"wordpress-popular-posts" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-cerber/wp-cerber.php' => '"wp-cerber" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-inject/wpinject.php' => '"wp-inject" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-postviews/wp-postviews.php' => '"wp-postviews" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'wp-rss-aggregator/wp-rss-aggregator.php' => '"wp-rss-aggregator" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-rss-feed-to-post/wp-rss-feed-to-post.php' => '"wp-rss-feed-to-post" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-rss-wordai/wp-rss-wordai.php' => '"wp-rss-wordai" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-session-manager/wp-session-manager.php' => '"wp-session-manager" has been deactivated, it is known to cause severe database performance issues and is not supported.', - 'wp-slimstat/wp-slimstat.php' => '"wp-slimstat" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'wp-statistics/wp-statistics.php' => '"wp-statistics" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'wp-ulike/wp-ulike.php' => '"wp-ulike" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', - 'WPRobot5/wprobot.php' => '"WPRobot5" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'wp-cerber/wp-cerber.php' => '"wp-cerber" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-inject/wpinject.php' => '"wp-inject" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-postviews/wp-postviews.php' => '"wp-postviews" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'wp-rss-aggregator/wp-rss-aggregator.php' => '"wp-rss-aggregator" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-rss-feed-to-post/wp-rss-feed-to-post.php' => '"wp-rss-feed-to-post" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-rss-wordai/wp-rss-wordai.php' => '"wp-rss-wordai" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-session-manager/wp-session-manager.php' => '"wp-session-manager" has been deactivated, it is known to cause severe database performance issues and is not supported.', + 'wp-slimstat/wp-slimstat.php' => '"wp-slimstat" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'wp-statistics/wp-statistics.php' => '"wp-statistics" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'wp-ulike/wp-ulike.php' => '"wp-ulike" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', + 'WPRobot5/wprobot.php' => '"WPRobot5" has been deactivated, plugins that insert or update the database on page load can cause severe performance issues for your site and are not supported.', // Security. - 'antihacker/antihacker.php' => '"antihacker" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'disable-xml-rpc-api/disable-xml-rpc-api.php' => '"disable-xml-rpc-api" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'manage-xml-rpc/manage-xml-rpc.php' => '"manage-xml-rpc" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'one-click-ssl/ssl.php' => '"one-click-ssl" has been deactivated, because it is not supported on WordPress.com.', - 'really-simple-ssl/rlrsssl-really-simple-ssl.php' => '"really-simple-ssl" is not supported on WordPress.com.', - 'really-simple-ssl-pro/really-simple-ssl-pro.php' => '"really-simple-ssl-pro" is not supported on WordPress.com.', - 'sg-security/sg-security.php' => '"sg-security" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'stopbadbots/stopbadbots.php' => '"stopbadbots" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'antihacker/antihacker.php' => '"antihacker" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'disable-xml-rpc-api/disable-xml-rpc-api.php' => '"disable-xml-rpc-api" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', + 'manage-xml-rpc/manage-xml-rpc.php' => '"manage-xml-rpc" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', + 'one-click-ssl/ssl.php' => '"one-click-ssl" has been deactivated, because it is not supported on WordPress.com.', + 'really-simple-ssl/rlrsssl-really-simple-ssl.php' => '"really-simple-ssl" is not supported on WordPress.com.', + 'really-simple-ssl-pro/really-simple-ssl-pro.php' => '"really-simple-ssl-pro" is not supported on WordPress.com.', + 'sg-security/sg-security.php' => '"sg-security" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'stopbadbots/stopbadbots.php' => '"stopbadbots" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', 'wee-remove-xmlrpc-methods/wee-remove-xmlrpc-methods.php' => '"wee-remove-xmlrpc-methods" has been deactivated, XML-RPC is required for your Jetpack Connection on WordPress.com.', - 'wordfence/wordfence.php' => '"wordfence" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'wp-hide-security-enhancer/wp-hide.php' => '"wp-hide-security-enhancer" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', - 'wp-simple-firewall/wp-simple-firewall.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', - 'wp-simple-firewall/icwp-wpsf.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wordfence/wordfence.php' => '"wordfence" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'wp-hide-security-enhancer/wp-hide.php' => '"wp-hide-security-enhancer" has been deactivated, "security" related plugins may break your site or cause performance issues for your site and are not supported on WordPress.com.', + 'wp-simple-firewall/wp-simple-firewall.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', + 'wp-simple-firewall/icwp-wpsf.php' => '"wp-simple-firewall" has been deactivated, it deletes data necessary to manage your site and is not supported on WordPress.com.', // Spam. - 'e-mail-broadcasting/e-mail-broadcasting.php' => '"e-mail-broadcasting" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', - 'mailit/mailit.php' => '"mailit" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', - 'send-email-from-admin/send-email-from-admin.php' => '"send-email-from-admin" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', + 'e-mail-broadcasting/e-mail-broadcasting.php' => '"e-mail-broadcasting" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', + 'mailit/mailit.php' => '"mailit" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', + 'send-email-from-admin/send-email-from-admin.php' => '"send-email-from-admin" has been deactivated, plugins that support sending e-mails in bulk are not supported on WordPress.com.', // Misc. 'adult-mass-photos-downloader/adult-mass-photos-downloader.php' => '"adult-mass-photos-downloader" is not supported on WordPress.com.', 'adult-mass-videos-embedder/adult-mass-videos-embedder.php' => '"adult-mass-videos-embedder" is not supported on WordPress.com.', - 'ari-adminer/ari-adminer.php' => '"ari-adminer" is not supported on WordPress.com.', - 'automatic-video-posts' => '"automatic-video-posts" is not supported on WordPress.com.', - 'blogmatic-poster/index.php' => '"blogmatic-poster" is not supported on WordPress.com.', - 'blogmatic/index.php' => '"blogmatic" is not supported on WordPress.com.', - 'bwp-minify/bwp-minify.php' => '"bwp-minify" is not supported on WordPress.com.', - 'db-access-adminer/db-access-adminer.php' => '"db-access-adminer" is not supported on WordPress.com.', - 'fast-velocity-minify/fvm.php' => '"fast-velocity-minify" is not supported on WordPress.com.', - 'nginx-helper/nginx-helper.php' => '"nginx-helper" is not supported on WordPress.com.', - 'p3/p3.php' => '"p3" is not supported on WordPress.com.', - 'pexlechris-adminer/pexlechris-adminer.php' => '"pexlechris-adminer" is not supported on WordPress.com.', - 'plugin-detective/plugin-detective.php' => '"plugin-detective" is not supported on WordPress.com.', - 'porn-embed/Porn-Embed.php' => '"porn-embed" is not supported on WordPress.com.', - 'propellerads-official/propeller-ads.php' => '"propellerads-official" is not supported on WordPress.com.', - 'trafficzion/trafficzion.php' => '"trafficzion" is not supported on WordPress.com.', - 'tubeace/tubeace.php' => '"tubeace" is not supported on WordPress.com.', - 'woozone/plugin.php' => '"woozone" is not supported on WordPress.com.', - 'wp-cleanfix/index.php' => '"wp-cleanfix" is not supported on WordPress.com.', - 'wp-file-upload/wordpress_file_upload.php' => '"wp-file-upload" is not supported on WordPress.com.', - 'wp-monero-miner-pro/monero-miner-pro.php' => '"wp-monero-miner-pro" is not supported on WordPress.com.', + 'ari-adminer/ari-adminer.php' => '"ari-adminer" is not supported on WordPress.com.', + 'automatic-video-posts/automatic-video-posts.php' => '"automatic-video-posts" is not supported on WordPress.com.', + 'blogmatic-poster/index.php' => '"blogmatic-poster" is not supported on WordPress.com.', + 'blogmatic/index.php' => '"blogmatic" is not supported on WordPress.com.', + 'bwp-minify/bwp-minify.php' => '"bwp-minify" is not supported on WordPress.com.', + 'db-access-adminer/db-access-adminer.php' => '"db-access-adminer" is not supported on WordPress.com.', + 'fast-velocity-minify/fvm.php' => '"fast-velocity-minify" is not supported on WordPress.com.', + 'nginx-helper/nginx-helper.php' => '"nginx-helper" is not supported on WordPress.com.', + 'p3/p3.php' => '"p3" is not supported on WordPress.com.', + 'pexlechris-adminer/pexlechris-adminer.php' => '"pexlechris-adminer" is not supported on WordPress.com.', + 'plugin-detective/plugin-detective.php' => '"plugin-detective" is not supported on WordPress.com.', + 'porn-embed/Porn-Embed.php' => '"porn-embed" is not supported on WordPress.com.', + 'propellerads-official/propeller-ads.php' => '"propellerads-official" is not supported on WordPress.com.', + 'trafficzion/trafficzion.php' => '"trafficzion" is not supported on WordPress.com.', + 'tubeace/tubeace.php' => '"tubeace" is not supported on WordPress.com.', + 'woozone/plugin.php' => '"woozone" is not supported on WordPress.com.', + 'wp-cleanfix/index.php' => '"wp-cleanfix" is not supported on WordPress.com.', + 'wp-file-upload/wordpress_file_upload.php' => '"wp-file-upload" is not supported on WordPress.com.', + 'wp-monero-miner-pro/monero-miner-pro.php' => '"wp-monero-miner-pro" is not supported on WordPress.com.', 'wp-optimize-by-xtraffic/wp-optimize-by-xtraffic.php' => '"wp-optimize-by-xtraffic" is not supported on WordPress.com.', - 'wpematico/wpematico.php' => '"wpematico" is not supported on WordPress.com.', - 'wpstagecoach/wpstagecoach.php' => '"wpstagecoach" is not supported on WordPress.com.', // p9F6qB-66o-p2 - 'yuzo-related-post/yuzo.php' => '"yuzo-related-post" is not supported on WordPress.com.', - 'zapp-proxy-server/zapp-proxy-server.php' => '"zapp-proxy-server" is not supported on WordPress.com.', + 'wpematico/wpematico.php' => '"wpematico" is not supported on WordPress.com.', + 'wpstagecoach/wpstagecoach.php' => '"wpstagecoach" is not supported on WordPress.com.', + 'yuzo-related-post/yuzo.php' => '"yuzo-related-post" is not supported on WordPress.com.', + 'zapp-proxy-server/zapp-proxy-server.php' => '"zapp-proxy-server" is not supported on WordPress.com.', // CRM. - 'civicrm/civicrm.php' => '"civicrm" is not supported on WordPress.com.', // p9F6qB-66o-p2 + 'civicrm/civicrm.php' => '"civicrm" is not supported on WordPress.com.', ); /** @@ -267,9 +268,9 @@ public function disable_plugin_install_link( $action_links, $plugin ) { $needle = "{$plugin['slug']}/"; foreach ( $this->incompatible_plugins as $disallowed_plugin => $message ) { /* - * The naming convention of $disallowed_plugin is /.php so we are checking if - * the string $needle is included into $disallowed_plugin from the `0` position. - */ + * The naming convention of $disallowed_plugin is /.php so we are checking if + * the string $needle is included into $disallowed_plugin from the `0` position. + */ if ( strpos( $disallowed_plugin, $needle ) === 0 ) { $action_links = array( 'Not Supported' ); break; @@ -341,7 +342,7 @@ protected function get_disallowed_plugins(): array { /** * Helper function to determine the status of a standard plugin. * - * @param string $plugin_file The full plugin filename. + * @param string $plugin_file The full plugin filename. * @return 'active-network'|'active'|'inactive' */ protected function get_plugin_status( string $plugin_file ): string { From 52cd81d56e33ba86200ea17afd398d5c99a1545b Mon Sep 17 00:00:00 2001 From: Erick Danzer Date: Tue, 2 Dec 2025 13:27:54 -0700 Subject: [PATCH 09/49] Forms: add integration display filters (re-do) (#46156) --- .../add-forms-integrations-display-filters | 4 +++ .../forms/src/blocks/contact-form/edit.tsx | 5 +-- .../forms/src/class-jetpack-forms.php | 36 +++++++++++++++++++ .../class-contact-form-endpoint.php | 34 +++++++++--------- .../src/dashboard/components/layout/index.tsx | 3 +- .../forms/src/dashboard/inbox/stage/index.js | 7 ++-- projects/packages/forms/src/types/index.ts | 4 +++ .../add-forms-integrations-display-filters | 4 +++ 8 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 projects/packages/forms/changelog/add-forms-integrations-display-filters create mode 100644 projects/plugins/jetpack/changelog/add-forms-integrations-display-filters diff --git a/projects/packages/forms/changelog/add-forms-integrations-display-filters b/projects/packages/forms/changelog/add-forms-integrations-display-filters new file mode 100644 index 000000000000..44d20918cff6 --- /dev/null +++ b/projects/packages/forms/changelog/add-forms-integrations-display-filters @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Forms: add integrations display filters. diff --git a/projects/packages/forms/src/blocks/contact-form/edit.tsx b/projects/packages/forms/src/blocks/contact-form/edit.tsx index 2fefa15ed5fd..1979e448941c 100644 --- a/projects/packages/forms/src/blocks/contact-form/edit.tsx +++ b/projects/packages/forms/src/blocks/contact-form/edit.tsx @@ -179,8 +179,9 @@ function JetpackContactFormEdit( { notificationRecipients, webhooks, } = attributes; - const showFormIntegrations = useConfigValue( 'isIntegrationsEnabled' ); + const isIntegrationsEnabled = useConfigValue( 'isIntegrationsEnabled' ); const showWebhooks = useConfigValue( 'isWebhooksEnabled' ) && hasFeatureFlag( 'form-webhooks' ); + const showBlockIntegrations = useConfigValue( 'showBlockIntegrations' ); const instanceId = useInstanceId( JetpackContactFormEdit ); // Backward compatibility for the deprecated customThankyou attribute. @@ -921,7 +922,7 @@ function JetpackContactFormEdit( { setAttributes={ setAttributes } /> - { showFormIntegrations && ( + { isIntegrationsEnabled && showBlockIntegrations && ( }> diff --git a/projects/packages/forms/src/class-jetpack-forms.php b/projects/packages/forms/src/class-jetpack-forms.php index b69f726cd7ae..9684c0bb9923 100644 --- a/projects/packages/forms/src/class-jetpack-forms.php +++ b/projects/packages/forms/src/class-jetpack-forms.php @@ -138,4 +138,40 @@ public static function is_webhooks_enabled() { */ return apply_filters( 'jetpack_forms_webhooks_enabled', false ); } + + /** + * Returns true if the Integrations UI should be shown in the Forms dashboard. + * + * @since $$next-version$$ + * + * @return boolean + */ + public static function show_dashboard_integrations() { + /** + * Whether to show Integrations UI in the Forms dashboard. + * + * @since $$next-version$$ + * + * @param bool true Whether to show the Integrations UI in the dashboard. Default true. + */ + return apply_filters( 'jetpack_forms_show_dashboard_integrations', true ); + } + + /** + * Returns true if the Integrations UI should be shown in the Form block editor. + * + * @since $$next-version$$ + * + * @return boolean + */ + public static function show_block_integrations() { + /** + * Whether to show Integrations UI in the Form block editor. + * + * @since $$next-version$$ + * + * @param bool true Whether to show the Integrations UI in the editor. Default true. + */ + return apply_filters( 'jetpack_forms_show_block_integrations', true ); + } } diff --git a/projects/packages/forms/src/contact-form/class-contact-form-endpoint.php b/projects/packages/forms/src/contact-form/class-contact-form-endpoint.php index 6c35c7249727..d4149a572d10 100644 --- a/projects/packages/forms/src/contact-form/class-contact-form-endpoint.php +++ b/projects/packages/forms/src/contact-form/class-contact-form-endpoint.php @@ -1484,24 +1484,26 @@ public function update_read_status( $request ) { public function get_forms_config( WP_REST_Request $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable $config = array( // From jpFormsBlocks in class-contact-form-block.php. - 'formsResponsesUrl' => Forms_Dashboard::get_forms_admin_url(), - 'isMailPoetEnabled' => Jetpack_Forms::is_mailpoet_enabled(), - 'isHostingerReachEnabled' => Jetpack_Forms::is_hostinger_reach_enabled(), + 'formsResponsesUrl' => Forms_Dashboard::get_forms_admin_url(), + 'isMailPoetEnabled' => Jetpack_Forms::is_mailpoet_enabled(), + 'isHostingerReachEnabled' => Jetpack_Forms::is_hostinger_reach_enabled(), // From config in class-dashboard.php. - 'blogId' => get_current_blog_id(), - 'gdriveConnectSupportURL' => esc_url( Redirect::get_url( 'jetpack-support-contact-form-export' ) ), - 'pluginAssetsURL' => Jetpack_Forms::assets_url(), - 'siteURL' => ( new Status() )->get_site_suffix(), - 'hasFeedback' => ( new Forms_Dashboard() )->has_feedback(), - 'isIntegrationsEnabled' => Jetpack_Forms::is_integrations_enabled(), - 'isWebhooksEnabled' => Jetpack_Forms::is_webhooks_enabled(), - 'dashboardURL' => Forms_Dashboard::get_forms_admin_url(), + 'blogId' => get_current_blog_id(), + 'gdriveConnectSupportURL' => esc_url( Redirect::get_url( 'jetpack-support-contact-form-export' ) ), + 'pluginAssetsURL' => Jetpack_Forms::assets_url(), + 'siteURL' => ( new Status() )->get_site_suffix(), + 'hasFeedback' => ( new Forms_Dashboard() )->has_feedback(), + 'isIntegrationsEnabled' => Jetpack_Forms::is_integrations_enabled(), + 'isWebhooksEnabled' => Jetpack_Forms::is_webhooks_enabled(), + 'showDashboardIntegrations' => Jetpack_Forms::show_dashboard_integrations(), + 'showBlockIntegrations' => Jetpack_Forms::show_block_integrations(), + 'dashboardURL' => Forms_Dashboard::get_forms_admin_url(), // New data. - 'canInstallPlugins' => current_user_can( 'install_plugins' ), - 'canActivatePlugins' => current_user_can( 'activate_plugins' ), - 'exportNonce' => wp_create_nonce( 'feedback_export' ), - 'newFormNonce' => wp_create_nonce( 'create_new_form' ), - 'emptyTrashDays' => defined( 'EMPTY_TRASH_DAYS' ) ? EMPTY_TRASH_DAYS : 0, + 'canInstallPlugins' => current_user_can( 'install_plugins' ), + 'canActivatePlugins' => current_user_can( 'activate_plugins' ), + 'exportNonce' => wp_create_nonce( 'feedback_export' ), + 'newFormNonce' => wp_create_nonce( 'create_new_form' ), + 'emptyTrashDays' => defined( 'EMPTY_TRASH_DAYS' ) ? EMPTY_TRASH_DAYS : 0, ); return rest_ensure_response( $config ); diff --git a/projects/packages/forms/src/dashboard/components/layout/index.tsx b/projects/packages/forms/src/dashboard/components/layout/index.tsx index 5898d1ce17a4..7a0423aa864c 100644 --- a/projects/packages/forms/src/dashboard/components/layout/index.tsx +++ b/projects/packages/forms/src/dashboard/components/layout/index.tsx @@ -18,6 +18,7 @@ const Layout = () => { const [ isSm ] = useBreakpointMatch( 'sm' ); const enableIntegrationsTab = useConfigValue( 'isIntegrationsEnabled' ); + const showDashboardIntegrations = useConfigValue( 'showDashboardIntegrations' ); const isLoadingConfig = enableIntegrationsTab === undefined; const isIntegrationsOpen = location.pathname === '/integrations'; @@ -32,7 +33,7 @@ const Layout = () => {
{ ! isLoadingConfig && } - { isIntegrationsOpen && } + { isIntegrationsOpen && showDashboardIntegrations && }
); diff --git a/projects/packages/forms/src/dashboard/inbox/stage/index.js b/projects/packages/forms/src/dashboard/inbox/stage/index.js index af8dc633564f..05248db7bc11 100644 --- a/projects/packages/forms/src/dashboard/inbox/stage/index.js +++ b/projects/packages/forms/src/dashboard/inbox/stage/index.js @@ -124,7 +124,8 @@ export default function InboxView() { return setupSidebarWidthObserver(); }, [] ); - const enableIntegrationsTab = useConfigValue( 'isIntegrationsEnabled' ); + const isIntegrationsEnabled = useConfigValue( 'isIntegrationsEnabled' ); + const showDashboardIntegrations = useConfigValue( 'showDashboardIntegrations' ); const { setCurrentQuery, @@ -471,13 +472,13 @@ export default function InboxView() { } else { headerActionsArray.unshift( ); // Only show Create Form and Integrations buttons on inbox (when not in trash or spam) - if ( enableIntegrationsTab ) { + if ( isIntegrationsEnabled && showDashboardIntegrations ) { headerActionsArray.unshift( ); } } return headerActionsArray; - }, [ statusFilter, enableIntegrationsTab ] ); + }, [ statusFilter, isIntegrationsEnabled, showDashboardIntegrations ] ); const pageContent = ( Date: Tue, 2 Dec 2025 12:53:14 -0800 Subject: [PATCH 10/49] Forms: Fix preview only image formats and PDF to open in the browser. (#46140) * Forms: Check that the file is previable * Restrict previewable file types to images and PDF Removed support for BMP and TIFF file previews and updated logic to only allow image formats and PDF files to be previewed. Also simplified the previewable file check in Feedback_Field by removing the Jetpack function call. * changelog * Update projects/plugins/jetpack/changelog/fix-preview-only-image-formats Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update projects/packages/forms/changelog/fix-preview-only-image-formats Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update projects/packages/forms/src/contact-form/class-feedback-field.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Refactor file preview check to use MIME type Replaces file extension-based previewability check with a MIME type-based approach in unauth-file-upload.php. Adds unit tests for is_file_type_previable to ensure correct behavior for various MIME types. * Fix spelling --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../changelog/fix-preview-only-image-formats | 5 ++ .../src/contact-form/class-feedback-field.php | 1 + .../changelog/fix-preview-only-image-formats | 5 ++ .../tests/php/Unauth_File_Upload_Test.php | 76 +++++++++++++++++++ .../plugins/jetpack/unauth-file-upload.php | 22 +++++- 5 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 projects/packages/forms/changelog/fix-preview-only-image-formats create mode 100644 projects/plugins/jetpack/changelog/fix-preview-only-image-formats create mode 100644 projects/plugins/jetpack/tests/php/Unauth_File_Upload_Test.php diff --git a/projects/packages/forms/changelog/fix-preview-only-image-formats b/projects/packages/forms/changelog/fix-preview-only-image-formats new file mode 100644 index 000000000000..387306e093eb --- /dev/null +++ b/projects/packages/forms/changelog/fix-preview-only-image-formats @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Restricts inline file preview to only image formats and PDFs, forces download for other file types for security. + + diff --git a/projects/packages/forms/src/contact-form/class-feedback-field.php b/projects/packages/forms/src/contact-form/class-feedback-field.php index 20570522dff7..bcff0ba7fa83 100644 --- a/projects/packages/forms/src/contact-form/class-feedback-field.php +++ b/projects/packages/forms/src/contact-form/class-feedback-field.php @@ -501,6 +501,7 @@ public function has_file() { /** * Checks if the file is previewable based on its type or extension. + * Only image formats are allowed to be previewed in the modal. PDFs may be previewed in the browser elsewhere, but not in the modal. * * @param array $file File data. * @return bool True if the file is previewable, false otherwise. diff --git a/projects/plugins/jetpack/changelog/fix-preview-only-image-formats b/projects/plugins/jetpack/changelog/fix-preview-only-image-formats new file mode 100644 index 000000000000..8ffe4cdb67a0 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-preview-only-image-formats @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Restricts inline file preview to only image formats and PDFs, forces download for other file types for security. + + diff --git a/projects/plugins/jetpack/tests/php/Unauth_File_Upload_Test.php b/projects/plugins/jetpack/tests/php/Unauth_File_Upload_Test.php new file mode 100644 index 000000000000..57d83d295c86 --- /dev/null +++ b/projects/plugins/jetpack/tests/php/Unauth_File_Upload_Test.php @@ -0,0 +1,76 @@ +assertEquals( $expected, \Automattic\Jetpack\UnauthFileUpload\is_file_type_previewable( $mime_type ) ); + } + + /** + * Data provider for test_is_file_type_previable. + * + * @return array Test cases with MIME types and expected results. + */ + public static function provider_is_file_type_previable() { + return array( + // Previable image types + array( 'image/jpeg', true ), + array( 'image/png', true ), + array( 'image/gif', true ), + array( 'image/webp', true ), + + // Previable document type + array( 'application/pdf', true ), + + // Non-previable image types + array( 'image/svg+xml', false ), + array( 'image/bmp', false ), + array( 'image/tiff', false ), + + // Non-previable document types + array( 'application/msword', false ), + array( 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', false ), + array( 'application/vnd.ms-excel', false ), + array( 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', false ), + + // Other common non-previable types + array( 'application/zip', false ), + array( 'application/x-zip-compressed', false ), + array( 'text/plain', false ), + array( 'text/html', false ), + array( 'application/json', false ), + array( 'video/mp4', false ), + array( 'audio/mpeg', false ), + + // Edge cases + array( '', false ), + array( 'application/octet-stream', false ), + array( 'invalid/type', false ), + ); + } +} diff --git a/projects/plugins/jetpack/unauth-file-upload.php b/projects/plugins/jetpack/unauth-file-upload.php index 742e72ca26c0..4f0f5b4e3c34 100644 --- a/projects/plugins/jetpack/unauth-file-upload.php +++ b/projects/plugins/jetpack/unauth-file-upload.php @@ -78,7 +78,7 @@ function handle_file_download() { $file['type'] = $file['type'] ?? 'application/octet-stream'; $file['name'] = $file['name'] ?? ''; - $is_preview = isset( $_GET['preview'] ) && 'true' === $_GET['preview']; + $is_preview = isset( $_GET['preview'] ) && 'true' === $_GET['preview'] && is_file_type_previewable( $file['type'] ); // Clean output buffer if ( ob_get_length() ) { @@ -165,3 +165,23 @@ function get_file_content( $file_content, $file_id ) { 'name' => $filename, ); } + +/** + * Check which file type is previewable in the browser without downloading them. + * + * Allow images with extensions jpg, jpeg, png, gif, webp and pdf files. + * + * @param string $file_type The MIME type of the file. + * @return bool True if the file is previable, false otherwise. + */ +function is_file_type_previewable( $file_type ) { + $previable_types = array( + 'image/jpeg', + 'image/png', + 'image/gif', + 'image/webp', + 'application/pdf', + ); + + return in_array( $file_type, $previable_types, true ); +} From 320bb5b8aa0170e767d4d29b6a8483735a873db2 Mon Sep 17 00:00:00 2001 From: Automattic Bot Date: Tue, 2 Dec 2025 21:58:55 +0100 Subject: [PATCH 11/49] Update GitHub actions upload/download artifact (#46169) Co-authored-by: Renovate Bot --- .github/workflows/build-docker-monorepo.yml | 4 ++-- .github/workflows/build-docker.yml | 4 ++-- .github/workflows/build.yml | 10 +++++----- .github/workflows/e2e-tests.yml | 4 ++-- .github/workflows/tests.yml | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-docker-monorepo.yml b/.github/workflows/build-docker-monorepo.yml index 6dde5304d159..9a92f618df7d 100644 --- a/.github/workflows/build-docker-monorepo.yml +++ b/.github/workflows/build-docker-monorepo.yml @@ -134,7 +134,7 @@ jobs: touch "$TEMP/digests/${DIGEST#sha256:}" - name: Upload digest - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: name: digests-linux-${{ matrix.platform }} path: ${{ runner.temp }}/digests/* @@ -152,7 +152,7 @@ jobs: steps: - name: Download digests - uses: actions/download-artifact@v5 + uses: actions/download-artifact@v6 with: path: ${{ runner.temp }}/digests pattern: digests-* diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 858154efb2e8..0c37420abd0e 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -135,7 +135,7 @@ jobs: touch "$TEMP/digests/${DIGEST#sha256:}" - name: Upload digest - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: name: digests-linux-${{ matrix.platform }} path: ${{ runner.temp }}/digests/* @@ -153,7 +153,7 @@ jobs: steps: - name: Download digests - uses: actions/download-artifact@v5 + uses: actions/download-artifact@v6 with: path: ${{ runner.temp }}/digests pattern: digests-* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f350f44ee3f0..07b5bfa5f5de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -149,7 +149,7 @@ jobs: run: tar --owner=0 --group=0 --xz -cvvf build.tar.xz -C "$BUILD_BASE" --transform 's,^\.,build,' . - name: Store build as artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: name: jetpack-build path: build.tar.xz @@ -160,7 +160,7 @@ jobs: - name: Store plugins.tsv as artifact if: steps.plugins.outputs.any == 'true' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: name: plugins.tsv path: ${{ env.BUILD_BASE }}/plugins.tsv @@ -191,7 +191,7 @@ jobs: path: monorepo - name: Download build artifact - uses: actions/download-artifact@v5 + uses: actions/download-artifact@v6 with: name: jetpack-build - name: Extract build archive @@ -257,7 +257,7 @@ jobs: echo "any-built=$ANY_BUILT" >> "$GITHUB_OUTPUT" - name: Create plugins artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 if: steps.prepare.outputs.any-built == 'true' with: name: plugins @@ -288,7 +288,7 @@ jobs: timeout-minutes: 1 # 2025-11-06: Successful runs seem to take a few seconds - name: Download build artifact - uses: actions/download-artifact@v5 + uses: actions/download-artifact@v6 with: name: jetpack-build timeout-minutes: 2 # 2025-11-06: Successful runs normally take a few seconds diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 91199025970d..92ad5a148c34 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -314,7 +314,7 @@ jobs: - name: Upload test artifacts if: ${{ always() }} continue-on-error: true - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: name: test-output-${{ matrix.project }} path: ${{ matrix.path }}/output @@ -398,7 +398,7 @@ jobs: working-directory: ./projects/github-actions/test-results-to-slack - name: Download test artifacts - uses: actions/download-artifact@v5 + uses: actions/download-artifact@v6 with: path: test-output diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d119ec4c6402..bbfca7995d4f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -309,7 +309,7 @@ jobs: - name: Upload artifacts id: upload-artifacts if: always() && steps.check-artifacts.outputs.any == 'true' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: name: ${{ matrix.artifact }} path: artifacts @@ -337,7 +337,7 @@ jobs: uses: ./.github/actions/tool-setup - name: Download coverage artifact - uses: actions/download-artifact@v5 + uses: actions/download-artifact@v6 with: name: 'Code coverage' path: coverage From 7d364bf2c8ad20078f9edee3d7c2e73cafe00c29 Mon Sep 17 00:00:00 2001 From: Douglas Henri Date: Tue, 2 Dec 2025 18:45:15 -0300 Subject: [PATCH 12/49] Forms: Set "from" field as primary on dashboard (#46170) * set 'from' as title field * changelog --- .../forms/changelog/fix-forms-dashboard-primary-field | 4 ++++ projects/packages/forms/src/dashboard/inbox/stage/views.js | 3 ++- projects/packages/forms/src/dashboard/inbox/style.scss | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 projects/packages/forms/changelog/fix-forms-dashboard-primary-field diff --git a/projects/packages/forms/changelog/fix-forms-dashboard-primary-field b/projects/packages/forms/changelog/fix-forms-dashboard-primary-field new file mode 100644 index 000000000000..1f2751b68bdd --- /dev/null +++ b/projects/packages/forms/changelog/fix-forms-dashboard-primary-field @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Forms: Set "from" field as primary on dashboard diff --git a/projects/packages/forms/src/dashboard/inbox/stage/views.js b/projects/packages/forms/src/dashboard/inbox/stage/views.js index aab967768785..0a09c34ce66b 100644 --- a/projects/packages/forms/src/dashboard/inbox/stage/views.js +++ b/projects/packages/forms/src/dashboard/inbox/stage/views.js @@ -13,7 +13,8 @@ export const defaultView = { filters: [], page: 1, perPage: 20, - fields: [ 'from', 'date', 'source', 'ip' ], + titleField: 'from', + fields: [ 'date', 'source', 'ip' ], }; export const defaultLayouts = { diff --git a/projects/packages/forms/src/dashboard/inbox/style.scss b/projects/packages/forms/src/dashboard/inbox/style.scss index 2775d065ae2c..8fb0dce2982a 100644 --- a/projects/packages/forms/src/dashboard/inbox/style.scss +++ b/projects/packages/forms/src/dashboard/inbox/style.scss @@ -144,7 +144,7 @@ .jp-forms__inbox__author-field__email { font-size: 11px; - filter: opacity(0.8); + filter: opacity(0.6); } .jp-forms__inbox__unread-indicator { From 0b51223bf7c3e8059081b28981c4b9acf78b4d53 Mon Sep 17 00:00:00 2001 From: Douglas Henri Date: Tue, 2 Dec 2025 18:45:20 -0300 Subject: [PATCH 13/49] Forms: Set dashboard dataview background color explicitly (#46171) * set background color for the dataviews container * changelog --- .../packages/forms/changelog/fix-forms-dashboard-background | 5 +++++ projects/packages/forms/src/dashboard/inbox/style.scss | 1 + 2 files changed, 6 insertions(+) create mode 100644 projects/packages/forms/changelog/fix-forms-dashboard-background diff --git a/projects/packages/forms/changelog/fix-forms-dashboard-background b/projects/packages/forms/changelog/fix-forms-dashboard-background new file mode 100644 index 000000000000..4b1adbb8f6ad --- /dev/null +++ b/projects/packages/forms/changelog/fix-forms-dashboard-background @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Just a background color for compatibility with an incoming dependency update + + diff --git a/projects/packages/forms/src/dashboard/inbox/style.scss b/projects/packages/forms/src/dashboard/inbox/style.scss index 8fb0dce2982a..5983543020c8 100644 --- a/projects/packages/forms/src/dashboard/inbox/style.scss +++ b/projects/packages/forms/src/dashboard/inbox/style.scss @@ -63,6 +63,7 @@ flex-grow: 1; display: flex; flex-direction: column; + background-color: var(--wpds-color-bg-surface-neutral-strong, #fff); } .jp-forms-filters-container:not(:empty) { From 1f2dfbc7de70c5730acd1dba16dd3ee4571333e7 Mon Sep 17 00:00:00 2001 From: Grzegorz Chudzinski-Pawlowski <112354940+grzegorz-cp@users.noreply.github.com> Date: Wed, 3 Dec 2025 13:11:57 +1100 Subject: [PATCH 14/49] Backporting Updated new Forms version to v6.21.1 (#46173) Co-authored-by: Grzegorz Chudzinski-Pawlowski <> --- projects/packages/forms/CHANGELOG.md | 5 +++++ projects/packages/forms/changelog/fix-forms-flickering | 4 ---- .../packages/forms/changelog/fix-preview-only-image-formats | 5 ----- projects/packages/forms/package.json | 2 +- projects/packages/forms/src/class-jetpack-forms.php | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) delete mode 100644 projects/packages/forms/changelog/fix-forms-flickering delete mode 100644 projects/packages/forms/changelog/fix-preview-only-image-formats diff --git a/projects/packages/forms/CHANGELOG.md b/projects/packages/forms/CHANGELOG.md index 3ef8e1e7c239..8926564d5ffa 100644 --- a/projects/packages/forms/CHANGELOG.md +++ b/projects/packages/forms/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [6.21.1] - 2025-12-03 +### Fixed +- Fix the flickering between the sidebar loading on different browser widths. + ## [6.21.0] - 2025-12-01 ### Added - Add form response webhook support. [#46059] @@ -1934,6 +1938,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added a new jetpack/forms package [#28409] - Added a public load_contact_form method for initializing the contact form module. [#28416] +[6.21.1]: https://github.com/automattic/jetpack-forms/compare/v6.21.0...v6.21.1 [6.21.0]: https://github.com/automattic/jetpack-forms/compare/v6.20.0...v6.21.0 [6.20.0]: https://github.com/automattic/jetpack-forms/compare/v6.19.0...v6.20.0 [6.19.0]: https://github.com/automattic/jetpack-forms/compare/v6.18.0...v6.19.0 diff --git a/projects/packages/forms/changelog/fix-forms-flickering b/projects/packages/forms/changelog/fix-forms-flickering deleted file mode 100644 index 989502ac8409..000000000000 --- a/projects/packages/forms/changelog/fix-forms-flickering +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Forms: Fix the flickering between the sidebar loading on different browser widths diff --git a/projects/packages/forms/changelog/fix-preview-only-image-formats b/projects/packages/forms/changelog/fix-preview-only-image-formats deleted file mode 100644 index 387306e093eb..000000000000 --- a/projects/packages/forms/changelog/fix-preview-only-image-formats +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Restricts inline file preview to only image formats and PDFs, forces download for other file types for security. - - diff --git a/projects/packages/forms/package.json b/projects/packages/forms/package.json index 21d282fb323a..d109a575b496 100644 --- a/projects/packages/forms/package.json +++ b/projects/packages/forms/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-forms", - "version": "6.21.0", + "version": "6.21.1", "private": true, "description": "Jetpack Forms", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/forms/#readme", diff --git a/projects/packages/forms/src/class-jetpack-forms.php b/projects/packages/forms/src/class-jetpack-forms.php index 9684c0bb9923..1ae10c4b20b9 100644 --- a/projects/packages/forms/src/class-jetpack-forms.php +++ b/projects/packages/forms/src/class-jetpack-forms.php @@ -14,7 +14,7 @@ */ class Jetpack_Forms { - const PACKAGE_VERSION = '6.21.0'; + const PACKAGE_VERSION = '6.21.1'; /** * Load the contact form module. From 44420590d78a6c181f5d93f4f5e81e09b6a159a9 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Wed, 3 Dec 2025 11:04:27 +0100 Subject: [PATCH 15/49] jetpack-mu-wpcom Code Editor: Fix an issue with Firefox compatibility (#46174) - Add fallback in case of errors loading the improved code editor. - Improve FireFox compatibility by using Firefox-supported getComputedStyle over computedStyleMap. This fixes an error in Firefox that prevented the improved editor from loading. --- ...proved-code-editor-fix-computedstylemap-ff | 4 ++++ .../code-editor/code-editor/code-editor.tsx | 22 ++++++++++--------- .../site-additional-css.ts | 14 +++++++----- 3 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/improved-code-editor-fix-computedstylemap-ff diff --git a/projects/packages/jetpack-mu-wpcom/changelog/improved-code-editor-fix-computedstylemap-ff b/projects/packages/jetpack-mu-wpcom/changelog/improved-code-editor-fix-computedstylemap-ff new file mode 100644 index 000000000000..898929209890 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/improved-code-editor-fix-computedstylemap-ff @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fix an issue with Firefox where `getComputedStyleMap()` causes an undefined function error. diff --git a/projects/packages/jetpack-mu-wpcom/src/features/code-editor/code-editor/code-editor.tsx b/projects/packages/jetpack-mu-wpcom/src/features/code-editor/code-editor/code-editor.tsx index 3948170b5324..20c660ffd7cc 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/code-editor/code-editor/code-editor.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/code-editor/code-editor/code-editor.tsx @@ -18,14 +18,12 @@ const codeEditorTextareaSelector = 'textarea.editor-post-text-editor'; let editor: EditorView | true | null = null; // Prevent a flash of the textarea before we cover it. -{ - const styleElement = document.createElement( 'style' ); - styleElement.textContent = ` +const styleElement = document.createElement( 'style' ); +styleElement.textContent = ` ${ codeEditorTextareaSelector } { visibility: hidden; }`; - document.head.appendChild( styleElement ); -} +document.head.appendChild( styleElement ); const observer = new MutationObserver( () => { const codeEditorTextarea: ReactHTMLTextAreaElement | null = document.querySelector( @@ -37,7 +35,11 @@ const observer = new MutationObserver( () => { // And the editor isn't loaded or initializing if ( ! editor ) { // Do it - setupEditor( codeEditorTextarea ); + setupEditor( codeEditorTextarea ).catch( () => { + // Clean up in case of problems. + styleElement.remove(); + observer.disconnect(); + } ); } } // If there's no textarea but the editor is loaded @@ -79,10 +81,10 @@ const setupEditor = async ( target: ReactHTMLTextAreaElement ): Promise< void > const div = document.createElement( 'div' ); - const containerStyleMap = containerElement.computedStyleMap(); - const left = containerStyleMap.get( 'padding-left' )?.toString() || '0'; - const right = containerStyleMap.get( 'padding-right' )?.toString() || '0'; - const paddingBottom = containerStyleMap.get( 'padding-bottom' )?.toString() || '12px'; + const styles = getComputedStyle( containerElement ); + const left = styles.paddingLeft || '0'; + const right = styles.paddingRight || '0'; + const paddingBottom = styles.paddingBottom || '12px'; const top = `${ target.offsetTop }px`; div.style = `position: absolute; top: ${ top }; left: ${ left }; right: ${ right }; padding-bottom: ${ paddingBottom };`; diff --git a/projects/packages/jetpack-mu-wpcom/src/features/code-editor/site-additional-css/site-additional-css.ts b/projects/packages/jetpack-mu-wpcom/src/features/code-editor/site-additional-css/site-additional-css.ts index e53eac94b561..90d2050f571c 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/code-editor/site-additional-css/site-additional-css.ts +++ b/projects/packages/jetpack-mu-wpcom/src/features/code-editor/site-additional-css/site-additional-css.ts @@ -11,14 +11,12 @@ const additionalCssTextareaSelector = '.block-editor-global-styles-advanced-panel__custom-css-input textarea'; // Prevent a flash of the textarea before we cover it. -{ - const styleElement = document.createElement( 'style' ); - styleElement.textContent = ` +const styleElement = document.createElement( 'style' ); +styleElement.textContent = ` ${ additionalCssTextareaSelector } { visibility: hidden; }`; - document.head.appendChild( styleElement ); -} +document.head.appendChild( styleElement ); const observer = new MutationObserver( () => { const additionalCSSTextarea: ReactHTMLTextAreaElement | null = document.querySelector( @@ -36,7 +34,11 @@ const observer = new MutationObserver( () => { // And the editor isn't loaded or initializing if ( ! editor ) { // Do it - setupEditor( additionalCSSTextarea, isSingleBlockStyleEditor ); + setupEditor( additionalCSSTextarea, isSingleBlockStyleEditor ).catch( () => { + // Clean up in case of problems. + observer.disconnect(); + styleElement.remove(); + } ); } } // If there's no textarea but the editor is loaded From cdbd96f0afa14fa70824ff561d3f41255b04b41b Mon Sep 17 00:00:00 2001 From: Automattic Bot Date: Wed, 3 Dec 2025 11:14:22 +0100 Subject: [PATCH 16/49] Update dependency @wordpress/dataviews to v11 (#45914) * Update dependency @wordpress/dataviews to v11 * Update type name in Scan --------- Co-authored-by: Renovate Bot Co-authored-by: Douglas --- pnpm-lock.yaml | 126 ++---------------- .../changelog/renovate-@wordpressdataviews | 4 + .../publicize-components/package.json | 2 +- .../changelog/renovate-@wordpressdataviews | 4 + projects/js-packages/scan/package.json | 2 +- .../components/threats-data-views/index.tsx | 8 +- .../changelog/renovate-@wordpressdataviews | 4 + projects/packages/forms/package.json | 2 +- .../changelog/renovate-@wordpressdataviews | 4 + projects/packages/my-jetpack/package.json | 2 +- .../changelog/renovate-@wordpressdataviews | 4 + projects/packages/newsletter/package.json | 2 +- .../changelog/renovate-@wordpressdataviews | 4 + .../subscribers-dashboard/package.json | 2 +- 14 files changed, 47 insertions(+), 123 deletions(-) create mode 100644 projects/js-packages/publicize-components/changelog/renovate-@wordpressdataviews create mode 100644 projects/js-packages/scan/changelog/renovate-@wordpressdataviews create mode 100644 projects/packages/forms/changelog/renovate-@wordpressdataviews create mode 100644 projects/packages/my-jetpack/changelog/renovate-@wordpressdataviews create mode 100644 projects/packages/newsletter/changelog/renovate-@wordpressdataviews create mode 100644 projects/packages/subscribers-dashboard/changelog/renovate-@wordpressdataviews diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 30c612b05d74..dc0511d90416 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1439,8 +1439,8 @@ importers: specifier: 10.36.0 version: 10.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) '@wordpress/dataviews': - specifier: 10.2.0 - version: 10.2.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) + specifier: 11.0.0 + version: 11.0.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) '@wordpress/date': specifier: 5.36.0 version: 5.36.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) @@ -1621,8 +1621,8 @@ importers: specifier: 30.9.0 version: 30.9.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/dataviews': - specifier: 10.2.0 - version: 10.2.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) + specifier: 11.0.0 + version: 11.0.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) '@wordpress/date': specifier: 5.36.0 version: 5.36.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) @@ -2687,8 +2687,8 @@ importers: specifier: 10.36.0 version: 10.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) '@wordpress/dataviews': - specifier: 10.2.0 - version: 10.2.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) + specifier: 11.0.0 + version: 11.0.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) '@wordpress/dom-ready': specifier: 4.36.0 version: 4.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) @@ -3265,8 +3265,8 @@ importers: specifier: 10.36.0 version: 10.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) '@wordpress/dataviews': - specifier: 10.2.0 - version: 10.2.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) + specifier: 11.0.0 + version: 11.0.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) '@wordpress/date': specifier: 5.36.0 version: 5.36.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) @@ -3374,8 +3374,8 @@ importers: projects/packages/newsletter: dependencies: '@wordpress/dataviews': - specifier: 10.2.0 - version: 10.2.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) + specifier: 11.0.0 + version: 11.0.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) '@wordpress/element': specifier: 6.36.0 version: 6.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) @@ -3889,8 +3889,8 @@ importers: specifier: 10.36.0 version: 10.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) '@wordpress/dataviews': - specifier: 10.2.0 - version: 10.2.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) + specifier: 11.0.0 + version: 11.0.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) '@wordpress/element': specifier: 6.36.0 version: 6.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) @@ -9964,12 +9964,6 @@ packages: peerDependencies: react: ^18.0.0 - '@wordpress/dataviews@10.2.0': - resolution: {integrity: sha512-Kwt5tB4SRkyWFVVqgGNraRajNm5lACObrzLV1f2A2343dQ88cgiS5iukI9qdhzy7CiGIHN7UrQaFbpDoTtOKAA==} - engines: {node: '>=18.12.0', npm: '>=8.19.2'} - peerDependencies: - react: ^18.0.0 - '@wordpress/dataviews@11.0.0': resolution: {integrity: sha512-En5jZGybCYrkPRX6XBaN6sROeYx11z26vU4y6ZteS607htJlU1e+nKSE5R2o6V8d4NaQaa03jgs/s0N89KHWEQ==} engines: {node: '>=18.12.0', npm: '>=8.19.2'} @@ -17310,7 +17304,7 @@ snapshots: '@automattic/api-core@1.0.0(@types/react@18.3.26)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@automattic/shopping-cart': 2.0.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@wordpress/dataviews': 10.2.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) + '@wordpress/dataviews': 11.0.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1) '@wordpress/i18n': 6.9.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) he: 1.2.0 tslib: 2.8.1 @@ -22962,100 +22956,6 @@ snapshots: rememo: 4.0.2 use-memo-one: 1.1.3(react@18.3.1) - '@wordpress/dataviews@10.2.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1)': - dependencies: - '@ariakit/react': 0.4.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@wordpress/base-styles': 6.12.0 - '@wordpress/components': 30.9.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@wordpress/compose': 7.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) - '@wordpress/data': 10.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) - '@wordpress/element': 6.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) - '@wordpress/i18n': 6.9.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) - '@wordpress/icons': 11.3.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) - '@wordpress/keycodes': 4.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) - '@wordpress/primitives': 4.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) - '@wordpress/private-apis': 1.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) - '@wordpress/url': 4.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) - '@wordpress/warning': 3.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) - clsx: 2.1.1 - react: 18.3.1 - remove-accents: 0.5.0 - optionalDependencies: - '@emotion/cache': 11.14.0 - '@emotion/css': 11.13.5 - '@emotion/react': 11.14.0(@types/react@18.3.26)(react@18.3.1) - '@emotion/styled': 11.14.1(@emotion/react@11.14.0(@types/react@18.3.26)(react@18.3.1))(@types/react@18.3.26)(react@18.3.1) - '@emotion/utils': 1.4.2 - '@floating-ui/react-dom': 2.0.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@use-gesture/react': 10.3.1(react@18.3.1) - '@wordpress/date': 5.36.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) - '@wordpress/hooks': 4.36.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) - change-case: 4.1.2 - colord: 2.9.3 - date-fns: 4.1.0 - deepmerge: 4.3.1 - fast-deep-equal: 3.1.3 - framer-motion: 11.18.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - highlight-words-core: 1.2.3 - is-plain-object: 5.0.0 - memize: 2.1.1 - react-colorful: 5.6.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - react-day-picker: 9.11.1(react@18.3.1) - react-dom: 18.3.1(react@18.3.1) - use-memo-one: 1.1.3(react@18.3.1) - uuid: 9.0.1(patch_hash=87a713b75995ed86c0ecd0cadfd1b9f85092ca16fdff7132ff98b62fc3cf2db0) - transitivePeerDependencies: - - '@emotion/is-prop-valid' - - '@types/react' - - supports-color - - '@wordpress/dataviews@10.2.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1)': - dependencies: - '@ariakit/react': 0.4.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@wordpress/base-styles': 6.12.0 - '@wordpress/components': 30.9.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@wordpress/compose': 7.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) - '@wordpress/data': 10.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) - '@wordpress/element': 6.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) - '@wordpress/i18n': 6.9.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) - '@wordpress/icons': 11.3.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) - '@wordpress/keycodes': 4.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) - '@wordpress/primitives': 4.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(react@18.3.1) - '@wordpress/private-apis': 1.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) - '@wordpress/url': 4.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) - '@wordpress/warning': 3.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b) - clsx: 2.1.1 - react: 18.3.1 - remove-accents: 0.5.0 - optionalDependencies: - '@emotion/cache': 11.14.0 - '@emotion/css': 11.13.5 - '@emotion/react': 11.14.0(react@18.3.1) - '@emotion/styled': 11.14.1(@emotion/react@11.14.0(react@18.3.1))(react@18.3.1) - '@emotion/utils': 1.4.2 - '@floating-ui/react-dom': 2.0.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@use-gesture/react': 10.3.1(react@18.3.1) - '@wordpress/date': 5.36.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) - '@wordpress/hooks': 4.36.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b) - change-case: 4.1.2 - colord: 2.9.3 - date-fns: 4.1.0 - deepmerge: 4.3.1 - fast-deep-equal: 3.1.3 - framer-motion: 11.18.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - highlight-words-core: 1.2.3 - is-plain-object: 5.0.0 - memize: 2.1.1 - react-colorful: 5.6.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - react-day-picker: 9.11.1(react@18.3.1) - react-dom: 18.3.1(react@18.3.1) - use-memo-one: 1.1.3(react@18.3.1) - uuid: 9.0.1(patch_hash=87a713b75995ed86c0ecd0cadfd1b9f85092ca16fdff7132ff98b62fc3cf2db0) - transitivePeerDependencies: - - '@emotion/is-prop-valid' - - '@types/react' - - supports-color - '@wordpress/dataviews@11.0.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)(@types/react@18.3.26)(react@18.3.1)': dependencies: '@ariakit/react': 0.4.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1) diff --git a/projects/js-packages/publicize-components/changelog/renovate-@wordpressdataviews b/projects/js-packages/publicize-components/changelog/renovate-@wordpressdataviews new file mode 100644 index 000000000000..45028352a802 --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/renovate-@wordpressdataviews @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Update package dependencies. diff --git a/projects/js-packages/publicize-components/package.json b/projects/js-packages/publicize-components/package.json index 921184d9cbe6..e74bf910da96 100644 --- a/projects/js-packages/publicize-components/package.json +++ b/projects/js-packages/publicize-components/package.json @@ -41,7 +41,7 @@ "@wordpress/compose": "7.36.0", "@wordpress/core-data": "7.36.0", "@wordpress/data": "10.36.0", - "@wordpress/dataviews": "10.2.0", + "@wordpress/dataviews": "11.0.0", "@wordpress/date": "5.36.0", "@wordpress/edit-post": "8.36.0", "@wordpress/editor": "14.36.0", diff --git a/projects/js-packages/scan/changelog/renovate-@wordpressdataviews b/projects/js-packages/scan/changelog/renovate-@wordpressdataviews new file mode 100644 index 000000000000..45028352a802 --- /dev/null +++ b/projects/js-packages/scan/changelog/renovate-@wordpressdataviews @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Update package dependencies. diff --git a/projects/js-packages/scan/package.json b/projects/js-packages/scan/package.json index 5e622689868d..e55e3bbca9f6 100644 --- a/projects/js-packages/scan/package.json +++ b/projects/js-packages/scan/package.json @@ -38,7 +38,7 @@ "@automattic/jetpack-components": "workspace:*", "@wordpress/api-fetch": "7.36.0", "@wordpress/components": "30.9.0", - "@wordpress/dataviews": "10.2.0", + "@wordpress/dataviews": "11.0.0", "@wordpress/date": "5.36.0", "@wordpress/element": "6.36.0", "@wordpress/i18n": "6.9.0", diff --git a/projects/js-packages/scan/src/components/threats-data-views/index.tsx b/projects/js-packages/scan/src/components/threats-data-views/index.tsx index 402f8b841cea..8b210ab2fa2e 100644 --- a/projects/js-packages/scan/src/components/threats-data-views/index.tsx +++ b/projects/js-packages/scan/src/components/threats-data-views/index.tsx @@ -3,7 +3,7 @@ import { type Action, type ActionButton, type Field, - type FieldType, + type FieldTypeName, type Filter, type SortDirection, type SupportedLayouts, @@ -315,7 +315,7 @@ export default function ThreatsDataViews( { { id: THREAT_FIELD_SEVERITY, label: __( 'Severity', 'jetpack-scan' ), - type: 'integer' as FieldType, + type: 'integer' as FieldTypeName, getValue( { item }: { item: Threat } ) { return item.severity ?? 0; }, @@ -343,7 +343,7 @@ export default function ThreatsDataViews( { { id: THREAT_FIELD_FIRST_DETECTED, label: __( 'First Detected', 'jetpack-scan' ), - type: 'datetime' as FieldType, + type: 'datetime' as FieldTypeName, getValue( { item }: { item: Threat } ) { return item.firstDetected ? new Date( item.firstDetected ) : null; }, @@ -362,7 +362,7 @@ export default function ThreatsDataViews( { { id: THREAT_FIELD_FIXED_ON, label: __( 'Fixed On', 'jetpack-scan' ), - type: 'datetime' as FieldType, + type: 'datetime' as FieldTypeName, getValue( { item }: { item: Threat } ) { return item.fixedOn ? new Date( item.fixedOn ) : null; }, diff --git a/projects/packages/forms/changelog/renovate-@wordpressdataviews b/projects/packages/forms/changelog/renovate-@wordpressdataviews new file mode 100644 index 000000000000..45028352a802 --- /dev/null +++ b/projects/packages/forms/changelog/renovate-@wordpressdataviews @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Update package dependencies. diff --git a/projects/packages/forms/package.json b/projects/packages/forms/package.json index d109a575b496..334389c269db 100644 --- a/projects/packages/forms/package.json +++ b/projects/packages/forms/package.json @@ -53,7 +53,7 @@ "@wordpress/compose": "7.36.0", "@wordpress/core-data": "7.36.0", "@wordpress/data": "10.36.0", - "@wordpress/dataviews": "10.2.0", + "@wordpress/dataviews": "11.0.0", "@wordpress/dom-ready": "4.36.0", "@wordpress/editor": "14.36.0", "@wordpress/element": "6.36.0", diff --git a/projects/packages/my-jetpack/changelog/renovate-@wordpressdataviews b/projects/packages/my-jetpack/changelog/renovate-@wordpressdataviews new file mode 100644 index 000000000000..45028352a802 --- /dev/null +++ b/projects/packages/my-jetpack/changelog/renovate-@wordpressdataviews @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Update package dependencies. diff --git a/projects/packages/my-jetpack/package.json b/projects/packages/my-jetpack/package.json index a0d93dd31ccb..9c08d86ebb81 100644 --- a/projects/packages/my-jetpack/package.json +++ b/projects/packages/my-jetpack/package.json @@ -50,7 +50,7 @@ "@wordpress/components": "30.9.0", "@wordpress/compose": "7.36.0", "@wordpress/data": "10.36.0", - "@wordpress/dataviews": "10.2.0", + "@wordpress/dataviews": "11.0.0", "@wordpress/date": "5.36.0", "@wordpress/element": "6.36.0", "@wordpress/i18n": "6.9.0", diff --git a/projects/packages/newsletter/changelog/renovate-@wordpressdataviews b/projects/packages/newsletter/changelog/renovate-@wordpressdataviews new file mode 100644 index 000000000000..45028352a802 --- /dev/null +++ b/projects/packages/newsletter/changelog/renovate-@wordpressdataviews @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Update package dependencies. diff --git a/projects/packages/newsletter/package.json b/projects/packages/newsletter/package.json index 4c85795795cf..e365af33ff6a 100644 --- a/projects/packages/newsletter/package.json +++ b/projects/packages/newsletter/package.json @@ -32,7 +32,7 @@ "extends @wordpress/browserslist-config" ], "dependencies": { - "@wordpress/dataviews": "10.2.0", + "@wordpress/dataviews": "11.0.0", "@wordpress/element": "6.36.0", "@wordpress/i18n": "6.9.0", "debug": "4.4.1" diff --git a/projects/packages/subscribers-dashboard/changelog/renovate-@wordpressdataviews b/projects/packages/subscribers-dashboard/changelog/renovate-@wordpressdataviews new file mode 100644 index 000000000000..45028352a802 --- /dev/null +++ b/projects/packages/subscribers-dashboard/changelog/renovate-@wordpressdataviews @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Update package dependencies. diff --git a/projects/packages/subscribers-dashboard/package.json b/projects/packages/subscribers-dashboard/package.json index f45c2423f734..71321829bcad 100644 --- a/projects/packages/subscribers-dashboard/package.json +++ b/projects/packages/subscribers-dashboard/package.json @@ -37,7 +37,7 @@ "dependencies": { "@automattic/babel-plugin-replace-textdomain": "workspace:*", "@wordpress/data": "10.36.0", - "@wordpress/dataviews": "10.2.0", + "@wordpress/dataviews": "11.0.0", "@wordpress/element": "6.36.0", "@wordpress/i18n": "6.9.0", "@wordpress/url": "4.36.0" From d1c5b1ef09b87f6e560d5675a5f1aad0cea89dd3 Mon Sep 17 00:00:00 2001 From: Emanuele Buccelli Date: Wed, 3 Dec 2025 14:07:28 +0100 Subject: [PATCH 17/49] Editor && /support: add "Learn More" links to a few blocks (#46177) * update links * changelog * Add time-to-read variations --- ...ing-learn-more-links-to-block-descriptions | 4 ++ .../src/block-links-map.ts | 63 ++++++++++++++++++- 2 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/DOTSUP-371-add-missing-learn-more-links-to-block-descriptions diff --git a/projects/packages/jetpack-mu-wpcom/changelog/DOTSUP-371-add-missing-learn-more-links-to-block-descriptions b/projects/packages/jetpack-mu-wpcom/changelog/DOTSUP-371-add-missing-learn-more-links-to-block-descriptions new file mode 100644 index 000000000000..1ff21527e2f3 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/DOTSUP-371-add-missing-learn-more-links-to-block-descriptions @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Added learn more links in the editor to a few blocks diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-description-links/src/block-links-map.ts b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-description-links/src/block-links-map.ts index 1bc25c873cc6..e8a2cee27cc6 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-description-links/src/block-links-map.ts +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-description-links/src/block-links-map.ts @@ -179,9 +179,21 @@ const blockInfoMapping: { [ key: string ]: { link: string; postId: number } } = link: 'https://wordpress.com/support/full-site-editing/theme-blocks/comments-block/', postId: 218903, }, - 'core/post-time-to-read': { - link: 'https://wordpress.com/support/site-editing/theme-blocks/time-to-read-block', - postId: 243241, + 'core/details': { + link: 'https://wordpress.com/support/wordpress-editor/blocks/details-block/', + postId: 254286, + }, + 'core/accordion-item': { + link: 'https://wordpress.com/support/wordpress-editor/blocks/accordion-block/', + postId: 423535, + }, + 'core/math': { + link: 'https://wordpress.com/support/latex/', + postId: 97, + }, + 'core/terms-query': { + link: 'https://wordpress.com/support/wordpress-editor/blocks/terms-query-block/', + postId: 423600, }, 'syntaxhighlighter/code': { link: 'https://wordpress.com/support/wordpress-editor/blocks/syntax-highlighter-code-block/', @@ -218,6 +230,10 @@ const blockInfoMapping: { [ key: string ]: { link: string; postId: number } } = link: 'https://wordpress.com/support/wordpress-editor/blocks/blog-posts-block/', postId: 158419, }, + 'videopress/video': { + link: 'https://wordpress.com/support/videopress/', + postId: 4458, + }, /** * Jetpack Blocks */ @@ -357,6 +373,37 @@ const blockInfoMapping: { [ key: string ]: { link: string; postId: number } } = link: 'https://wordpress.com/support/wordpress-editor/blocks/pay-with-paypal/', postId: 168671, }, + 'jetpack/blogging-prompt': { + link: 'https://wordpress.com/support/writing-prompts/', + postId: 227456, + }, + 'jetpack/paypal-payment-buttons': { + link: 'https://wordpress.com/support/wordpress-editor/blocks/pay-with-paypal/', + postId: 168671, + }, + 'jetpack/payment-buttons': { + link: 'https://wordpress.com/support/wordpress-editor/blocks/payments/', + postId: 169123, + }, + /** + * ActivityPub Blocks + */ + 'activitypub/follow-me': { + link: 'https://wordpress.com/support/enter-the-fediverse/fediverse-blocks/', + postId: 414647, + }, + 'activitypub/followers': { + link: 'https://wordpress.com/support/enter-the-fediverse/fediverse-blocks/', + postId: 414647, + }, + 'activitypub/reactions': { + link: 'https://wordpress.com/support/enter-the-fediverse/fediverse-blocks/', + postId: 414647, + }, + 'activitypub/reply': { + link: 'https://wordpress.com/support/enter-the-fediverse/fediverse-blocks/', + postId: 414647, + }, }; export const blockInfoWithVariations: { @@ -386,6 +433,16 @@ export const blockInfoWithVariations: { postId: 339584, }, }, + 'core/post-time-to-read': { + 'time-to-read': { + link: 'https://wordpress.com/support/wordpress-editor/blocks/time-to-read-block/', + postId: 243241, + }, + 'word-count': { + link: 'https://wordpress.com/support/wordpress-editor/blocks/time-to-read-block/', + postId: 243241, + }, + }, }; export const childrenBlockInfoWithDifferentUrl: { From f64db9c38485d6e79432118a769f0d9b25b2ed3a Mon Sep 17 00:00:00 2001 From: Jake Morrison <68693+jom@users.noreply.github.com> Date: Wed, 3 Dec 2025 14:33:06 +0000 Subject: [PATCH 18/49] Add agents provider frontend data (#46176) * Add agent provider to Agents Manager * Add changelog * Use help-center package * More test fix * Inject everywhere * Fix callback * Use more expected test case * Use more expected test case and fix removals --- .../changelog/add-agent-providers-frontend | 4 ++ .../agents-manager/class-agents-manager.php | 32 ++++++++++ .../agents-manager/Agents_Manager_Test.php | 58 +++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/add-agent-providers-frontend diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-agent-providers-frontend b/projects/packages/jetpack-mu-wpcom/changelog/add-agent-providers-frontend new file mode 100644 index 000000000000..f46d9f3e8caa --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-agent-providers-frontend @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Adds a new hook to get async loaded agent providers in the frontend diff --git a/projects/packages/jetpack-mu-wpcom/src/features/agents-manager/class-agents-manager.php b/projects/packages/jetpack-mu-wpcom/src/features/agents-manager/class-agents-manager.php index caa8d4b25ebb..dadfd799390b 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/agents-manager/class-agents-manager.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/agents-manager/class-agents-manager.php @@ -24,6 +24,38 @@ class Agents_Manager { public function __construct() { add_action( 'rest_api_init', array( $this, 'register_rest_api' ) ); add_filter( 'calypso_preferences_update', array( $this, 'calypso_preferences_update' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'add_inline_script' ), 101 ); + add_action( 'wp_enqueue_scripts', array( $this, 'add_inline_script' ), 101 ); + add_action( 'next_admin_init', array( $this, 'add_inline_script' ), 1001 ); + } + + /** + * Add inline script data for the Agents Manager. + */ + public function add_inline_script() { + /** + * Filter to register agent provider modules for the Agents Manager. + * + * Plugins can hook into this filter to register script module IDs that export + * toolProvider and/or contextProvider. The Agents Manager JS will dynamically + * import these modules and merge their providers. + * + * @param array $providers Array of provider script module IDs. + */ + $agent_providers = apply_filters( 'agents_manager_agent_providers', array() ); + + // For now, we want this added wherever the help-center script is enqueued. + // This allows us to be quite blunt here because the logic for whether to inject this is currently + // in the help-center script. + wp_add_inline_script( + 'help-center', + 'const agentsManagerData = ' . wp_json_encode( + array( + 'agentProviders' => $agent_providers, + ) + ) . ';', + 'before' + ); } /** diff --git a/projects/packages/jetpack-mu-wpcom/tests/php/features/agents-manager/Agents_Manager_Test.php b/projects/packages/jetpack-mu-wpcom/tests/php/features/agents-manager/Agents_Manager_Test.php index d9f7042f0253..43c9249383bf 100644 --- a/projects/packages/jetpack-mu-wpcom/tests/php/features/agents-manager/Agents_Manager_Test.php +++ b/projects/packages/jetpack-mu-wpcom/tests/php/features/agents-manager/Agents_Manager_Test.php @@ -42,6 +42,9 @@ public function tear_down() { // Remove hooks added by the Agents_Manager constructor. remove_action( 'rest_api_init', array( $this->agents_manager, 'register_rest_api' ) ); remove_filter( 'calypso_preferences_update', array( $this->agents_manager, 'calypso_preferences_update' ) ); + remove_action( 'wp_enqueue_scripts', array( $this->agents_manager, 'add_inline_script' ), 101 ); + remove_action( 'admin_enqueue_scripts', array( $this->agents_manager, 'add_inline_script' ), 101 ); + remove_action( 'next_admin_init', array( $this->agents_manager, 'add_inline_script' ), 1001 ); // Reset the REST server to clear any registered routes. global $wp_rest_server; @@ -265,4 +268,59 @@ public function test_init_creates_singleton_instance() { // Reset back to null for other tests $property->setValue( $dummy, null ); } + + /** + * Tests that add_inline_script adds script with empty providers by default. + */ + public function test_add_inline_script_with_empty_providers() { + // Register the help-center script so we can attach inline script to it. + wp_register_script( 'help-center', 'https://example.com/help-center.js', array(), '1.0', true ); + + $this->agents_manager->add_inline_script(); + + global $wp_scripts; + $inline_scripts = $wp_scripts->registered['help-center']->extra['before'] ?? array(); + + // Find the inline script containing agentsManagerData (wp_add_inline_script may add at different indices). + $inline_script = implode( "\n", array_filter( $inline_scripts ) ); + + $this->assertStringContainsString( 'const agentsManagerData =', $inline_script ); + $this->assertStringContainsString( '"agentProviders":[]', $inline_script ); + } + + /** + * Tests that add_inline_script includes providers added via the filter. + */ + public function test_add_inline_script_includes_filtered_providers() { + // Reset the script registry to ensure test isolation. + global $wp_scripts; + $wp_scripts = null; + + // Register the help-center script so we can attach inline script to it. + wp_register_script( 'help-center', 'https://example.com/help-center.js', array(), '1.0', true ); + + // Add a filter to provide agent providers. + add_filter( + 'agents_manager_agent_providers', + function () { + return array( 'my-plugin/tool-provider.js', 'another-plugin/context-provider.js' ); + } + ); + + $this->agents_manager->add_inline_script(); + + // Re-fetch global after wp_register_script initializes it. + $inline_scripts = $wp_scripts->registered['help-center']->extra['before'] ?? array(); // @phan-suppress-current-line PhanTypeExpectedObjectPropAccessButGotNull + + // Find the inline script containing agentsManagerData (wp_add_inline_script may add at different indices). + $inline_script = implode( "\n", array_filter( $inline_scripts ) ); + + $this->assertStringContainsString( 'const agentsManagerData =', $inline_script ); + // JSON encodes forward slashes as \/. + $this->assertStringContainsString( 'my-plugin\\/tool-provider.js', $inline_script ); + $this->assertStringContainsString( 'another-plugin\\/context-provider.js', $inline_script ); + + // Clean up the filter. + remove_all_filters( 'agents_manager_agent_providers' ); + } } From 12105b2a5ebf70f16ffda65448192f2c3146aa2b Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Wed, 3 Dec 2025 07:45:58 -0700 Subject: [PATCH 19/49] Packages and Tools: Ensure proper flags are used with json_encode() (#46092) This is a best-effort application of proper flags for `json_encode()` and `wp_json_encode()`. It also includes some cleanup of PHP 5.2 compatibility (`JSON.parse(decodeURIComponent())`), which was a workaround for when the flags we now use did not exist. --------- Co-authored-by: Brad Jorsch --- .../changelog/fix-audit_json_encode_flags | 4 ++ .../tests/php/Email_Service_Test.php | 7 ++- .../tests/php/Validation_Service_Test.php | 9 ++- .../changelog/fix-audit_json_encode_flags | 4 ++ .../src/Declarations/class-class-method.php | 2 +- .../src/Declarations/class-function.php | 2 +- .../packages/analyzer/src/api/class-model.php | 2 +- .../analyzer/src/class-PersistentList.php | 3 +- .../changelog/fix-audit_json_encode_flags | 4 ++ projects/packages/assets/src/class-assets.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../php/lib/class-test-plugin-factory.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../backup/src/class-initial-state.php | 2 +- .../backup/tests/php/REST_Controller_Test.php | 12 ++-- .../changelog/fix-audit_json_encode_flags | 4 ++ .../blaze/src/class-dashboard-config-data.php | 3 +- .../src/class-dashboard-rest-controller.php | 2 +- .../packages/blaze/tests/php/Blaze_Test.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../boost-core/src/lib/class-utils.php | 4 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../tests/php/tests/lib/ChangeEntryTest.php | 2 +- .../php/tests/lib/ChangelogEntryTest.php | 4 +- .../tests/php/tests/lib/ChangelogTest.php | 2 +- .../tests/php/tests/src/UtilsTest.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../src/custom-content-types.php | 19 +++--- .../AttributesSniff/CoverageHandler.php | 14 +++-- .../AttributesSniff/DependsHandler.php | 2 +- .../ExcludeThingFromBackupHandler.php | 4 +- .../PHPUnit/AttributesSniff/Handler.php | 2 +- .../AttributesSniff/RequiresHandler.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../changelog/fix-audit_json_encode_flags | 4 ++ .../legacy/class-jetpack-signature.php | 5 +- .../legacy/class-jetpack-xmlrpc-server.php | 3 +- .../packages/connection/src/class-client.php | 9 ++- .../src/class-connection-notice.php | 6 +- .../connection/src/class-error-handler.php | 2 +- .../connection/src/class-initial-state.php | 2 +- .../src/class-package-version-tracker.php | 3 +- .../connection/src/class-plugin-storage.php | 3 +- .../connection/src/class-rest-connector.php | 3 +- .../src/identity-crisis/class-ui.php | 2 +- .../tests/php/Connection_Notice_Test.php | 2 +- .../tests/php/Initial_State_Test.php | 2 +- .../tests/php/Partner_Coupon_Test.php | 2 +- .../tests/php/REST_Endpoints_Test.php | 59 ++++++++++--------- .../connection/tests/php/TokensTest.php | 4 +- .../tests/php/XMLRPC_Connector_Test.php | 9 ++- .../identity-crisis/Identity_Crisis_Test.php | 12 ++-- .../identity-crisis/REST_Endpoints_Test.php | 6 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../src/class-external-connections.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../src/class-external-media.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../contact-form/class-contact-form-block.php | 2 +- .../forms/src/contact-form/class-admin.php | 19 +++--- .../contact-form/class-contact-form-field.php | 18 +++--- .../class-contact-form-plugin.php | 10 ++-- .../src/contact-form/class-contact-form.php | 12 +++- .../forms/src/contact-form/class-feedback.php | 2 +- .../src/contact-form/class-form-view.php | 6 +- .../forms/src/dashboard/class-dashboard.php | 2 +- .../Contact_Form_Endpoint_Test.php | 2 +- .../contact-form/Contact_Form_Plugin_Test.php | 4 +- .../php/contact-form/Contact_Form_Test.php | 10 ++-- .../tests/php/contact-form/Feedback_Test.php | 5 +- .../tests/php/contact-form/class-utility.php | 4 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../src/class-amp-analytics.php | 2 +- .../google-analytics/src/class-ga-manager.php | 33 +++++++---- .../google-analytics/src/class-legacy.php | 28 +++++++-- .../google-analytics/src/class-universal.php | 16 ++--- .../php/Jetpack_Google_Analytics_Test.php | 33 +++++++---- .../changelog/fix-audit_json_encode_flags | 4 ++ .../src/class-jetpack-mu-wpcom.php | 6 +- .../help-center/class-help-center.php | 6 +- .../launchpad/launchpad-task-definitions.php | 2 +- .../src/features/launchpad/launchpad.php | 2 +- .../src/features/marketing/marketing.php | 2 +- .../src/features/newspack-blocks/index.php | 3 +- .../replace-site-visibility.php | 8 +-- .../assets/class-verbum-moderate.php | 3 +- .../verbum-comments/class-verbum-comments.php | 7 ++- .../class-wpcom-block-editor-nux.php | 4 +- .../wpcom-command-palette.php | 3 +- .../wpcom-dashboard-widgets.php | 3 +- .../features/wpcom-global-styles/index.php | 3 +- .../features/wpcom-imports/wpcom-imports.php | 3 +- .../wpcom-media/wpcom-media-url-upload.php | 3 +- .../wpcom-options-general/options-general.php | 3 +- .../wpcom-sidebar-notice.php | 6 +- ...OM_REST_API_V2_Endpoint_Launchpad_Test.php | 18 +++--- .../jwt/changelog/fix-audit_json_encode_flags | 4 ++ projects/packages/jwt/src/class-jwt.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../tests/php/Licensing_Endpoints_Test.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../admin-menu/class-atomic-admin-menu.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../packages/my-jetpack/src/class-rest-ai.php | 2 +- .../tests/php/Products_Rest_Test.php | 6 +- .../tests/php/Wpcom_Products_Test.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../plans/tests/php/Jetpack_Plan_Test.php | 3 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../tests/php/Scan_Status_Test.php | 6 +- .../protect-status/tests/php/Status_Test.php | 8 +-- .../changelog/fix-audit_json_encode_flags | 4 ++ .../publicize/src/class-publicize-ui.php | 3 +- .../publicize/src/class-share-limits.php | 2 +- .../src/social-image-generator/utilities.php | 2 +- .../php/Scheduled_Actions_Controller_Test.php | 2 +- ...Social_Image_Generator_Controller_Test.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ projects/packages/schema/src/class-utils.php | 2 +- .../schema/src/types/class-type-any-json.php | 2 +- .../Integration_Serialization_Test.php | 12 ++-- .../changelog/fix-audit_json_encode_flags | 4 ++ .../classic-search/class-classic-search.php | 2 +- .../src/customberg/class-customberg.php | 2 +- .../src/dashboard/class-initial-state.php | 2 +- .../instant-search/class-instant-search.php | 4 +- .../tests/php/Inline_Search_Filters_Test.php | 3 +- .../search/tests/php/Inline_Search_Test.php | 3 +- .../search/tests/php/REST_Controller_Test.php | 19 +++--- .../changelog/fix-audit_json_encode_flags | 4 ++ .../stats-admin/src/class-notices.php | 3 +- .../stats-admin/src/class-odyssey-assets.php | 3 +- .../src/class-odyssey-config-data.php | 3 +- .../stats-admin/src/class-rest-controller.php | 3 +- .../stats-admin/src/class-wpcom-client.php | 4 +- .../tests/php/Odyssey_Assets_Test.php | 9 ++- .../changelog/fix-audit_json_encode_flags | 4 ++ .../stats/src/class-tracking-pixel.php | 9 ++- .../packages/stats/src/class-wpcom-stats.php | 6 +- .../stats/tests/php/Tracking_Pixel_Test.php | 4 +- .../stats/tests/php/WPCOM_Stats_Test.php | 48 +++++++-------- .../changelog/fix-audit_json_encode_flags | 4 ++ projects/packages/sync/src/class-actions.php | 2 +- .../packages/sync/src/class-functions.php | 2 +- .../src/class-json-deflate-array-codec.php | 2 +- .../sync/src/modules/class-module.php | 9 ++- .../sync/src/modules/class-updates.php | 2 +- .../packages/sync/tests/php/Actions_Test.php | 6 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../tests/php/REST_Controller_Test.php | 12 ++-- .../changelog/fix-audit_json_encode_flags | 4 ++ .../videopress/src/class-admin-ui.php | 2 +- .../videopress/src/class-initializer.php | 2 +- ...-wpcom-rest-api-v2-endpoint-videopress.php | 4 +- .../src/tus/class-tus-abstract-cache.php | 2 +- .../tests/php/VideoPress_Uploader_Test.php | 2 +- .../waf/changelog/fix-audit_json_encode_flags | 4 ++ .../waf/src/class-brute-force-protection.php | 4 +- .../waf/src/class-waf-blocklog-manager.php | 6 +- .../php/integration/WafActivationTest.php | 2 +- .../integration/WafRestIntegrationTest.php | 8 ++- .../waf/tests/php/unit/WafRequestTest.php | 6 +- .../tests/php/unit/WafRuntimeTargetsTest.php | 2 +- .../changelog/fix-audit_json_encode_flags | 4 ++ .../src/class-universal.php | 6 +- .../src/class-wc-analytics-tracking.php | 2 +- .../src/class-woo-analytics-trait.php | 2 +- .../doc-parser/src/class-doc-parser.php | 2 +- tools/docker/mu-plugins/debug.php | 2 +- tools/e2e-commons/plugins/e2e-plan-helper.php | 2 +- .../plugins/e2e-waf-data-interceptor.php | 3 +- 171 files changed, 597 insertions(+), 350 deletions(-) create mode 100644 projects/packages/account-protection/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/analyzer/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/assets/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/autoloader/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/backup/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/blaze/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/boost-core/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/changelogger/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/classic-theme-helper/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/codesniffer/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/connection/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/external-connections/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/external-media/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/forms/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/google-analytics/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/jwt/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/licensing/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/masterbar/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/my-jetpack/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/plans/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/protect-status/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/publicize/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/schema/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/search/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/stats-admin/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/stats/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/sync/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/transport-helper/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/videopress/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/waf/changelog/fix-audit_json_encode_flags create mode 100644 projects/packages/woocommerce-analytics/changelog/fix-audit_json_encode_flags diff --git a/projects/packages/account-protection/changelog/fix-audit_json_encode_flags b/projects/packages/account-protection/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/account-protection/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/account-protection/tests/php/Email_Service_Test.php b/projects/packages/account-protection/tests/php/Email_Service_Test.php index a88311fc1df2..9a667454355f 100644 --- a/projects/packages/account-protection/tests/php/Email_Service_Test.php +++ b/projects/packages/account-protection/tests/php/Email_Service_Test.php @@ -147,7 +147,7 @@ function ( $body ) { )->willReturn( array( 'response' => array( 'code' => 200 ), - 'body' => json_encode( array( 'email_send_success' => true ) ), + 'body' => json_encode( array( 'email_send_success' => true ), JSON_UNESCAPED_SLASHES ), ) ); @@ -197,7 +197,8 @@ public function test_api_send_auth_email_returns_error_if_response_code_is_not_2 'code' => 'email_send_error', 'message' => 'Failed to send authentication code.', 'email_send_success' => true, - ) + ), + JSON_UNESCAPED_SLASHES ), ) ); @@ -252,7 +253,7 @@ public function test_api_send_auth_email_returns_error_if_response_from_api_is_f ->willReturn( array( 'response' => array( 'code' => 200 ), - 'body' => json_encode( array( 'email_sent' => false ) ), + 'body' => json_encode( array( 'email_sent' => false ), JSON_UNESCAPED_SLASHES ), ) ); diff --git a/projects/packages/account-protection/tests/php/Validation_Service_Test.php b/projects/packages/account-protection/tests/php/Validation_Service_Test.php index 6816576a32e5..c942f0eb2598 100644 --- a/projects/packages/account-protection/tests/php/Validation_Service_Test.php +++ b/projects/packages/account-protection/tests/php/Validation_Service_Test.php @@ -237,7 +237,8 @@ public function test_returns_true_if_password_is_compromised() { 'body' => json_encode( array( 'compromised' => array( 'c90fcfd699f0ddbdcb30c2c9183d2d933ea' ), - ) + ), + JSON_UNESCAPED_SLASHES ), ) ); @@ -261,7 +262,8 @@ public function test_returns_true_if_password_is_common() { 'body' => json_encode( array( 'common' => array( 'c90fcfd699f0ddbdcb30c2c9183d2d933ea' ), - ) + ), + JSON_UNESCAPED_SLASHES ), ) ); @@ -286,7 +288,8 @@ public function test_returns_false_if_password_is_not_leaked() { array( 'compromised' => array( '1234' ), 'common' => array(), - ) + ), + JSON_UNESCAPED_SLASHES ), ) ); diff --git a/projects/packages/analyzer/changelog/fix-audit_json_encode_flags b/projects/packages/analyzer/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/analyzer/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/analyzer/src/Declarations/class-class-method.php b/projects/packages/analyzer/src/Declarations/class-class-method.php index 77f05132787d..ba337b22a282 100644 --- a/projects/packages/analyzer/src/Declarations/class-class-method.php +++ b/projects/packages/analyzer/src/Declarations/class-class-method.php @@ -34,7 +34,7 @@ function to_csv_array() { $this->class_name, $this->method_name, $this->static, - json_encode( $this->params ), + json_encode( $this->params, JSON_UNESCAPED_SLASHES ), $this->deprecated, ); } diff --git a/projects/packages/analyzer/src/Declarations/class-function.php b/projects/packages/analyzer/src/Declarations/class-function.php index 1f55ffcc3c6c..7f142e819f82 100644 --- a/projects/packages/analyzer/src/Declarations/class-function.php +++ b/projects/packages/analyzer/src/Declarations/class-function.php @@ -30,7 +30,7 @@ function to_csv_array() { '', $this->func_name, '', - json_encode( $this->params ), + json_encode( $this->params, JSON_UNESCAPED_SLASHES ), $this->deprecated, ); } diff --git a/projects/packages/analyzer/src/api/class-model.php b/projects/packages/analyzer/src/api/class-model.php index 5aa928ff455d..b76a332eb0b5 100644 --- a/projects/packages/analyzer/src/api/class-model.php +++ b/projects/packages/analyzer/src/api/class-model.php @@ -87,7 +87,7 @@ public function persist( $arr = null ) { if ( $arr === null ) { $arr = $this->content; } - file_put_contents( $this->db_file, json_encode( $arr ) ); + file_put_contents( $this->db_file, json_encode( $arr, JSON_UNESCAPED_SLASHES ) ); } public function reset() { diff --git a/projects/packages/analyzer/src/class-PersistentList.php b/projects/packages/analyzer/src/class-PersistentList.php index f818120eb3b3..d0b50a17f50f 100644 --- a/projects/packages/analyzer/src/class-PersistentList.php +++ b/projects/packages/analyzer/src/class-PersistentList.php @@ -79,7 +79,8 @@ function ( $item ) { return $item->to_map(); }, $this->items - ) + ), + JSON_UNESCAPED_SLASHES ) ); } diff --git a/projects/packages/assets/changelog/fix-audit_json_encode_flags b/projects/packages/assets/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/assets/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/assets/src/class-assets.php b/projects/packages/assets/src/class-assets.php index 71725eec465a..e3050faa29f1 100644 --- a/projects/packages/assets/src/class-assets.php +++ b/projects/packages/assets/src/class-assets.php @@ -530,7 +530,7 @@ public static function wp_default_scripts_hook( $wp_scripts ) { } else { $data['domainMap'] = (object) $data['domainMap']; // Ensure it becomes a json object. $data['domainPaths'] = (object) $data['domainPaths']; // Ensure it becomes a json object. - $wp_scripts->add_inline_script( $handle, 'wp.jpI18nLoader.state = ' . wp_json_encode( $data, JSON_UNESCAPED_SLASHES ) . ';' ); + $wp_scripts->add_inline_script( $handle, 'wp.jpI18nLoader.state = ' . wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';' ); } // Deprecated state module: Depend on wp-i18n to ensure global `wp` exists and because anything needing this will need that too. diff --git a/projects/packages/autoloader/changelog/fix-audit_json_encode_flags b/projects/packages/autoloader/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/autoloader/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/autoloader/tests/php/lib/class-test-plugin-factory.php b/projects/packages/autoloader/tests/php/lib/class-test-plugin-factory.php index c92892edc2a1..63cb53762bec 100644 --- a/projects/packages/autoloader/tests/php/lib/class-test-plugin-factory.php +++ b/projects/packages/autoloader/tests/php/lib/class-test-plugin-factory.php @@ -538,7 +538,7 @@ private function has_plugin_changed( $plugin_dir, $plugin_file, &$composer_confi // Prepare a checksum object for comparison and store it in the composer config so we can retrieve it later. $factory_checksum = array( 'plugin' => hash( 'crc32', $plugin_file ), - 'composer' => hash( 'crc32', json_encode( $composer_config ) ), + 'composer' => hash( 'crc32', json_encode( $composer_config, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ), 'files' => array(), ); foreach ( $this->files as $path => $content ) { diff --git a/projects/packages/backup/changelog/fix-audit_json_encode_flags b/projects/packages/backup/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/backup/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/backup/src/class-initial-state.php b/projects/packages/backup/src/class-initial-state.php index 98a508472166..c945375bb150 100644 --- a/projects/packages/backup/src/class-initial-state.php +++ b/projects/packages/backup/src/class-initial-state.php @@ -64,6 +64,6 @@ private function get_data() { public function render() { add_action( 'jetpack_use_iframe_authorization_flow', '__return_true' ); - return 'var JPBACKUP_INITIAL_STATE=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( $this->get_data() ) ) . '"));'; + return 'var JPBACKUP_INITIAL_STATE=' . wp_json_encode( $this->get_data(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } } diff --git a/projects/packages/backup/tests/php/REST_Controller_Test.php b/projects/packages/backup/tests/php/REST_Controller_Test.php index 5bd3ea6635bb..b5d3c72fa8bc 100644 --- a/projects/packages/backup/tests/php/REST_Controller_Test.php +++ b/projects/packages/backup/tests/php/REST_Controller_Test.php @@ -112,7 +112,7 @@ public function test_install_backup_helper_script_unauthorized() { ); $request = new WP_REST_Request( 'POST', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 403, $response->get_status() ); $this->assertEquals( 'You are not allowed to perform this action.', $response->get_data()['message'] ); @@ -128,7 +128,7 @@ public function test_install_backup_helper_script_success() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->dispatch_request_signed_with_blog_token( $request ); $response_data = $response->get_data(); @@ -167,7 +167,7 @@ public function test_install_backup_helper_script_bad_header() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->dispatch_request_signed_with_blog_token( $request ); $this->assertEquals( 400, $response->get_status() ); @@ -196,7 +196,7 @@ public function test_delete_backup_helper_script_unauthorized() { $request = new WP_REST_Request( 'DELETE', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 403, $response->get_status() ); @@ -213,7 +213,7 @@ public function test_delete_backup_helper_script_success() { $request = new WP_REST_Request( 'DELETE', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->dispatch_request_signed_with_blog_token( $request ); $this->assertEquals( 200, $response->get_status() ); @@ -232,7 +232,7 @@ public function test_delete_backup_helper_script_bad_header() { $request = new WP_REST_Request( 'DELETE', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->dispatch_request_signed_with_blog_token( $request ); $this->assertEquals( 500, $response->get_status() ); diff --git a/projects/packages/blaze/changelog/fix-audit_json_encode_flags b/projects/packages/blaze/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/blaze/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/blaze/src/class-dashboard-config-data.php b/projects/packages/blaze/src/class-dashboard-config-data.php index 803acb1ec883..ba828f968946 100644 --- a/projects/packages/blaze/src/class-dashboard-config-data.php +++ b/projects/packages/blaze/src/class-dashboard-config-data.php @@ -50,7 +50,8 @@ public function __construct( $admin_page = 'tools.php', $menu_slug = 'advertisin */ public function get_js_config_data( $config_data = null ) { return 'window.configData = ' . wp_json_encode( - $config_data === null ? $this->get_data() : $config_data + $config_data === null ? $this->get_data() : $config_data, + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } diff --git a/projects/packages/blaze/src/class-dashboard-rest-controller.php b/projects/packages/blaze/src/class-dashboard-rest-controller.php index b064d4e31f28..0ea83adf2f20 100644 --- a/projects/packages/blaze/src/class-dashboard-rest-controller.php +++ b/projects/packages/blaze/src/class-dashboard-rest-controller.php @@ -863,7 +863,7 @@ protected function add_prices_in_posts( $posts ) { */ protected function request_as_user( $path, $version = '2', $args = array(), $body = null, $base_api_path = 'wpcom', $use_cache = false ) { // Arrays are serialized without considering the order of objects, but it's okay atm. - $cache_key = 'BLAZE_REST_RESP_' . md5( implode( '|', array( $path, $version, wp_json_encode( $args ), wp_json_encode( $body ), $base_api_path ) ) ); + $cache_key = 'BLAZE_REST_RESP_' . md5( implode( '|', array( $path, $version, wp_json_encode( $args, JSON_UNESCAPED_SLASHES ), wp_json_encode( $body, JSON_UNESCAPED_SLASHES ), $base_api_path ) ) ); if ( $use_cache ) { $response_body_content = get_transient( $cache_key ); diff --git a/projects/packages/blaze/tests/php/Blaze_Test.php b/projects/packages/blaze/tests/php/Blaze_Test.php index f4f7098a4a19..84f2c55b0f89 100644 --- a/projects/packages/blaze/tests/php/Blaze_Test.php +++ b/projects/packages/blaze/tests/php/Blaze_Test.php @@ -206,7 +206,7 @@ public function test_site_supports_blaze( $eligibility_details, $expected_eligib set_transient( 'jetpack_blaze_site_supports_blaze_0', $eligibility_details['transient'] ); } else { if ( isset( $eligibility_details['body'] ) ) { - $eligibility_details['body'] = wp_json_encode( $eligibility_details['body'] ); + $eligibility_details['body'] = wp_json_encode( $eligibility_details['body'], JSON_UNESCAPED_SLASHES ); } $remote_request_happened = true; diff --git a/projects/packages/boost-core/changelog/fix-audit_json_encode_flags b/projects/packages/boost-core/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/boost-core/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/boost-core/src/lib/class-utils.php b/projects/packages/boost-core/src/lib/class-utils.php index e16fd12e2816..0dc605ed7b95 100644 --- a/projects/packages/boost-core/src/lib/class-utils.php +++ b/projects/packages/boost-core/src/lib/class-utils.php @@ -38,7 +38,7 @@ public static function standardize_error( $error ) { if ( is_object( $error ) ) { return array( 'name' => 'Error', - 'message' => json_decode( wp_json_encode( $error ), true ), + 'message' => json_decode( wp_json_encode( $error, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), true ), ); } @@ -114,7 +114,7 @@ public static function send_wpcom_request( $method, $endpoint, $args = null, $bo $endpoint, '2', array_merge( $default_args, empty( $args ) ? array() : $args ), - empty( $body ) ? null : wp_json_encode( $body ), + empty( $body ) ? null : wp_json_encode( $body, JSON_UNESCAPED_SLASHES ), 'wpcom' ); diff --git a/projects/packages/changelogger/changelog/fix-audit_json_encode_flags b/projects/packages/changelogger/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/changelogger/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/changelogger/tests/php/tests/lib/ChangeEntryTest.php b/projects/packages/changelogger/tests/php/tests/lib/ChangeEntryTest.php index 661d7b6aa81c..03dc451d454d 100644 --- a/projects/packages/changelogger/tests/php/tests/lib/ChangeEntryTest.php +++ b/projects/packages/changelogger/tests/php/tests/lib/ChangeEntryTest.php @@ -410,7 +410,7 @@ public function testJson( $json, $change ) { $this->expectExceptionMessage( $change ); ChangeEntry::jsonUnserialize( json_decode( $json ) ); } else { - $this->assertSame( $json, json_encode( $change ) ); + $this->assertSame( $json, json_encode( $change, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $this->assertEquals( $change, ChangeEntry::jsonUnserialize( json_decode( $json ) ) ); } } diff --git a/projects/packages/changelogger/tests/php/tests/lib/ChangelogEntryTest.php b/projects/packages/changelogger/tests/php/tests/lib/ChangelogEntryTest.php index f565b3910936..41146db5cbd0 100644 --- a/projects/packages/changelogger/tests/php/tests/lib/ChangelogEntryTest.php +++ b/projects/packages/changelogger/tests/php/tests/lib/ChangelogEntryTest.php @@ -234,7 +234,7 @@ public function testJson( $json, $entry ) { $this->expectExceptionMessage( $entry ); ChangelogEntry::jsonUnserialize( json_decode( $json ) ); } else { - $this->assertSame( $json, json_encode( $entry ) ); + $this->assertSame( $json, json_encode( $entry, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $this->assertEquals( $entry, ChangelogEntry::jsonUnserialize( json_decode( $json ) ) ); } } @@ -249,7 +249,7 @@ public static function provideJson() { ( new ChangelogEntry( '1.0' ) )->setTimestamp( '2021-02-18' ), ), 'Serialization with data' => array( - '{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\ChangelogEntry","version":"1.0","link":"https:\\/\\/example.org","timestamp":"2021-02-18T12:07:16-0500","prologue":"Foo","epilogue":"Bar","changes":[{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\ChangeEntry","significance":null,"timestamp":"2021-02-17T00:00:00+0000","subheading":"","author":"","content":""},{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\ChangeEntry","significance":null,"timestamp":"2021-02-18T00:00:00+0000","subheading":"","author":"","content":""}]}', + '{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\ChangelogEntry","version":"1.0","link":"https://example.org","timestamp":"2021-02-18T12:07:16-0500","prologue":"Foo","epilogue":"Bar","changes":[{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\ChangeEntry","significance":null,"timestamp":"2021-02-17T00:00:00+0000","subheading":"","author":"","content":""},{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\ChangeEntry","significance":null,"timestamp":"2021-02-18T00:00:00+0000","subheading":"","author":"","content":""}]}', ( new ChangelogEntry( '1.0' ) )->setTimestamp( '2021-02-18T12:07:16-0500' )->setPrologue( 'Foo' )->setEpilogue( 'Bar' )->setLink( 'https://example.org' )->setChanges( array( new ChangeEntry( array( 'timestamp' => '2021-02-17' ) ), diff --git a/projects/packages/changelogger/tests/php/tests/lib/ChangelogTest.php b/projects/packages/changelogger/tests/php/tests/lib/ChangelogTest.php index 4acfbd3c243d..9e11795e47e6 100644 --- a/projects/packages/changelogger/tests/php/tests/lib/ChangelogTest.php +++ b/projects/packages/changelogger/tests/php/tests/lib/ChangelogTest.php @@ -104,7 +104,7 @@ public function testJson( $json, $changelog ) { $this->expectExceptionMessage( $changelog ); Changelog::jsonUnserialize( json_decode( $json ) ); } else { - $this->assertSame( $json, json_encode( $changelog ) ); + $this->assertSame( $json, json_encode( $changelog, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $this->assertEquals( $changelog, Changelog::jsonUnserialize( json_decode( $json ) ) ); } } diff --git a/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php b/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php index fea87b64ca80..ff841a9e8cd6 100644 --- a/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php +++ b/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php @@ -460,7 +460,7 @@ function ( $data ) { $this->assertSame( '{"a":{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\ChangeEntry","significance":"minor","timestamp":"2021-02-22T00:00:00+0000","subheading":"Added!","author":"","content":"AAAAA"},"b":{"__class__":"Automattic\\\\Jetpack\\\\Changelog\\\\ChangeEntry","significance":"minor","timestamp":"2021-02-24T00:00:00+0000","subheading":"Unknown","author":"","content":"BBBBB"}}', - json_encode( $ret ) + json_encode( $ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $this->assertSame( array( diff --git a/projects/packages/classic-theme-helper/changelog/fix-audit_json_encode_flags b/projects/packages/classic-theme-helper/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/classic-theme-helper/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/classic-theme-helper/src/custom-content-types.php b/projects/packages/classic-theme-helper/src/custom-content-types.php index 05c570906466..877c0bdefd2a 100644 --- a/projects/packages/classic-theme-helper/src/custom-content-types.php +++ b/projects/packages/classic-theme-helper/src/custom-content-types.php @@ -54,16 +54,15 @@ function jetpack_custom_post_types_loaded() { if ( ! isset( $_GET['page'] ) || 'jetpack' !== $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are not processing any data here. return; } - $initial_state = 'var CUSTOM_CONTENT_TYPE__INITIAL_STATE; typeof CUSTOM_CONTENT_TYPE__INITIAL_STATE === "object" || (CUSTOM_CONTENT_TYPE__INITIAL_STATE = JSON.parse(decodeURIComponent("' . rawurlencode( - wp_json_encode( - array( - 'active' => classic_theme_helper_cpt_should_be_active(), - 'over_ride' => false, - 'should_show_testimonials' => Jetpack_Testimonial::site_should_display_testimonials() ? true : false, - 'should_show_portfolios' => Jetpack_Portfolio::site_should_display_portfolios() ? true : false, - ) - ) - ) . '")));'; + $initial_state = 'var CUSTOM_CONTENT_TYPE__INITIAL_STATE; typeof CUSTOM_CONTENT_TYPE__INITIAL_STATE === "object" || (CUSTOM_CONTENT_TYPE__INITIAL_STATE = ' . wp_json_encode( + array( + 'active' => classic_theme_helper_cpt_should_be_active(), + 'over_ride' => false, + 'should_show_testimonials' => Jetpack_Testimonial::site_should_display_testimonials() ? true : false, + 'should_show_portfolios' => Jetpack_Portfolio::site_should_display_portfolios() ? true : false, + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP + ) . ');'; // Create a global variable with the custom content type feature status so that the value is available // earlier than the API method above allows, preventing delayed loading of the settings card. diff --git a/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/CoverageHandler.php b/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/CoverageHandler.php index 896641e7489f..92840b5a6ef6 100644 --- a/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/CoverageHandler.php +++ b/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/CoverageHandler.php @@ -184,7 +184,8 @@ public function process( File $phpcsFile, $stackPtr, array $attributes, array $a 'type' => 'class', 'class' => $d->class, 'alias' => $d->alias, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); $ktrait = json_encode( array( @@ -192,7 +193,8 @@ public function process( File $phpcsFile, $stackPtr, array $attributes, array $a 'type' => 'trait', 'class' => $d->class, 'alias' => $d->alias, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); if ( isset( $attributes[ $kclass ] ) ) { $annotations[ $kclass ] = $annotations[ $k ]; @@ -219,7 +221,8 @@ public function process( File $phpcsFile, $stackPtr, array $attributes, array $a 'type' => 'class', 'class' => $d->class, 'alias' => $d->alias, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); if ( isset( $attributes[ $kclass ] ) ) { unset( $attributes[ $k ] ); @@ -253,13 +256,14 @@ public function process( File $phpcsFile, $stackPtr, array $attributes, array $a if ( isset( $annotationsByType[ $which ]['function'] ) ) { foreach ( $annotationsByType[ $which ]['function'] as $k => $d ) { $k2 = json_encode( - (object) array( + array( 'which' => $d->which, 'type' => 'method', 'class' => $dc->class, 'alias' => $dc->alias, 'method' => $d->function, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); $annotations[ $k2 ] = $annotations[ $k ]; unset( $annotations[ $k ] ); diff --git a/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/DependsHandler.php b/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/DependsHandler.php index 292a0782dde4..ea6358bc7791 100644 --- a/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/DependsHandler.php +++ b/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/DependsHandler.php @@ -140,7 +140,7 @@ public function parseAnnotation( File $phpcsFile, array $data, $applies ) { // p } } - return json_encode( $ret ); + return json_encode( $ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); } /** {@inheritdoc} */ diff --git a/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/ExcludeThingFromBackupHandler.php b/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/ExcludeThingFromBackupHandler.php index ad9b2b75956d..7a1412b2719e 100644 --- a/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/ExcludeThingFromBackupHandler.php +++ b/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/ExcludeThingFromBackupHandler.php @@ -68,7 +68,7 @@ public function parseAttribute( File $phpcsFile, array $data, $applies ) { // ph throw new InvalidArgumentException( "Unrecognized attribute {$data['name']}" ); // @codeCoverageIgnore } - return json_encode( $ret ); + return json_encode( $ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); } /** @@ -111,7 +111,7 @@ public function parseAnnotation( File $phpcsFile, array $data, $applies ) { // p throw new InvalidArgumentException( "Unrecognized attribute {$data['name']}" ); // @codeCoverageIgnore } - return json_encode( $ret ); + return json_encode( $ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); } /** {@inheritdoc} */ diff --git a/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/Handler.php b/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/Handler.php index 023b9112df03..8811b1bdf0e9 100644 --- a/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/Handler.php +++ b/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/Handler.php @@ -415,6 +415,6 @@ protected static function json_encode_no_nulls( $obj ) { return null; } } - return json_encode( $obj ); + return json_encode( $obj, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); } } diff --git a/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/RequiresHandler.php b/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/RequiresHandler.php index c8bb7d8b21fe..091ffe41b92a 100644 --- a/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/RequiresHandler.php +++ b/projects/packages/codesniffer/Jetpack/Sniffs/PHPUnit/AttributesSniff/RequiresHandler.php @@ -151,7 +151,7 @@ public function parseAnnotation( File $phpcsFile, array $data, $applies ) { // p return null; } - return json_encode( $ret ); + return json_encode( $ret, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); } /** diff --git a/projects/packages/codesniffer/changelog/fix-audit_json_encode_flags b/projects/packages/codesniffer/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/codesniffer/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/connection/changelog/fix-audit_json_encode_flags b/projects/packages/connection/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/connection/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/connection/legacy/class-jetpack-signature.php b/projects/packages/connection/legacy/class-jetpack-signature.php index 645db600d2e9..0ed4b8864c9d 100644 --- a/projects/packages/connection/legacy/class-jetpack-signature.php +++ b/projects/packages/connection/legacy/class-jetpack-signature.php @@ -168,7 +168,10 @@ public function sign_request( $token = '', $timestamp = 0, $nonce = '', $body_ha if ( is_array( $body ) ) { if ( $body !== array() ) { // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode - $body = json_encode( $body ); + $body = json_encode( + $body, + 0 // No `json_encode()` flags because this needs to match whatever is calculating the hash on the other end. + ); } else { $body = ''; diff --git a/projects/packages/connection/legacy/class-jetpack-xmlrpc-server.php b/projects/packages/connection/legacy/class-jetpack-xmlrpc-server.php index 5dc5733e1148..a63fb714d1a5 100644 --- a/projects/packages/connection/legacy/class-jetpack-xmlrpc-server.php +++ b/projects/packages/connection/legacy/class-jetpack-xmlrpc-server.php @@ -720,7 +720,8 @@ public function test_api_user_code( $args ) { 'user_id' => $user_id, 'nonce' => $nonce, 'code' => (string) $api_user_code, - ) + ), + 0 // No `json_encode()` flags because this needs to match whatever is calculating the hash on the other end. ), $jetpack_token->secret ); diff --git a/projects/packages/connection/src/class-client.php b/projects/packages/connection/src/class-client.php index 0ba9c4820801..d5a6bcfac6c5 100644 --- a/projects/packages/connection/src/class-client.php +++ b/projects/packages/connection/src/class-client.php @@ -164,7 +164,10 @@ public static function build_signed_request( $args, $body = null ) { // We cast this to a new variable, because the array form of $body needs to be // maintained so it can be passed into the request later on in the code. if ( array() !== $body_to_hash ) { - $body_to_hash = wp_json_encode( self::_stringify_data( $body_to_hash ) ); + $body_to_hash = wp_json_encode( + self::_stringify_data( $body_to_hash ), + 0 // No `json_encode()` flags because this needs to match whatever is calculating the hash on the other end. + ); } else { $body_to_hash = ''; } @@ -417,7 +420,7 @@ public static function validate_args_for_wpcom_json_api_request( * @param string $path REST API path. * @param string $version REST API version. Default is `2`. * @param array $args Arguments to {@see WP_Http}. Default is `array()`. - * @param null|string|array $body Body passed to {@see WP_Http}. Default is `null`. + * @param null|string|array $body Body passed to {@see WP_Http}. Default is `null`. * @param string $base_api_path REST API root. Default is `wpcom`. * * @return array|WP_Error $response Response data, else {@see WP_Error} on failure. @@ -438,7 +441,7 @@ public static function wpcom_json_api_request_as_user( } if ( isset( $body ) && ! is_string( $body ) ) { - $body = wp_json_encode( $body ); + $body = wp_json_encode( $body, JSON_UNESCAPED_SLASHES ); } return self::remote_request( $args, $body ); diff --git a/projects/packages/connection/src/class-connection-notice.php b/projects/packages/connection/src/class-connection-notice.php index c49c5c3da942..ceca340d7aa6 100644 --- a/projects/packages/connection/src/class-connection-notice.php +++ b/projects/packages/connection/src/class-connection-notice.php @@ -169,11 +169,11 @@ function ( $connected_admin ) { } fetch( - , + , { method: 'POST', headers: { - 'X-WP-Nonce': , + 'X-WP-Nonce': , }, body: new URLSearchParams( new FormData( this ) ), } @@ -182,7 +182,7 @@ function ( $connected_admin ) { .then( data => { if ( data.hasOwnProperty( 'code' ) && data.code === 'success' ) { // Owner successfully changed. - results.innerHTML = ; + results.innerHTML = ; setTimeout(function () { document.getElementById( 'jetpack-notice-switch-connection-owner' ).style.display = 'none'; }, 1000); diff --git a/projects/packages/connection/src/class-error-handler.php b/projects/packages/connection/src/class-error-handler.php index 3ab326dc43f8..5fb89b801514 100644 --- a/projects/packages/connection/src/class-error-handler.php +++ b/projects/packages/connection/src/class-error-handler.php @@ -665,7 +665,7 @@ public function encrypt_data_to_wpcom( $data ) { try { // phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode // phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode - $encrypted_data = base64_encode( sodium_crypto_box_seal( wp_json_encode( $data ), base64_decode( JETPACK__ERRORS_PUBLIC_KEY ) ) ); + $encrypted_data = base64_encode( sodium_crypto_box_seal( wp_json_encode( $data, JSON_UNESCAPED_SLASHES ), base64_decode( JETPACK__ERRORS_PUBLIC_KEY ) ) ); // phpcs:enable WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode // phpcs:enable WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode } catch ( \SodiumException $e ) { diff --git a/projects/packages/connection/src/class-initial-state.php b/projects/packages/connection/src/class-initial-state.php index e2545b84fe75..4840ad4b3a73 100644 --- a/projects/packages/connection/src/class-initial-state.php +++ b/projects/packages/connection/src/class-initial-state.php @@ -57,7 +57,7 @@ public static function set_connection_script_data( $data ) { * @return string */ public static function render() { - return 'var JP_CONNECTION_INITIAL_STATE; typeof JP_CONNECTION_INITIAL_STATE === "object" || (JP_CONNECTION_INITIAL_STATE = JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( self::get_data() ) ) . '")));'; + return 'var JP_CONNECTION_INITIAL_STATE; typeof JP_CONNECTION_INITIAL_STATE === "object" || (JP_CONNECTION_INITIAL_STATE = ' . wp_json_encode( self::get_data(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ');'; } /** diff --git a/projects/packages/connection/src/class-package-version-tracker.php b/projects/packages/connection/src/class-package-version-tracker.php index d4fed474486e..6044265d0827 100644 --- a/projects/packages/connection/src/class-package-version-tracker.php +++ b/projects/packages/connection/src/class-package-version-tracker.php @@ -152,7 +152,8 @@ protected function update_package_versions_via_remote_request( $package_versions $body = wp_json_encode( array( 'package_versions' => $package_versions, - ) + ), + JSON_UNESCAPED_SLASHES ); $response = Client::wpcom_json_api_request_as_blog( diff --git a/projects/packages/connection/src/class-plugin-storage.php b/projects/packages/connection/src/class-plugin-storage.php index c6a73c3c3483..a8a4a158cad3 100644 --- a/projects/packages/connection/src/class-plugin-storage.php +++ b/projects/packages/connection/src/class-plugin-storage.php @@ -243,7 +243,8 @@ private static function update_active_plugins_wpcom_no_sync_fallback() { $body = wp_json_encode( array( 'active_connected_plugins' => self::$plugins, - ) + ), + JSON_UNESCAPED_SLASHES ); Client::wpcom_json_api_request_as_blog( diff --git a/projects/packages/connection/src/class-rest-connector.php b/projects/packages/connection/src/class-rest-connector.php index 18ac894d5585..6285f58ee883 100644 --- a/projects/packages/connection/src/class-rest-connector.php +++ b/projects/packages/connection/src/class-rest-connector.php @@ -1103,7 +1103,8 @@ public static function is_request_signed_by_jetpack_debugger( $pub_key = null ) 'rest_route' => filter_var( wp_unslash( $_GET['rest_route'] ) ), 'timestamp' => (int) $_GET['timestamp'], 'url' => filter_var( wp_unslash( $_GET['url'] ) ), - ) + ), + 0 // No `json_encode()` flags because this needs to match whatever is calculating the hash on the other end. ); if ( diff --git a/projects/packages/connection/src/identity-crisis/class-ui.php b/projects/packages/connection/src/identity-crisis/class-ui.php index da8e908d77eb..0e85a019a84a 100644 --- a/projects/packages/connection/src/identity-crisis/class-ui.php +++ b/projects/packages/connection/src/identity-crisis/class-ui.php @@ -89,7 +89,7 @@ public static function render_container() { * @return string */ private static function get_initial_state() { - return 'var JP_IDENTITY_CRISIS__INITIAL_STATE=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( static::get_initial_state_data() ) ) . '"));'; + return 'var JP_IDENTITY_CRISIS__INITIAL_STATE=' . wp_json_encode( static::get_initial_state_data(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } /** diff --git a/projects/packages/connection/tests/php/Connection_Notice_Test.php b/projects/packages/connection/tests/php/Connection_Notice_Test.php index 41edd3385eef..10090e5c1ff6 100644 --- a/projects/packages/connection/tests/php/Connection_Notice_Test.php +++ b/projects/packages/connection/tests/php/Connection_Notice_Test.php @@ -69,7 +69,7 @@ public function test_delete_user_change_owner_notice() { $notice = new Connection_Notice(); $this->expectOutputRegex( '#Set new connection owner#i' ); - $this->expectOutputRegex( '#' . preg_quote( 'http:\/\/example.org\/index.php?rest_route=\/jetpack\/v4\/connection\/owner', '#' ) . '#i' ); + $this->expectOutputRegex( '#' . preg_quote( 'http://example.org/index.php?rest_route=/jetpack/v4/connection/owner', '#' ) . '#i' ); $notice->delete_user_update_connection_owner_notice(); } diff --git a/projects/packages/connection/tests/php/Initial_State_Test.php b/projects/packages/connection/tests/php/Initial_State_Test.php index f925cafac6d0..a2b0ecbdafc4 100644 --- a/projects/packages/connection/tests/php/Initial_State_Test.php +++ b/projects/packages/connection/tests/php/Initial_State_Test.php @@ -49,7 +49,7 @@ function () { 'isOfflineMode' => ( new Status() )->is_offline_mode(), 'calypsoEnv' => 'wpcalypso', ); - $expected_value = 'var JP_CONNECTION_INITIAL_STATE; typeof JP_CONNECTION_INITIAL_STATE === "object" || (JP_CONNECTION_INITIAL_STATE = JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( $expected_state ) ) . '")));'; + $expected_value = 'var JP_CONNECTION_INITIAL_STATE; typeof JP_CONNECTION_INITIAL_STATE === "object" || (JP_CONNECTION_INITIAL_STATE = ' . wp_json_encode( $expected_state, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ');'; $actual_value = Initial_State::render(); diff --git a/projects/packages/connection/tests/php/Partner_Coupon_Test.php b/projects/packages/connection/tests/php/Partner_Coupon_Test.php index 32d89bd2b556..67ca6971c8c8 100644 --- a/projects/packages/connection/tests/php/Partner_Coupon_Test.php +++ b/projects/packages/connection/tests/php/Partner_Coupon_Test.php @@ -270,7 +270,7 @@ public function test_maybe_purge_coupon_by_availability_check( $mock_response, $ ); if ( isset( $mock_response['body'] ) ) { - $mock_response['body'] = wp_json_encode( $mock_response['body'] ); + $mock_response['body'] = wp_json_encode( $mock_response['body'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); } $callback = $this->getMockBuilder( \CallableMock::class )->getMock(); diff --git a/projects/packages/connection/tests/php/REST_Endpoints_Test.php b/projects/packages/connection/tests/php/REST_Endpoints_Test.php index 870c9e8e156b..54b079914745 100644 --- a/projects/packages/connection/tests/php/REST_Endpoints_Test.php +++ b/projects/packages/connection/tests/php/REST_Endpoints_Test.php @@ -460,7 +460,7 @@ public function test_connection_register() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/connection/register' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'registration_nonce' => wp_create_nonce( 'jetpack-registration-nonce' ) ) ) ); + $request->set_body( wp_json_encode( array( 'registration_nonce' => wp_create_nonce( 'jetpack-registration-nonce' ) ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); @@ -486,7 +486,7 @@ public function test_connection_register_with_alternate_auth_url() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/connection/register' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'registration_nonce' => wp_create_nonce( 'jetpack-registration-nonce' ) ) ) ); + $request->set_body( wp_json_encode( array( 'registration_nonce' => wp_create_nonce( 'jetpack-registration-nonce' ) ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); @@ -509,7 +509,7 @@ public function test_set_user_token_unauthenticated() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/user-token' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'user_token' => 'test.test.1' ) ) ); + $request->set_body( wp_json_encode( array( 'user_token' => 'test.test.1' ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); @@ -526,7 +526,7 @@ public function test_set_user_token_with_admin_user_fails_auth() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/user-token' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'user_token' => 'test.test.1' ) ) ); + $request->set_body( wp_json_encode( array( 'user_token' => 'test.test.1' ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); @@ -567,7 +567,7 @@ public function test_set_user_token_success() { $user_token = 'test.test.1'; - $request->set_body( wp_json_encode( array( 'user_token' => $user_token ) ) ); + $request->set_body( wp_json_encode( array( 'user_token' => $user_token ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); @@ -599,7 +599,7 @@ public function test_update_connection_owner_failures() { $this->assertEquals( 'Missing parameter(s): owner', $response->get_data()['message'] ); // Attempt owner change with bad user. - $request->set_body( wp_json_encode( array( 'owner' => 999 ) ) ); + $request->set_body( wp_json_encode( array( 'owner' => 999 ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 400, $response->get_status() ); $this->assertEquals( 'New owner is not admin', $response->get_data()['message'] ); @@ -607,7 +607,7 @@ public function test_update_connection_owner_failures() { // Change owner to valid user but XML-RPC request to WPCOM failed. add_filter( 'pre_http_request', array( $this, 'mock_xmlrpc_failure' ), 10, 3 ); - $request->set_body( wp_json_encode( array( 'owner' => self::$secondary_user_id ) ) ); + $request->set_body( wp_json_encode( array( 'owner' => self::$secondary_user_id ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); remove_filter( 'pre_http_request', array( $this, 'mock_xmlrpc_failure' ), 10 ); @@ -624,7 +624,7 @@ public function test_update_connection_owner_success() { // Change owner to valid user. $request = new WP_REST_Request( 'POST', '/jetpack/v4/connection/owner' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'owner' => self::$secondary_user_id ) ) ); + $request->set_body( wp_json_encode( array( 'owner' => self::$secondary_user_id ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); // Mock full connection established. add_filter( 'jetpack_options', array( $this, 'mock_jetpack_options' ), 10, 2 ); @@ -659,7 +659,7 @@ public function test_disconnect_site_with_missing_param() { public function test_disconnect_site_with_invalid_param() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/connection' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'isActive' => 'should_be_bool_false' ) ) ); + $request->set_body( wp_json_encode( array( 'isActive' => 'should_be_bool_false' ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $response_data = $response->get_data(); @@ -678,7 +678,7 @@ public function test_disconnect_site_with_invalid_user_permissions() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/connection' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'isActive' => false ) ) ); + $request->set_body( wp_json_encode( array( 'isActive' => false ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); @@ -692,7 +692,7 @@ public function test_disconnect_site_site_not_connected() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/connection' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'isActive' => false ) ) ); + $request->set_body( wp_json_encode( array( 'isActive' => false ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $response_data = $response->get_data(); @@ -707,7 +707,7 @@ public function test_disconnect_site_site_not_connected() { public function test_disconnect_site_success() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/connection' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'isActive' => false ) ) ); + $request->set_body( wp_json_encode( array( 'isActive' => false ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); // Mock full connection established. add_filter( 'jetpack_options', array( $this, 'mock_jetpack_options' ), 10, 2 ); @@ -739,7 +739,7 @@ public function test_disconnect_site_site_connection_success() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/connection' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'isActive' => false ) ) ); + $request->set_body( wp_json_encode( array( 'isActive' => false ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $response_data = $response->get_data(); @@ -765,7 +765,8 @@ public function test_unlink_user_success() { 'linked' => false, 'force' => true, 'disconnect-all-users' => true, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); @@ -793,7 +794,7 @@ public function test_unlink_user_success_when_non_admin_and_no_connection_owner( $request = new WP_REST_Request( 'POST', '/jetpack/v4/connection/user' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'linked' => false ) ) ); + $request->set_body( wp_json_encode( array( 'linked' => false ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); // Mock non-admin user connected with no connection owner. add_filter( 'jetpack_options', array( $this, 'mock_jetpack_options_no_connection_owner' ), 10, 2 ); @@ -1040,7 +1041,7 @@ public function test_remote_register_connected_unauthenticated() { 'local_user' => static::$user_id, 'nonce' => 'foobar', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); // Mock full connection established. add_filter( 'jetpack_options', array( $this, 'mock_jetpack_options' ), 10, 2 ); @@ -1068,7 +1069,7 @@ public function test_remote_register_not_connected_unauthenticated() { 'local_user' => -1, 'nonce' => 'foobar', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $response_data = $response->get_data(); @@ -1097,7 +1098,7 @@ public function test_remote_register_connected_authenticated() { 'local_user' => -1, 'nonce' => 'foobar', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $response_data = $response->get_data(); @@ -1118,7 +1119,7 @@ public function test_remote_provision_unauthenticated() { $request->set_header( 'Content-Type', 'application/json' ); $body = array( 'local_user' => static::$user_id ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); // Mock full connection established. add_filter( 'jetpack_options', array( $this, 'mock_jetpack_options' ), 10, 2 ); @@ -1149,7 +1150,7 @@ public function test_remote_provision_authenticated() { $request->set_header( 'Content-Type', 'application/json' ); $body = array( 'local_user' => -1 ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $response_data = $response->get_data(); @@ -1170,7 +1171,7 @@ public function test_remote_connect_unauthenticated() { $request->set_header( 'Content-Type', 'application/json' ); $body = array( 'local_user' => static::$user_id ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); // Mock full connection established. add_filter( 'jetpack_options', array( $this, 'mock_jetpack_options' ), 10, 2 ); @@ -1200,7 +1201,7 @@ public function test_remote_connect_authenticated() { $request->set_header( 'Content-Type', 'application/json' ); $body = array( 'local_user' => -1 ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $response_data = $response->get_data(); @@ -1388,7 +1389,8 @@ private static function get_register_request_mock_response( $allow_inplace_autho 'jetpack_secret' => 'sample_secret', 'allow_inplace_authorization' => $allow_inplace_authorization, 'alternate_authorization_url' => $alternate_authorization_url, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'response' => array( 'code' => 200, @@ -1464,7 +1466,7 @@ public function intercept_validate_tokens_request_failed( $response, $args, $url return array( 'headers' => new CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ), - 'body' => wp_json_encode( array( 'dummy_error' => true ) ), + 'body' => wp_json_encode( array( 'dummy_error' => true ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'response' => array( 'code' => 500, 'message' => 'failed', @@ -1507,7 +1509,7 @@ private function build_validate_tokens_response( $invalid_token ) { return array( 'headers' => new CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ), - 'body' => wp_json_encode( $body ), + 'body' => wp_json_encode( $body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'response' => array( 'code' => 200, 'message' => 'OK', @@ -1531,7 +1533,7 @@ public function intercept_refresh_blog_token_request( $response, $args, $url ) { return array( 'headers' => new CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ), - 'body' => wp_json_encode( array( 'jetpack_secret' => self::BLOG_TOKEN ) ), + 'body' => wp_json_encode( array( 'jetpack_secret' => self::BLOG_TOKEN ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'response' => array( 'code' => 200, 'message' => 'OK', @@ -1555,7 +1557,7 @@ public function intercept_refresh_blog_token_request_fail( $response, $args, $ur return array( 'headers' => new CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ), - 'body' => wp_json_encode( array( 'jetpack_secret_missing' => true ) ), // Meaningless body. + 'body' => wp_json_encode( array( 'jetpack_secret_missing' => true ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), // Meaningless body. 'response' => array( 'code' => 200, 'message' => 'OK', @@ -1584,7 +1586,8 @@ public function intercept_auth_token_request( $response, $args, $url ) { 'access_token' => 'mock.token', 'token_type' => 'X_JETPACK', 'scope' => ( new Manager() )->sign_role( 'administrator' ), - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'response' => array( 'code' => 200, diff --git a/projects/packages/connection/tests/php/TokensTest.php b/projects/packages/connection/tests/php/TokensTest.php index b7d57f8a0984..daf80c614640 100644 --- a/projects/packages/connection/tests/php/TokensTest.php +++ b/projects/packages/connection/tests/php/TokensTest.php @@ -207,7 +207,7 @@ public function intercept_jetpack_token_health_request_failed( $response, $args, return array( 'headers' => new CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ), - 'body' => wp_json_encode( array( 'dummy_error' => true ) ), + 'body' => wp_json_encode( array( 'dummy_error' => true ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'response' => array( 'code' => 500, 'message' => 'failed', @@ -241,7 +241,7 @@ public function intercept_jetpack_token_health_request_success( $response, $args return array( 'headers' => new CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ), - 'body' => wp_json_encode( $body ), + 'body' => wp_json_encode( $body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'response' => array( 'code' => 200, 'message' => 'OK', diff --git a/projects/packages/connection/tests/php/XMLRPC_Connector_Test.php b/projects/packages/connection/tests/php/XMLRPC_Connector_Test.php index ad8f5792df3e..896936f8311a 100644 --- a/projects/packages/connection/tests/php/XMLRPC_Connector_Test.php +++ b/projects/packages/connection/tests/php/XMLRPC_Connector_Test.php @@ -56,7 +56,14 @@ public static function setUpBeforeClass(): void { 'url' => 'https://example.com', ); - openssl_sign( wp_json_encode( $url_parameters ), $signature, $private_key ); + openssl_sign( + wp_json_encode( + $url_parameters, + 0 // No `json_encode()` flags because this needs to match whatever is calculating the hash on the other end. + ), + $signature, + $private_key + ); self::$signature = ( base64_encode( $signature ) ); } diff --git a/projects/packages/connection/tests/php/identity-crisis/Identity_Crisis_Test.php b/projects/packages/connection/tests/php/identity-crisis/Identity_Crisis_Test.php index a5b04f627f20..6271873632e3 100644 --- a/projects/packages/connection/tests/php/identity-crisis/Identity_Crisis_Test.php +++ b/projects/packages/connection/tests/php/identity-crisis/Identity_Crisis_Test.php @@ -656,7 +656,8 @@ public static function data_provider_test_check_http_response_for_idc_detected_i array( 'test1' => 'test 1', 'test2' => 'test 2', - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); return array( @@ -705,7 +706,8 @@ public static function data_provider_test_check_http_response_for_idc_detected_i 'wpcom_home' => 'example.com/', ), 'test' => 'test value', - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); $matching_error_code_body = wp_json_encode( @@ -718,7 +720,8 @@ public static function data_provider_test_check_http_response_for_idc_detected_i 'wpcom_home' => 'example.com/', ), 'test' => 'test value', - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); return array( @@ -745,7 +748,8 @@ public function test_check_http_response_for_idc_detected_migrated_for_idc() { 'body' => wp_json_encode( array( 'migrated_for_idc' => true, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), ); diff --git a/projects/packages/connection/tests/php/identity-crisis/REST_Endpoints_Test.php b/projects/packages/connection/tests/php/identity-crisis/REST_Endpoints_Test.php index e7924b5fa176..ee4af6ac9f91 100644 --- a/projects/packages/connection/tests/php/identity-crisis/REST_Endpoints_Test.php +++ b/projects/packages/connection/tests/php/identity-crisis/REST_Endpoints_Test.php @@ -253,7 +253,7 @@ public function test_compare_url_secret_match() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/identity-crisis/compare-url-secret' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'secret' => $secret_data['secret'] ) ) ); + $request->set_body( wp_json_encode( array( 'secret' => $secret_data['secret'] ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); @@ -274,7 +274,7 @@ public function test_compare_url_secret_no_match() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/identity-crisis/compare-url-secret' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'secret' => '54321fdsa' ) ) ); + $request->set_body( wp_json_encode( array( 'secret' => '54321fdsa' ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); @@ -292,7 +292,7 @@ public function test_compare_url_secret_no_access() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/identity-crisis/compare-url-secret' ); $request->set_header( 'Content-Type', 'application/json' ); - $request->set_body( wp_json_encode( array( 'secret' => '54321fdsa' ) ) ); + $request->set_body( wp_json_encode( array( 'secret' => '54321fdsa' ), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); diff --git a/projects/packages/external-connections/changelog/fix-audit_json_encode_flags b/projects/packages/external-connections/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/external-connections/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/external-connections/src/class-external-connections.php b/projects/packages/external-connections/src/class-external-connections.php index 5b8a55ecc0dc..37c2071646c1 100644 --- a/projects/packages/external-connections/src/class-external-connections.php +++ b/projects/packages/external-connections/src/class-external-connections.php @@ -274,7 +274,7 @@ function () use ( $service, $support_link ) { wp_add_inline_script( $asset_name, - 'const jetpackExternalConnectionsData = ' . wp_json_encode( $script_data ) . ';', + 'const jetpackExternalConnectionsData = ' . wp_json_encode( $script_data, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); } diff --git a/projects/packages/external-media/changelog/fix-audit_json_encode_flags b/projects/packages/external-media/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/external-media/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/external-media/src/class-external-media.php b/projects/packages/external-media/src/class-external-media.php index b91116c22a7b..77b35b90b85c 100644 --- a/projects/packages/external-media/src/class-external-media.php +++ b/projects/packages/external-media/src/class-external-media.php @@ -70,7 +70,7 @@ public static function enqueue_block_editor_assets() { wp_add_inline_script( $asset_name, - sprintf( 'var JetpackExternalMediaData = %s;', wp_json_encode( self::get_data() ) ), + sprintf( 'var JetpackExternalMediaData = %s;', wp_json_encode( self::get_data(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) ), 'before' ); diff --git a/projects/packages/forms/changelog/fix-audit_json_encode_flags b/projects/packages/forms/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/forms/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/forms/src/blocks/contact-form/class-contact-form-block.php b/projects/packages/forms/src/blocks/contact-form/class-contact-form-block.php index 006b80cbe31a..81b90d613a8f 100644 --- a/projects/packages/forms/src/blocks/contact-form/class-contact-form-block.php +++ b/projects/packages/forms/src/blocks/contact-form/class-contact-form-block.php @@ -794,7 +794,7 @@ public static function load_editor_scripts() { ), ); - wp_add_inline_script( $handle, 'window.jpFormsBlocks = ' . wp_json_encode( $data ) . ';', 'before' ); + wp_add_inline_script( $handle, 'window.jpFormsBlocks = ' . wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); } /** diff --git a/projects/packages/forms/src/contact-form/class-admin.php b/projects/packages/forms/src/contact-form/class-admin.php index 4ff00bfc370b..8ae2bec97ce9 100644 --- a/projects/packages/forms/src/contact-form/class-admin.php +++ b/projects/packages/forms/src/contact-form/class-admin.php @@ -141,7 +141,7 @@ public function print_export_modal() { ?> $image_block['attrs']['id'] ?? null, 'src' => $image_src ?? null, ), - ) + ), + JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ); $option_id = $id . '-' . $option_letter; $used_html_ids[ $option_id ] = true; @@ -2920,12 +2921,15 @@ public function render_slider_field( $id, $label, $value, $class, $required, $re
$min, - 'max' => $max, - 'default' => $starting_value, - 'step' => $step, + echo esc_attr( + wp_json_encode( + array( + 'min' => $min, + 'max' => $max, + 'default' => $starting_value, + 'step' => $step, + ), + JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ); ?> diff --git a/projects/packages/forms/src/contact-form/class-contact-form-plugin.php b/projects/packages/forms/src/contact-form/class-contact-form-plugin.php index 778ce4742f65..d815be3a72e0 100644 --- a/projects/packages/forms/src/contact-form/class-contact-form-plugin.php +++ b/projects/packages/forms/src/contact-form/class-contact-form-plugin.php @@ -645,7 +645,7 @@ public static function block_attributes_to_shortcode_attributes( $atts, $type, $ } $atts['options'] = implode( ',', $options ); - $atts['optionsdata'] = \wp_json_encode( $options_data ); + $atts['optionsdata'] = \wp_json_encode( $options_data, JSON_UNESCAPED_SLASHES | JSON_HEX_AMP ); /* Borders for the outlined notched HTML. @@ -715,7 +715,7 @@ public static function block_attributes_to_shortcode_attributes( $atts, $type, $ } $atts['options'] = implode( ',', $options ); - $atts['optionsdata'] = \wp_json_encode( $options_data ); + $atts['optionsdata'] = \wp_json_encode( $options_data, JSON_UNESCAPED_SLASHES | JSON_HEX_AMP ); /* Borders for the outlined notched HTML. @@ -1021,7 +1021,7 @@ public static function gutenblock_render_form_progress_indicator( $attributes )
+ data-wp-context=''>
@@ -1081,7 +1081,7 @@ protected static function get_style_variation_shortcode_attributes( $block_name, $block_support_styles = self::get_block_support_classes_and_styles( $block_name, $picked_attributes ); return array( - 'stylevariationattributes' => isset( $picked_attributes['style'] ) ? \wp_json_encode( $picked_attributes['style'] ) : '', + 'stylevariationattributes' => isset( $picked_attributes['style'] ) ? \wp_json_encode( $picked_attributes['style'], JSON_UNESCAPED_SLASHES | JSON_HEX_AMP ) : '', 'stylevariationclasses' => isset( $block_support_styles['class'] ) ? ' ' . $block_support_styles['class'] : '', 'stylevariationstyles' => isset( $block_support_styles['style'] ) ? $block_support_styles['style'] : '', ); @@ -1690,7 +1690,7 @@ public function process_form_submission() { 'slug' => $block_template_part_slug, 'tagName' => 'div', ); - do_blocks( '' ); + do_blocks( '' ); } else { // It's a form embedded in a post diff --git a/projects/packages/forms/src/contact-form/class-contact-form.php b/projects/packages/forms/src/contact-form/class-contact-form.php index 27955204ebf9..0452989ed8dc 100644 --- a/projects/packages/forms/src/contact-form/class-contact-form.php +++ b/projects/packages/forms/src/contact-form/class-contact-form.php @@ -172,7 +172,12 @@ public function __construct( $attributes, $content = null, $set_id = true ) { $page_number = is_numeric( $page ) ? intval( $page ) : 1; $attributes['id'] = self::compute_id( $attributes, $this->current_post, $page_number ); } - $this->hash = sha1( wp_json_encode( $attributes ) ); + $this->hash = sha1( + wp_json_encode( + $attributes, + 0 // No `json_encode()` flags because we don't want to disrupt the current hash index. + ) + ); if ( $set_id ) { self::$forms[ $this->hash ] = $this; // This increments the form count. @@ -570,7 +575,10 @@ public function get_jwt() { $iv = random_bytes( $iv_length ); $tag = ''; // Will be populated by openssl_encrypt for GCM $encrypted = openssl_encrypt( - wp_json_encode( $attributes ), + wp_json_encode( + $attributes, + JSON_UNESCAPED_SLASHES + ), $cipher, $encryption_key, OPENSSL_RAW_DATA, // Return raw binary data, not base64 diff --git a/projects/packages/forms/src/contact-form/class-feedback.php b/projects/packages/forms/src/contact-form/class-feedback.php index e38d25103e01..474ec2acba86 100644 --- a/projects/packages/forms/src/contact-form/class-feedback.php +++ b/projects/packages/forms/src/contact-form/class-feedback.php @@ -1258,7 +1258,7 @@ public function serialize() { $fields_to_serialize['country_code'] = null; } - return addslashes( wp_json_encode( $fields_to_serialize ) ); + return addslashes( wp_json_encode( $fields_to_serialize, JSON_UNESCAPED_SLASHES ) ); } /** diff --git a/projects/packages/forms/src/contact-form/class-form-view.php b/projects/packages/forms/src/contact-form/class-form-view.php index 2f6892212db3..20bd0baa439e 100644 --- a/projects/packages/forms/src/contact-form/class-form-view.php +++ b/projects/packages/forms/src/contact-form/class-form-view.php @@ -70,10 +70,10 @@ public static function display() { <?php esc_html_e( 'Contact Form', 'jetpack-forms' ); ?> @@ -263,7 +279,8 @@ public function jetpack_wga_classic_track_purchases( $custom_vars ) { (string) $order->get_billing_city(), (string) $order->get_billing_state(), (string) $order->get_billing_country(), - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) ) ); @@ -287,7 +304,8 @@ public function jetpack_wga_classic_track_purchases( $custom_vars ) { Utils::get_product_categories_concatenated( $product ), (string) $order->get_item_total( $item ), (string) $item['qty'], - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) ) ); diff --git a/projects/packages/google-analytics/src/class-universal.php b/projects/packages/google-analytics/src/class-universal.php index c9c2a4a0a899..391a318c1569 100644 --- a/projects/packages/google-analytics/src/class-universal.php +++ b/projects/packages/google-analytics/src/class-universal.php @@ -176,7 +176,7 @@ class_exists( 'Automattic\WooCommerce\Utilities\OrderUtil' ) 'price' => $order->get_item_total( $item ), 'quantity' => $item['qty'], ); - $command = "ga( 'ec:addProduct', " . wp_json_encode( $item_details ) . ' );'; + $command = "ga( 'ec:addProduct', " . wp_json_encode( $item_details, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ' );'; array_push( $command_array, $command ); } } @@ -189,7 +189,7 @@ class_exists( 'Automattic\WooCommerce\Utilities\OrderUtil' ) 'tax' => $order->get_total_tax(), 'shipping' => $order->get_total_shipping(), ); - $command = "ga( 'ec:setAction', 'purchase', " . wp_json_encode( $summary ) . ' );'; + $command = "ga( 'ec:setAction', 'purchase', " . wp_json_encode( $summary, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ' );'; array_push( $command_array, $command ); update_post_meta( $order_id, '_ga_tracked', 1 ); @@ -248,7 +248,7 @@ public function maybe_track_hpos_purchases( $command_array ) { 'price' => $order->get_item_total( $item ), 'quantity' => $item['qty'], ); - $command = "ga( 'ec:addProduct', " . wp_json_encode( $item_details ) . ' );'; + $command = "ga( 'ec:addProduct', " . wp_json_encode( $item_details, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ' );'; array_push( $command_array, $command ); } } @@ -261,7 +261,7 @@ public function maybe_track_hpos_purchases( $command_array ) { 'tax' => $order->get_total_tax(), 'shipping' => $order->get_shipping_total(), ); - $command = "ga( 'ec:setAction', 'purchase', " . wp_json_encode( $summary ) . ' );'; + $command = "ga( 'ec:setAction', 'purchase', " . wp_json_encode( $summary, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ' );'; array_push( $command_array, $command ); $order->update_meta_data( '_ga_tracked', 1 ); @@ -424,7 +424,7 @@ public function listing_impression() { 'position' => $woocommerce_loop['loop'] ?? null, ); // @phan-suppress-next-line PhanUndeclaredFunction - \wc_enqueue_js( "ga( 'ec:addImpression', " . wp_json_encode( $item_details ) . ' );' ); + \wc_enqueue_js( "ga( 'ec:addImpression', " . wp_json_encode( $item_details, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ' );' ); } /** @@ -464,7 +464,7 @@ public function listing_click() { return; } - ga( 'ec:addProduct', " . wp_json_encode( $item_details ) . " ); + ga( 'ec:addProduct', " . wp_json_encode( $item_details, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . " ); ga( 'ec:setAction', 'click', { list: '" . esc_js( $list ) . "' } ); ga( 'send', 'event', 'UX', 'click', { list: '" . esc_js( $list ) . "' } ); } );" @@ -494,7 +494,7 @@ public function product_detail() { ); // @phan-suppress-next-line PhanUndeclaredFunction \wc_enqueue_js( - "ga( 'ec:addProduct', " . wp_json_encode( $item_details ) . ' );' . + "ga( 'ec:addProduct', " . wp_json_encode( $item_details, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ' );' . "ga( 'ec:setAction', 'detail' );" ); } @@ -530,7 +530,7 @@ public function checkout_process() { 'quantity' => $cart_item['quantity'], ); - array_push( $universal_commands, "ga( 'ec:addProduct', " . wp_json_encode( $item_details ) . ' );' ); + array_push( $universal_commands, "ga( 'ec:addProduct', " . wp_json_encode( $item_details, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ' );' ); } array_push( $universal_commands, "ga( 'ec:setAction','checkout' );" ); diff --git a/projects/packages/google-analytics/tests/php/Jetpack_Google_Analytics_Test.php b/projects/packages/google-analytics/tests/php/Jetpack_Google_Analytics_Test.php index 84275d2c2fef..c7cecc2fd276 100644 --- a/projects/packages/google-analytics/tests/php/Jetpack_Google_Analytics_Test.php +++ b/projects/packages/google-analytics/tests/php/Jetpack_Google_Analytics_Test.php @@ -56,26 +56,33 @@ function ( $option ) { protected function get_sample() { $entries = array(); - $config_data = wp_json_encode( - array( - 'vars' => array( - 'account' => self::UA_ID, + $config_data = array( + 'vars' => array( + 'account' => self::UA_ID, + ), + 'triggers' => array( + 'trackPageview' => array( + 'on' => 'visible', + 'request' => 'pageview', ), - 'triggers' => array( - 'trackPageview' => array( - 'on' => 'visible', - 'request' => 'pageview', - ), - ), - ) + ), ); // Generate a hash string to uniquely identify this entry. - $entry_id = substr( md5( 'googleanalytics' . $config_data ), 0, 12 ); + $entry_id = substr( + md5( + 'googleanalytics' . wp_json_encode( + $config_data, + 0 // No `json_encode()` flags because we don't want to disrupt the current hash index. + ) + ), + 0, + 12 + ); $entries[ $entry_id ] = array( 'type' => 'googleanalytics', - 'config' => $config_data, + 'config' => wp_json_encode( $config_data, JSON_UNESCAPED_SLASHES ), ); return $entries; diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-audit_json_encode_flags b/projects/packages/jetpack-mu-wpcom/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php index 2055a5aadb65..11acf6182c29 100644 --- a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php +++ b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php @@ -140,7 +140,8 @@ public static function maybe_update_translations() { array( 'locales' => $locales, 'plugins' => $plugins_request_data, - ) + ), + JSON_UNESCAPED_SLASHES ), 'headers' => array( 'Content-Type' => 'application/json' ), 'timeout' => 10, @@ -537,7 +538,8 @@ public static function load_jetpack_mu_wpcom_settings() { $data = wp_json_encode( array( 'assetsUrl' => plugins_url( 'build/', self::BASE_FILE ), - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); wp_add_inline_script( diff --git a/projects/packages/jetpack-mu-wpcom/src/features/help-center/class-help-center.php b/projects/packages/jetpack-mu-wpcom/src/features/help-center/class-help-center.php index 059345ee0632..7fadd67c6d75 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/help-center/class-help-center.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/help-center/class-help-center.php @@ -264,7 +264,8 @@ function ( $wp_admin_bar ) { 'const helpCenterFeatureFlags = ' . wp_json_encode( array( 'loadNextStepsTutorial' => self::is_next_steps_tutorial_enabled(), - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ), 'before' ); @@ -297,7 +298,8 @@ function ( $wp_admin_bar ) { ), 'site' => $this->get_current_site(), 'locale' => self::determine_iso_639_locale(), - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ), 'before' ); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php index 74aa5f5e3f24..8d4361c8bb16 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad-task-definitions.php @@ -1107,7 +1107,7 @@ function wpcom_launchpad_init_listeners( $task_definitions ) { array( 'feature' => 'launchpad', 'message' => 'Launchpad failed to add listener callback.', - 'extra' => wp_json_encode( $data ), + 'extra' => wp_json_encode( $data, JSON_UNESCAPED_SLASHES ), ) ); } diff --git a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php index 815fb70c0464..274f3c7744d7 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/launchpad/launchpad.php @@ -759,7 +759,7 @@ function wpcom_log_launchpad_being_enabled_for_test_sites( $option, $value ) { array( 'feature' => 'launchpad', 'message' => 'Launchpad enabled for e2e test site.', - 'extra' => wp_json_encode( $extra ), + 'extra' => wp_json_encode( $extra, JSON_UNESCAPED_SLASHES ), ) ); } diff --git a/projects/packages/jetpack-mu-wpcom/src/features/marketing/marketing.php b/projects/packages/jetpack-mu-wpcom/src/features/marketing/marketing.php index d1cd8588f224..c13d9381b5fc 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/marketing/marketing.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/marketing/marketing.php @@ -41,7 +41,7 @@ function enqueue_marketing_tools_assets() { jetpack_mu_wpcom_enqueue_assets( 'marketing', array( 'js', 'css' ) ); wp_add_inline_script( 'jetpack-mu-wpcom-marketing', - 'const wpcomMarketing = ' . wp_json_encode( array( 'siteId' => get_wpcom_blog_id() ) ) . ';', + 'const wpcomMarketing = ' . wp_json_encode( array( 'siteId' => get_wpcom_blog_id() ), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); } diff --git a/projects/packages/jetpack-mu-wpcom/src/features/newspack-blocks/index.php b/projects/packages/jetpack-mu-wpcom/src/features/newspack-blocks/index.php index ac9472bca31c..2a2aafebdf57 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/newspack-blocks/index.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/newspack-blocks/index.php @@ -59,7 +59,8 @@ function enqueue_newspack_blocks_data( $handle ) { // Define URL to core one to make autocomplete working for newspack-blocks installed via jetpack-mu-wpcom. 'authors_rest_url' => rest_url() . 'wp/v2/users', 'custom_taxonomies' => array(), - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); wp_add_inline_script( diff --git a/projects/packages/jetpack-mu-wpcom/src/features/replace-site-visibility/replace-site-visibility.php b/projects/packages/jetpack-mu-wpcom/src/features/replace-site-visibility/replace-site-visibility.php index f60b6f17078e..13d1fc211e31 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/replace-site-visibility/replace-site-visibility.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/replace-site-visibility/replace-site-visibility.php @@ -130,7 +130,7 @@ function replace_site_visibility_load_assets() { $data['blogPublic'] = \Private_Site\site_is_private() ? '-1' : '1'; } - $encoded_data = wp_json_encode( $data ); + $encoded_data = wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); wp_add_inline_script( $handle, "var JETPACK_MU_WPCOM_SITE_VISIBILITY = $encoded_data;", @@ -167,7 +167,7 @@ function replace_site_visibility() { ?> 'application/json', ), ), - wp_json_encode( $data ), + wp_json_encode( $data, JSON_UNESCAPED_SLASHES ), 'wpcom' ); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/assets/class-verbum-moderate.php b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/assets/class-verbum-moderate.php index ad6be3068c29..066bf326ea95 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/assets/class-verbum-moderate.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/assets/class-verbum-moderate.php @@ -81,7 +81,8 @@ public function enqueue_scripts( $hook ) { array( 'embedNonce' => wp_create_nonce( 'embed_nonce' ), 'isRTL' => is_rtl(), - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ), 'before' ); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/class-verbum-comments.php b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/class-verbum-comments.php index 246ef37e16b4..d2c8d2d94ca5 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/class-verbum-comments.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/class-verbum-comments.php @@ -101,7 +101,7 @@ function () { */ public function get_form_action() { return is_jetpack_comments() ? - wp_json_encode( esc_url_raw( http() . '://' . JETPACK_SERVER__DOMAIN . '/jetpack-comment/' ) ) : site_url( '/wp-comments-post.php' ); + esc_url_raw( http() . '://' . JETPACK_SERVER__DOMAIN . '/jetpack-comment/' ) : site_url( '/wp-comments-post.php' ); } /** @@ -292,7 +292,8 @@ public function enqueue_assets() { 'vbeCacheBuster' => $vbe_cache_buster, 'iframeUniqueId' => $iframe_unique_id, 'colorScheme' => $color_scheme, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ), 'before' ); @@ -533,7 +534,7 @@ public function check_comment_allowed( int $comment_id ) { 'user_id' => $current_user_id, 'host' => sanitize_text_field( $headers['Host'] ?? '' ), 'comment_id' => $comment_id, - 'extra' => wp_json_encode( $data ), + 'extra' => wp_json_encode( $data, JSON_UNESCAPED_SLASHES ), ) ); } diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/class-wpcom-block-editor-nux.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/class-wpcom-block-editor-nux.php index 44853d9901c6..5e31374a6da1 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/class-wpcom-block-editor-nux.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/class-wpcom-block-editor-nux.php @@ -56,7 +56,7 @@ public function enqueue_script_and_style() { 'siteUrlOption' => get_option( 'siteurl' ), 'siteIntentOption' => get_option( 'site_intent' ), ), - JSON_HEX_TAG | JSON_HEX_AMP + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); wp_add_inline_script( @@ -76,7 +76,7 @@ public function enqueue_script_and_style() { 'isDismissed' => WP_REST_WPCOM_Block_Editor_Recommended_Tags_Modal_Controller::get_wpcom_recommended_tags_modal_dismissed(), 'isP2' => $is_p2_site, ), - JSON_HEX_TAG | JSON_HEX_AMP + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); wp_add_inline_script( diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-command-palette/wpcom-command-palette.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-command-palette/wpcom-command-palette.php index 9df9e4b3616a..c970cfd33744 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-command-palette/wpcom-command-palette.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-command-palette/wpcom-command-palette.php @@ -76,7 +76,8 @@ function wpcom_load_command_palette() { 'siteHostname' => wpcom_get_site_slug(), 'siteName' => get_option( 'blogname' ), 'isWpcomStore' => $host->is_woa_site() && is_plugin_active( 'woocommerce/woocommerce.php' ), - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); wp_add_inline_script( $command_palette_js_handle, diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php index 2d5e020b90d4..c9e879cde8dc 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/wpcom-dashboard-widgets.php @@ -129,7 +129,8 @@ function enqueue_wpcom_dashboard_widgets( $args = array() ) { 'sitePlan' => $current_plan, 'hasCustomDomain' => wpcom_site_has_feature( 'custom-domain' ), 'tasks' => $args['tasks'], - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); wp_add_inline_script( diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/index.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/index.php index df32ead87bf7..e161039653b6 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/index.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/index.php @@ -158,7 +158,8 @@ function wpcom_global_styles_enqueue_assets() { 'const launchBarUserData = ' . wp_json_encode( array( 'blogId' => get_wpcom_blog_id(), - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ), 'before' ); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-imports/wpcom-imports.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-imports/wpcom-imports.php index e43b65e36618..88796a615e7f 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-imports/wpcom-imports.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-imports/wpcom-imports.php @@ -152,7 +152,8 @@ function wpcom_imports_enqueue_script() { 'const wpcomImporterData = ' . wp_json_encode( array( 'wpcomImporterUrl' => $url, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-media/wpcom-media-url-upload.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-media/wpcom-media-url-upload.php index 49c03173f3d5..6d894ed18f63 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-media/wpcom-media-url-upload.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-media/wpcom-media-url-upload.php @@ -35,7 +35,8 @@ function enqueue_wpcom_media_url_upload_form() { 'action' => 'wpcom_media_url_upload', 'nonce' => wp_create_nonce( 'wpcom_media_url_upload' ), 'page' => $page, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); wp_add_inline_script( diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-options-general/options-general.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-options-general/options-general.php index a954dc6e7473..b12b6b776efa 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-options-general/options-general.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-options-general/options-general.php @@ -87,7 +87,8 @@ function wpcom_enqueue_options_general_assets() { 'homeUrl' => home_url(), 'siteSlug' => $site_slug, 'optionsGeneralUrl' => $options_general_url, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-sidebar-notice/wpcom-sidebar-notice.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-sidebar-notice/wpcom-sidebar-notice.php index c10b637dfc7c..2104c08d61e5 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-sidebar-notice/wpcom-sidebar-notice.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-sidebar-notice/wpcom-sidebar-notice.php @@ -47,7 +47,7 @@ function wpcom_enqueue_sidebar_notice_assets() { $asset_file['version'] ?? filemtime( Jetpack_Mu_Wpcom::BASE_DIR . 'build/wpcom-sidebar-notice/wpcom-sidebar-notice.css' ) ); - $inline_script = 'const wpcomSidebarNoticeData = ' . wp_json_encode( $data ) . ';'; + $inline_script = 'const wpcomSidebarNoticeData = ' . wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; wp_add_inline_script( 'wpcom-sidebar-notice', $inline_script, 'before' ); } add_action( 'admin_enqueue_scripts', 'wpcom_enqueue_sidebar_notice_assets' ); @@ -79,7 +79,7 @@ function wpcom_get_sidebar_notice() { $message = $jitm_engine->get_top_messages( $message_path, $user_id, $user_roles, $query_string ); } else { $jitm = \Automattic\Jetpack\JITMS\JITM::get_instance(); - $message = $jitm->get_messages( $message_path, wp_json_encode( array( 'message_path' => $message_path ) ), false ); + $message = $jitm->get_messages( $message_path, wp_json_encode( array( 'message_path' => $message_path ), JSON_UNESCAPED_SLASHES ), false ); } $cache_loaded = true; @@ -90,7 +90,7 @@ function wpcom_get_sidebar_notice() { } // Serialize message as object (on Simple sites we have an array, on Atomic sites we have an object). - $message = json_decode( wp_json_encode( $message[0] ) ); + $message = json_decode( wp_json_encode( $message[0], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); $cached_notice = array( 'content' => $message->content->message, diff --git a/projects/packages/jetpack-mu-wpcom/tests/php/features/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Launchpad_Test.php b/projects/packages/jetpack-mu-wpcom/tests/php/features/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Launchpad_Test.php index 75d1ca9e5856..9705aa858578 100644 --- a/projects/packages/jetpack-mu-wpcom/tests/php/features/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Launchpad_Test.php +++ b/projects/packages/jetpack-mu-wpcom/tests/php/features/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Launchpad_Test.php @@ -103,7 +103,7 @@ public function test_update_checklist_dismissed_state() { $request = new WP_REST_Request( Requests::POST, '/wpcom/v2/launchpad' ); $request->set_header( 'content_type', 'application/json' ); - $request->set_body( wp_json_encode( $data ) ); + $request->set_body( wp_json_encode( $data, JSON_UNESCAPED_SLASHES ) ); $this->assertFalse( wpcom_launchpad_is_task_list_dismissed( 'intent-build' ) ); @@ -128,7 +128,7 @@ public function test_update_checklist_set_temporary_dismissed_when_date_is_in_th $data = array( 'is_checklist_dismissed' => $values ); $request = new WP_REST_Request( Requests::POST, '/wpcom/v2/launchpad' ); $request->set_header( 'content_type', 'application/json' ); - $request->set_body( wp_json_encode( $data ) ); + $request->set_body( wp_json_encode( $data, JSON_UNESCAPED_SLASHES ) ); $result = rest_do_request( $request ); $this->assertSame( 200, $result->get_status(), 'assert status code' ); $this->assertTrue( wpcom_launchpad_is_task_list_dismissed( 'intent-build' ), 'assert the dismiss state' ); @@ -148,7 +148,7 @@ public function test_update_checklist_doesnt_set_temporary_dismiss_with_invalid_ $data = array( 'is_checklist_dismissed' => $values ); $request = new WP_REST_Request( Requests::POST, '/wpcom/v2/launchpad' ); $request->set_header( 'content_type', 'application/json' ); - $request->set_body( wp_json_encode( $data ) ); + $request->set_body( wp_json_encode( $data, JSON_UNESCAPED_SLASHES ) ); $result = rest_do_request( $request ); $this->assertSame( 400, $result->get_status(), 'assert status code' ); } @@ -167,7 +167,7 @@ public function test_update_checklist_statuses() { $request = new WP_REST_Request( Requests::POST, '/wpcom/v2/launchpad' ); $request->set_header( 'content_type', 'application/json' ); - $request->set_body( wp_json_encode( $data ) ); + $request->set_body( wp_json_encode( $data, JSON_UNESCAPED_SLASHES ) ); $this->assertFalse( get_option( 'launchpad_checklist_tasks_statuses' ) ); @@ -197,7 +197,7 @@ public function test_update_checklist_statuses() { $request = new WP_REST_Request( Requests::POST, '/wpcom/v2/launchpad' ); $request->set_header( 'content_type', 'application/json' ); - $request->set_body( wp_json_encode( $data ) ); + $request->set_body( wp_json_encode( $data, JSON_UNESCAPED_SLASHES ) ); $result = rest_do_request( $request ); @@ -209,7 +209,7 @@ public function test_update_checklist_statuses() { $this->assertFalse( $option_value ); // Invalid parameter. - $request->set_body( wp_json_encode( array( 'checklist_statuses' => array( 'wrong_key' => true ) ) ) ); + $request->set_body( wp_json_encode( array( 'checklist_statuses' => array( 'wrong_key' => true ) ), JSON_UNESCAPED_SLASHES ) ); $result = rest_do_request( $request ); $this->assertSame( 400, $result->get_status() ); @@ -231,7 +231,7 @@ public function test_update_multiple_options() { $request = new WP_REST_Request( Requests::POST, '/wpcom/v2/launchpad' ); $request->set_header( 'content_type', 'application/json' ); - $request->set_body( wp_json_encode( $data ) ); + $request->set_body( wp_json_encode( $data, JSON_UNESCAPED_SLASHES ) ); $this->assertFalse( get_option( 'launchpad_screen' ) ); @@ -255,7 +255,7 @@ public function test_set_checklist_as_skipped() { $request = new WP_REST_Request( Requests::POST, '/wpcom/v2/launchpad' ); $request->set_header( 'content_type', 'application/json' ); - $request->set_body( wp_json_encode( $data ) ); + $request->set_body( wp_json_encode( $data, JSON_UNESCAPED_SLASHES ) ); $result = rest_do_request( $request ); @@ -504,7 +504,7 @@ protected function call_launchpad_api( $method, $body ) { $request->set_header( 'content_type', 'application/json' ); if ( null !== $body ) { - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); } return rest_do_request( $request ); diff --git a/projects/packages/jwt/changelog/fix-audit_json_encode_flags b/projects/packages/jwt/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/jwt/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/jwt/src/class-jwt.php b/projects/packages/jwt/src/class-jwt.php index 6afdd2d4066d..55e6f5e2d52a 100644 --- a/projects/packages/jwt/src/class-jwt.php +++ b/projects/packages/jwt/src/class-jwt.php @@ -339,7 +339,7 @@ public static function json_decode( $input, $as_array = false ) { * @throws DomainException Provided object could not be encoded to valid JSON. */ public static function json_encode( $input ) { - $json = \wp_json_encode( $input ); + $json = \wp_json_encode( $input, JSON_UNESCAPED_SLASHES ); $errno = json_last_error(); if ( $errno ) { diff --git a/projects/packages/licensing/changelog/fix-audit_json_encode_flags b/projects/packages/licensing/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/licensing/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/licensing/tests/php/Licensing_Endpoints_Test.php b/projects/packages/licensing/tests/php/Licensing_Endpoints_Test.php index 9a8591a92c54..e34578a6cbc9 100644 --- a/projects/packages/licensing/tests/php/Licensing_Endpoints_Test.php +++ b/projects/packages/licensing/tests/php/Licensing_Endpoints_Test.php @@ -89,7 +89,7 @@ protected function create_and_get_request( $route = '', $json_params = array(), $request->set_header( 'content-type', 'application/json' ); } if ( ! empty( $json_params ) ) { - $request->set_body( wp_json_encode( $json_params ) ); + $request->set_body( wp_json_encode( $json_params, JSON_UNESCAPED_SLASHES ) ); } if ( ! empty( $params ) && is_array( $params ) ) { foreach ( $params as $key => $value ) { diff --git a/projects/packages/masterbar/changelog/fix-audit_json_encode_flags b/projects/packages/masterbar/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/masterbar/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/masterbar/src/admin-menu/class-atomic-admin-menu.php b/projects/packages/masterbar/src/admin-menu/class-atomic-admin-menu.php index 2669c6276102..bbf25a24e914 100644 --- a/projects/packages/masterbar/src/admin-menu/class-atomic-admin-menu.php +++ b/projects/packages/masterbar/src/admin-menu/class-atomic-admin-menu.php @@ -224,7 +224,7 @@ public function add_new_site_link() { public function get_upsell_nudge() { $jitm = JITM::get_instance(); $message_path = 'calypso:sites:sidebar_notice'; - $message = $jitm->get_messages( $message_path, wp_json_encode( array( 'message_path' => $message_path ) ), false ); + $message = $jitm->get_messages( $message_path, wp_json_encode( array( 'message_path' => $message_path ), JSON_UNESCAPED_SLASHES ), false ); if ( isset( $message[0] ) ) { $message = $message[0]; diff --git a/projects/packages/my-jetpack/changelog/fix-audit_json_encode_flags b/projects/packages/my-jetpack/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/my-jetpack/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/my-jetpack/src/class-rest-ai.php b/projects/packages/my-jetpack/src/class-rest-ai.php index d14447798ddb..4f8274d96ea8 100644 --- a/projects/packages/my-jetpack/src/class-rest-ai.php +++ b/projects/packages/my-jetpack/src/class-rest-ai.php @@ -70,7 +70,7 @@ public static function get_openai_jwt() { 'method' => 'POST', 'headers' => array( 'Content-Type' => 'application/json; charset=utf-8' ), ), - wp_json_encode( array() ), + wp_json_encode( array(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'wpcom' ); diff --git a/projects/packages/my-jetpack/tests/php/Products_Rest_Test.php b/projects/packages/my-jetpack/tests/php/Products_Rest_Test.php index a48178c74689..622cd8e3d321 100644 --- a/projects/packages/my-jetpack/tests/php/Products_Rest_Test.php +++ b/projects/packages/my-jetpack/tests/php/Products_Rest_Test.php @@ -201,7 +201,7 @@ public function test_activate_boost() { // Activate. $request = new WP_REST_Request( 'POST', '/my-jetpack/v1/site/products/activate' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); @@ -234,7 +234,7 @@ public function test_deactivate_boost() { // Deactivate. $request = new WP_REST_Request( 'DELETE', '/my-jetpack/v1/site/products/deactivate' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); @@ -268,7 +268,7 @@ public function test_activate_uninstallable() { // Activate. $request = new WP_REST_Request( 'POST', '/my-jetpack/v1/site/products/activate' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $data = $response->get_data(); diff --git a/projects/packages/my-jetpack/tests/php/Wpcom_Products_Test.php b/projects/packages/my-jetpack/tests/php/Wpcom_Products_Test.php index 6dad462c4dcc..22f675e0e8d4 100644 --- a/projects/packages/my-jetpack/tests/php/Wpcom_Products_Test.php +++ b/projects/packages/my-jetpack/tests/php/Wpcom_Products_Test.php @@ -55,7 +55,7 @@ public function create_user_and_login() { */ public function mock_success_response() { return array( - 'body' => wp_json_encode( $this->get_mock_products_data() ), + 'body' => wp_json_encode( $this->get_mock_products_data(), JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200, 'message' => '', diff --git a/projects/packages/plans/changelog/fix-audit_json_encode_flags b/projects/packages/plans/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/plans/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/plans/tests/php/Jetpack_Plan_Test.php b/projects/packages/plans/tests/php/Jetpack_Plan_Test.php index 1f149d81d741..6a92bb91ea39 100644 --- a/projects/packages/plans/tests/php/Jetpack_Plan_Test.php +++ b/projects/packages/plans/tests/php/Jetpack_Plan_Test.php @@ -130,7 +130,8 @@ private static function get_successful_plan_response( $plan_response ) { $body = wp_json_encode( array( 'plan' => $plan_response, - ) + ), + JSON_UNESCAPED_SLASHES ); return static::get_mocked_response( 200, $body ); } diff --git a/projects/packages/protect-status/changelog/fix-audit_json_encode_flags b/projects/packages/protect-status/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/protect-status/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/protect-status/tests/php/Scan_Status_Test.php b/projects/packages/protect-status/tests/php/Scan_Status_Test.php index 85c44f6cf033..02efeb9d195e 100644 --- a/projects/packages/protect-status/tests/php/Scan_Status_Test.php +++ b/projects/packages/protect-status/tests/php/Scan_Status_Test.php @@ -397,7 +397,7 @@ public static function get_sample_status() { */ public function return_sample_response() { return array( - 'body' => wp_json_encode( $this->get_sample_response() ), + 'body' => wp_json_encode( $this->get_sample_response(), JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200, 'message' => '', @@ -440,7 +440,7 @@ public function return_sample_themes() { */ public function return_sample_empty_response() { return array( - 'body' => wp_json_encode( static::get_sample_empty_response() ), + 'body' => wp_json_encode( static::get_sample_empty_response(), JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200, 'message' => '', @@ -455,7 +455,7 @@ public function return_sample_empty_response() { */ public function return_sample_error_response() { return array( - 'body' => wp_json_encode( 'error' ), + 'body' => wp_json_encode( 'error', JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 400, 'message' => '', diff --git a/projects/packages/protect-status/tests/php/Status_Test.php b/projects/packages/protect-status/tests/php/Status_Test.php index bcb4e142843f..243c4f248d1a 100644 --- a/projects/packages/protect-status/tests/php/Status_Test.php +++ b/projects/packages/protect-status/tests/php/Status_Test.php @@ -323,7 +323,7 @@ public function get_sample_status() { */ public function return_sample_response() { return array( - 'body' => wp_json_encode( static::get_sample_api_response() ), + 'body' => wp_json_encode( static::get_sample_api_response(), JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200, 'message' => '', @@ -338,7 +338,7 @@ public function return_sample_response() { */ public function return_broken_sample_response() { return array( - 'body' => wp_json_encode( $this->get_broken_sample_api_response() ), + 'body' => wp_json_encode( $this->get_broken_sample_api_response(), JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200, 'message' => '', @@ -385,7 +385,7 @@ public function return_sample_themes() { */ public function return_sample_empty_response() { return array( - 'body' => wp_json_encode( static::get_sample_empty_response() ), + 'body' => wp_json_encode( static::get_sample_empty_response(), JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200, 'message' => '', @@ -400,7 +400,7 @@ public function return_sample_empty_response() { */ public function return_sample_error_response() { return array( - 'body' => wp_json_encode( 'error' ), + 'body' => wp_json_encode( 'error', JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 400, 'message' => '', diff --git a/projects/packages/publicize/changelog/fix-audit_json_encode_flags b/projects/packages/publicize/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/publicize/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/publicize/src/class-publicize-ui.php b/projects/packages/publicize/src/class-publicize-ui.php index 2522063eb0dc..1f05563bb0f9 100644 --- a/projects/packages/publicize/src/class-publicize-ui.php +++ b/projects/packages/publicize/src/class-publicize-ui.php @@ -189,7 +189,8 @@ public function post_page_metabox_assets() { 'refreshConnections' => '/wpcom/v2/publicize/connections?test_connections=1', 'isReshareSupported' => Current_Plan::supports( 'republicize' ), 'siteType' => $site_type, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ), 'before' ); diff --git a/projects/packages/publicize/src/class-share-limits.php b/projects/packages/publicize/src/class-share-limits.php index f18e225e0d70..9e20d16dc7ca 100644 --- a/projects/packages/publicize/src/class-share-limits.php +++ b/projects/packages/publicize/src/class-share-limits.php @@ -166,6 +166,6 @@ public function render_initial_state() { 'numberOfConnections' => count( $this->connections ), ); - return 'var jetpackSocialClassicEditorInitialState=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( $state ) ) . '"));'; + return 'var jetpackSocialClassicEditorInitialState=' . wp_json_encode( $state, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } } diff --git a/projects/packages/publicize/src/social-image-generator/utilities.php b/projects/packages/publicize/src/social-image-generator/utilities.php index fae55ede32ed..0555e180facb 100644 --- a/projects/packages/publicize/src/social-image-generator/utilities.php +++ b/projects/packages/publicize/src/social-image-generator/utilities.php @@ -79,7 +79,7 @@ function fetch_token( $text, $image_url, $template, $font = '' ) { $request = new WP_REST_Request( 'POST' ); - $request->set_body( wp_json_encode( $args ) ); + $request->set_body( wp_json_encode( $args, JSON_UNESCAPED_SLASHES ) ); return $proxy->proxy_request_to_wpcom_as_blog( $request, 'generate-token' ); } diff --git a/projects/packages/publicize/tests/php/Scheduled_Actions_Controller_Test.php b/projects/packages/publicize/tests/php/Scheduled_Actions_Controller_Test.php index e8b547c820f5..e66f3435f988 100644 --- a/projects/packages/publicize/tests/php/Scheduled_Actions_Controller_Test.php +++ b/projects/packages/publicize/tests/php/Scheduled_Actions_Controller_Test.php @@ -179,7 +179,7 @@ public function mock_wpcom_api_proxy_call( $result ) { $callback = function () use ( $result ) { return array( - 'body' => wp_json_encode( $result ), + 'body' => wp_json_encode( $result, JSON_UNESCAPED_SLASHES ), ); }; diff --git a/projects/packages/publicize/tests/php/Social_Image_Generator_Controller_Test.php b/projects/packages/publicize/tests/php/Social_Image_Generator_Controller_Test.php index 56f3baf5d357..6531e2bda20b 100644 --- a/projects/packages/publicize/tests/php/Social_Image_Generator_Controller_Test.php +++ b/projects/packages/publicize/tests/php/Social_Image_Generator_Controller_Test.php @@ -128,7 +128,7 @@ public function test_generate_preview_token() { */ public function mock_success_response() { return array( - 'body' => wp_json_encode( 'dummy-token' ), + 'body' => wp_json_encode( 'dummy-token', JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200, 'message' => '', diff --git a/projects/packages/schema/changelog/fix-audit_json_encode_flags b/projects/packages/schema/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/schema/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/schema/src/class-utils.php b/projects/packages/schema/src/class-utils.php index ad129291b575..8eae9e18a582 100644 --- a/projects/packages/schema/src/class-utils.php +++ b/projects/packages/schema/src/class-utils.php @@ -66,7 +66,7 @@ public static function describe( return $description; } // Convert the processed schema to a JSON-like string - return wp_json_encode( $description, JSON_PRETTY_PRINT ); + return wp_json_encode( $description, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ); } /** diff --git a/projects/packages/schema/src/types/class-type-any-json.php b/projects/packages/schema/src/types/class-type-any-json.php index 1198e431bdcb..bd2cb9828a81 100644 --- a/projects/packages/schema/src/types/class-type-any-json.php +++ b/projects/packages/schema/src/types/class-type-any-json.php @@ -13,7 +13,7 @@ public function parse( $value, $_context ) { throw new Schema_Error( $message, $value ); } // Attempt to encode the JSON data and throw errors if it fails - if ( false === wp_json_encode( $value ) ) { + if ( false === wp_json_encode( $value, JSON_UNESCAPED_SLASHES ) ) { $message = 'JSON Data must be valid JSON'; throw new Schema_Error( $message, $value ); } diff --git a/projects/packages/schema/tests/php/integration/Integration_Serialization_Test.php b/projects/packages/schema/tests/php/integration/Integration_Serialization_Test.php index 82736a8647f5..7d16cbe9beba 100644 --- a/projects/packages/schema/tests/php/integration/Integration_Serialization_Test.php +++ b/projects/packages/schema/tests/php/integration/Integration_Serialization_Test.php @@ -93,7 +93,7 @@ public function test_serialization_to_string() { ); $this->assertSame( $expect_with_fallback, $with_fallback->schema() ); - $this->assertSame( wp_json_encode( $expect_with_fallback ), wp_json_encode( $with_fallback ) ); + $this->assertSame( wp_json_encode( $expect_with_fallback, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), wp_json_encode( $with_fallback, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); } public function test_serialization_assoc_value() { @@ -186,7 +186,7 @@ public function test_serialization_assoc_value() { // Test in both directions $this->assertSame( $expect_schema_to_be, $schema->schema() ); - $this->assertSame( $expect_schema_to_be, json_decode( wp_json_encode( $schema ), true ) ); + $this->assertSame( $expect_schema_to_be, json_decode( wp_json_encode( $schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), true ) ); } public function test_serialization_assoc_nested() { @@ -224,7 +224,7 @@ public function test_serialization_assoc_nested() { ); $this->assertSame( $expect_schema_to_be, $schema->schema() ); - $this->assertSame( wp_json_encode( $expect_schema_to_be ), wp_json_encode( $schema ) ); + $this->assertSame( wp_json_encode( $expect_schema_to_be, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), wp_json_encode( $schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); } public function test_serialization_array_fallbacks() { @@ -249,7 +249,7 @@ public function test_serialization_array_fallbacks() { ); $this->assertSame( $expect_array_value_fallback, $array_value_fallback->schema() ); - $this->assertSame( wp_json_encode( $expect_array_value_fallback ), wp_json_encode( $array_value_fallback ) ); + $this->assertSame( wp_json_encode( $expect_array_value_fallback, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), wp_json_encode( $array_value_fallback, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); // Fallback on Array $array_group_fallback = Schema::as_array( @@ -272,7 +272,7 @@ public function test_serialization_array_fallbacks() { ); $this->assertSame( $expect_array_group_fallback, $array_group_fallback->schema() ); - $this->assertSame( wp_json_encode( $expect_array_group_fallback ), wp_json_encode( $array_group_fallback ) ); + $this->assertSame( wp_json_encode( $expect_array_group_fallback, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), wp_json_encode( $array_group_fallback, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); // Fallback on Array of Arrays $array_group_fallback = Schema::as_array( @@ -300,6 +300,6 @@ public function test_serialization_array_fallbacks() { ); $this->assertSame( $expect_array_group_fallback, $array_group_fallback->schema() ); - $this->assertSame( wp_json_encode( $expect_array_group_fallback ), wp_json_encode( $array_group_fallback ) ); + $this->assertSame( wp_json_encode( $expect_array_group_fallback, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), wp_json_encode( $array_group_fallback, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); } } diff --git a/projects/packages/search/changelog/fix-audit_json_encode_flags b/projects/packages/search/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/search/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/search/src/classic-search/class-classic-search.php b/projects/packages/search/src/classic-search/class-classic-search.php index 2ea6343e2d63..bb2aef699266 100644 --- a/projects/packages/search/src/classic-search/class-classic-search.php +++ b/projects/packages/search/src/classic-search/class-classic-search.php @@ -358,7 +358,7 @@ public function search( array $es_args ) { 'user-agent' => 'jetpack_search', ); - $request_body = wp_json_encode( $es_args ); + $request_body = wp_json_encode( $es_args, JSON_UNESCAPED_SLASHES ); $start_time = microtime( true ); diff --git a/projects/packages/search/src/customberg/class-customberg.php b/projects/packages/search/src/customberg/class-customberg.php index f7f605fbb935..1a295b879755 100644 --- a/projects/packages/search/src/customberg/class-customberg.php +++ b/projects/packages/search/src/customberg/class-customberg.php @@ -141,7 +141,7 @@ public function load_assets_with_parameters( $package_base_path ) { Assets::enqueue_script( 'jp-search-configure' ); // Use wp_add_inline_script instead of wp_localize_script, see https://core.trac.wordpress.org/ticket/25280. - wp_add_inline_script( 'jp-search-configure', 'var JetpackInstantSearchOptions=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( Helper::generate_initial_javascript_state() ) ) . '"));', 'before' ); + wp_add_inline_script( 'jp-search-configure', 'var JetpackInstantSearchOptions=' . wp_json_encode( Helper::generate_initial_javascript_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); wp_add_inline_script( 'jp-search-configure', "window.jetpackSearchConfigureInit( 'jp-search-configure' )" diff --git a/projects/packages/search/src/dashboard/class-initial-state.php b/projects/packages/search/src/dashboard/class-initial-state.php index efb7cadf7626..ff7bc1b01a4d 100644 --- a/projects/packages/search/src/dashboard/class-initial-state.php +++ b/projects/packages/search/src/dashboard/class-initial-state.php @@ -47,7 +47,7 @@ public function __construct( $connection_manager = null, $module_control = null * @return string - JS string. */ public function render() { - return 'var JETPACK_SEARCH_DASHBOARD_INITIAL_STATE=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( $this->get_initial_state() ) ) . '"));'; + return 'var JETPACK_SEARCH_DASHBOARD_INITIAL_STATE=' . wp_json_encode( $this->get_initial_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } /** diff --git a/projects/packages/search/src/instant-search/class-instant-search.php b/projects/packages/search/src/instant-search/class-instant-search.php index 45f838cc5960..fad9a5690f09 100644 --- a/projects/packages/search/src/instant-search/class-instant-search.php +++ b/projects/packages/search/src/instant-search/class-instant-search.php @@ -131,7 +131,7 @@ public function load_assets_with_parameters( $package_base_path ) { protected function inject_javascript_options() { $options = Helper::generate_initial_javascript_state(); // Use wp_add_inline_script instead of wp_localize_script, see https://core.trac.wordpress.org/ticket/25280. - wp_add_inline_script( 'jetpack-instant-search', 'var JetpackInstantSearchOptions=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( $options ) ) . '"));', 'before' ); + wp_add_inline_script( 'jetpack-instant-search', 'var JetpackInstantSearchOptions=' . wp_json_encode( $options, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); } /** @@ -228,7 +228,7 @@ public function instant_api( array $args ) { $start_time = microtime( true ); // Cache locally to avoid remote request slowing the page. - $transient_name = 'jetpack_instant_search_cache_' . md5( wp_json_encode( $args ) ); + $transient_name = 'jetpack_instant_search_cache_' . md5( wp_json_encode( $args, JSON_UNESCAPED_SLASHES ) ); $cache = get_transient( $transient_name ); if ( false !== $cache ) { return $cache; diff --git a/projects/packages/search/tests/php/Inline_Search_Filters_Test.php b/projects/packages/search/tests/php/Inline_Search_Filters_Test.php index 9d30e91b610d..2367c30f73b7 100644 --- a/projects/packages/search/tests/php/Inline_Search_Filters_Test.php +++ b/projects/packages/search/tests/php/Inline_Search_Filters_Test.php @@ -77,7 +77,8 @@ public function filter_pre_http_request_mock( $preempt, array $args, string $act array( 'total' => 0, 'results' => array(), - ) + ), + JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200 ), 'cookies' => array(), diff --git a/projects/packages/search/tests/php/Inline_Search_Test.php b/projects/packages/search/tests/php/Inline_Search_Test.php index 036298dc5f28..43aad938a10b 100644 --- a/projects/packages/search/tests/php/Inline_Search_Test.php +++ b/projects/packages/search/tests/php/Inline_Search_Test.php @@ -63,7 +63,8 @@ public function filter_pre_http_request_mock( $preempt, array $args, string $act array( 'total' => 0, 'results' => array(), - ) + ), + JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200 ), 'cookies' => array(), diff --git a/projects/packages/search/tests/php/REST_Controller_Test.php b/projects/packages/search/tests/php/REST_Controller_Test.php index 2e248408cd54..1fc92c4038f7 100644 --- a/projects/packages/search/tests/php/REST_Controller_Test.php +++ b/projects/packages/search/tests/php/REST_Controller_Test.php @@ -100,7 +100,8 @@ public function test_update_search_settings_unauthorized() { array( 'module_active' => true, 'instant_search_enabled' => true, - ) + ), + JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); @@ -121,7 +122,7 @@ public function test_update_search_settings_success_both_enable() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/search/settings' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $new_settings ) ); + $request->set_body( wp_json_encode( $new_settings, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 200, $response->get_status() ); $this->assertEquals( $new_settings, $response->get_data() ); @@ -140,7 +141,7 @@ public function test_update_search_settings_invalid_request_1() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/search/settings' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $new_settings ) ); + $request->set_body( wp_json_encode( $new_settings, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 400, $response->get_status() ); } @@ -154,7 +155,7 @@ public function test_update_search_settings_invalid_request_2() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/search/settings' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $new_settings ) ); + $request->set_body( wp_json_encode( $new_settings, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 400, $response->get_status() ); } @@ -172,7 +173,7 @@ public function test_update_search_settings_success_both_disable() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/search/settings' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $new_settings ) ); + $request->set_body( wp_json_encode( $new_settings, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 200, $response->get_status() ); $this->assertEquals( $new_settings, $response->get_data() ); @@ -194,7 +195,7 @@ public function test_update_search_settings_success_disable_module_only() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/search/settings' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $new_settings ) ); + $request->set_body( wp_json_encode( $new_settings, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 200, $response->get_status() ); $this->assertEquals( $expected, $response->get_data() ); @@ -216,7 +217,7 @@ public function test_update_search_settings_success_disable_instant_only() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/search/settings' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $new_settings ) ); + $request->set_body( wp_json_encode( $new_settings, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 200, $response->get_status() ); $this->assertEquals( $expected, $response->get_data() ); @@ -238,7 +239,7 @@ public function test_update_search_settings_success_enable_inline_search() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/search/settings' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $new_settings ) ); + $request->set_body( wp_json_encode( $new_settings, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 200, $response->get_status() ); $this->assertEquals( $expected, $response->get_data() ); @@ -260,7 +261,7 @@ public function test_update_search_settings_success_disable_inline_search() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/search/settings' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $new_settings ) ); + $request->set_body( wp_json_encode( $new_settings, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 200, $response->get_status() ); $this->assertEquals( $expected, $response->get_data() ); diff --git a/projects/packages/stats-admin/changelog/fix-audit_json_encode_flags b/projects/packages/stats-admin/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/stats-admin/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/stats-admin/src/class-notices.php b/projects/packages/stats-admin/src/class-notices.php index de2bd869aee0..093660de4d81 100644 --- a/projects/packages/stats-admin/src/class-notices.php +++ b/projects/packages/stats-admin/src/class-notices.php @@ -53,7 +53,8 @@ public function update_notice( $id, $status, $postponed_for = 0 ) { 'id' => $id, 'status' => $status, 'postponed_for' => $postponed_for, - ) + ), + JSON_UNESCAPED_SLASHES ), 'wpcom' ); diff --git a/projects/packages/stats-admin/src/class-odyssey-assets.php b/projects/packages/stats-admin/src/class-odyssey-assets.php index 90fcc9acbf00..4379b06ae369 100644 --- a/projects/packages/stats-admin/src/class-odyssey-assets.php +++ b/projects/packages/stats-admin/src/class-odyssey-assets.php @@ -138,7 +138,8 @@ protected function get_cache_buster_option_value( $cache_buster ) { array( 'cache_buster' => (string) $cache_buster, 'cached_at' => floor( microtime( true ) * 1000 ), // milliseconds. - ) + ), + JSON_UNESCAPED_SLASHES ); } } diff --git a/projects/packages/stats-admin/src/class-odyssey-config-data.php b/projects/packages/stats-admin/src/class-odyssey-config-data.php index 0b05de4903b9..231fc2d1bd9c 100644 --- a/projects/packages/stats-admin/src/class-odyssey-config-data.php +++ b/projects/packages/stats-admin/src/class-odyssey-config-data.php @@ -28,7 +28,8 @@ class Odyssey_Config_Data { */ public function get_js_config_data( $config_variable_name = 'configData', $config_data = null ) { return "window.{$config_variable_name} = " . wp_json_encode( - $config_data === null ? $this->get_data() : $config_data + $config_data === null ? $this->get_data() : $config_data, + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } diff --git a/projects/packages/stats-admin/src/class-rest-controller.php b/projects/packages/stats-admin/src/class-rest-controller.php index f973b0a4c005..162609bac0f0 100644 --- a/projects/packages/stats-admin/src/class-rest-controller.php +++ b/projects/packages/stats-admin/src/class-rest-controller.php @@ -762,7 +762,8 @@ public function post_user_feedback( $req ) { array( 'user_email' => $user_email, ) - ) + ), + JSON_UNESCAPED_SLASHES ), 'wpcom' ); diff --git a/projects/packages/stats-admin/src/class-wpcom-client.php b/projects/packages/stats-admin/src/class-wpcom-client.php index 5576a1fc18fc..7861b17864e5 100644 --- a/projects/packages/stats-admin/src/class-wpcom-client.php +++ b/projects/packages/stats-admin/src/class-wpcom-client.php @@ -33,7 +33,7 @@ public static function request_as_blog_cached( $path, $version = '1.1', $args = $use_cache = $use_cache && ! ( isset( $args['method'] ) && strtoupper( $args['method'] ) !== 'GET' ) && ! static::should_bypass_cache(); // Arrays are serialized without considering the order of objects, but it's okay atm. - $cache_key = $cache_key !== null ? $cache_key : 'STATS_REST_RESP_' . md5( implode( '|', array( $path, $version, wp_json_encode( $args ), wp_json_encode( $body ), $base_api_path ) ) ); + $cache_key = $cache_key !== null ? $cache_key : 'STATS_REST_RESP_' . md5( implode( '|', array( $path, $version, wp_json_encode( $args, JSON_UNESCAPED_SLASHES ), wp_json_encode( $body, JSON_UNESCAPED_SLASHES ), $base_api_path ) ) ); if ( $use_cache ) { $response_body_content = get_transient( $cache_key ); @@ -49,7 +49,7 @@ public static function request_as_blog_cached( $path, $version = '1.1', $args = } // Cache the response for 5 minutes. - set_transient( $cache_key, wp_json_encode( $response_body ), 5 * MINUTE_IN_SECONDS ); + set_transient( $cache_key, wp_json_encode( $response_body, JSON_UNESCAPED_SLASHES ), 5 * MINUTE_IN_SECONDS ); return $response_body; } diff --git a/projects/packages/stats-admin/tests/php/Odyssey_Assets_Test.php b/projects/packages/stats-admin/tests/php/Odyssey_Assets_Test.php index c53f1dd47f0f..e37107d1467a 100644 --- a/projects/packages/stats-admin/tests/php/Odyssey_Assets_Test.php +++ b/projects/packages/stats-admin/tests/php/Odyssey_Assets_Test.php @@ -37,7 +37,8 @@ public function test_get_cdn_asset_cache_buster_already_cached() { array( 'cache_buster' => 'calypso-4917-8664-123456', 'cached_at' => floor( microtime( true ) * 1000 ), // milliseconds. - ) + ), + JSON_UNESCAPED_SLASHES ), false ); @@ -54,7 +55,8 @@ public function test_get_cdn_asset_cache_buster_already_cached_expired() { array( 'cache_buster' => 'calypso-4917-8664-123456', 'cached_at' => floor( microtime( true ) * 1000 - MINUTE_IN_SECONDS * 1000 * 20 ), // milliseconds. - ) + ), + JSON_UNESCAPED_SLASHES ), false ); @@ -72,7 +74,8 @@ public function test_get_cdn_asset_cache_buster_failed_to_fetch() { array( 'cache_buster' => 'calypso-4917-8664-123456', 'cached_at' => floor( microtime( true ) * 1000 - MINUTE_IN_SECONDS * 1000 * 20 ), // milliseconds. - ) + ), + JSON_UNESCAPED_SLASHES ), false ); diff --git a/projects/packages/stats/changelog/fix-audit_json_encode_flags b/projects/packages/stats/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/stats/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/stats/src/class-tracking-pixel.php b/projects/packages/stats/src/class-tracking-pixel.php index e19d109e6f30..6406f8045f8f 100644 --- a/projects/packages/stats/src/class-tracking-pixel.php +++ b/projects/packages/stats/src/class-tracking-pixel.php @@ -162,7 +162,7 @@ private static function build_search_filters( $query ) { } } if ( ! empty( $terms ) ) { - $filters .= '&terms=' . wp_json_encode( $terms ); + $filters .= '&terms=' . wp_json_encode( $terms, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); } return $filters; } @@ -181,7 +181,7 @@ private static function build_stats_details( $data ) { return sprintf( '_stq = window._stq || []; -_stq.push([ "view", JSON.parse(%1$s) ]); +_stq.push([ "view", %1$s ]); _stq.push([ "clickTrackerInit", "%2$s", "%3$s" ]);', $data_stats_array, $data['blog'], @@ -342,9 +342,8 @@ private static function stats_array_to_string( $kvs ) { $kvs = (array) apply_filters( self::STATS_ARRAY_TO_STRING_FILTER, $kvs ); $kvs = array_map( 'strval', $kvs ); - // Encode into JSON object, and then encode it into a string that's safe to embed into Javascript. - // We will then use JSON.parse method in JS to read the array. - return wp_json_encode( wp_json_encode( $kvs ) ); + // Encode into JSON object for direct use in JS. + return wp_json_encode( $kvs, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); } /** diff --git a/projects/packages/stats/src/class-wpcom-stats.php b/projects/packages/stats/src/class-wpcom-stats.php index 02714fbd3015..dd627f390705 100644 --- a/projects/packages/stats/src/class-wpcom-stats.php +++ b/projects/packages/stats/src/class-wpcom-stats.php @@ -445,7 +445,7 @@ protected function build_endpoint() { protected function fetch_stats( $args = array() ) { $endpoint = $this->build_endpoint(); $api_version = self::STATS_REST_API_VERSION; - $cache_key = md5( implode( '|', array( $endpoint, $api_version, wp_json_encode( $args ) ) ) ); + $cache_key = md5( implode( '|', array( $endpoint, $api_version, wp_json_encode( $args, JSON_UNESCAPED_SLASHES ) ) ) ); $transient_name = self::STATS_CACHE_TRANSIENT_PREFIX . $cache_key; $stats_cache = get_transient( $transient_name ); @@ -463,7 +463,7 @@ protected function fetch_stats( $args = array() ) { $wpcom_stats = $this->fetch_remote_stats( $endpoint, $args ); // To reduce size in storage: store with time as key, store JSON encoded data. - $cached_value = is_wp_error( $wpcom_stats ) ? $wpcom_stats : wp_json_encode( $wpcom_stats ); + $cached_value = is_wp_error( $wpcom_stats ) ? $wpcom_stats : wp_json_encode( $wpcom_stats, JSON_UNESCAPED_SLASHES ); /** * Filters the expiration time for the stats cache. @@ -585,7 +585,7 @@ public function convert_stats_array_to_object( $stats_array ) { if ( is_wp_error( $stats_array ) ) { return $stats_array; } - $encoded_array = wp_json_encode( $stats_array ); + $encoded_array = wp_json_encode( $stats_array, JSON_UNESCAPED_SLASHES ); if ( ! $encoded_array ) { return new WP_Error( 'stats_encoding_error', 'Failed to encode stats array' ); } diff --git a/projects/packages/stats/tests/php/Tracking_Pixel_Test.php b/projects/packages/stats/tests/php/Tracking_Pixel_Test.php index d3f209e3ee31..cbe51402fed2 100644 --- a/projects/packages/stats/tests/php/Tracking_Pixel_Test.php +++ b/projects/packages/stats/tests/php/Tracking_Pixel_Test.php @@ -232,7 +232,7 @@ public function test_build_view_data_with_search() { 'utm_id' => 'some_id', 'utm_source' => 'a_source', 'arch_search' => 'term', - 'arch_filters' => 'posts_per_page=10&paged=2&orderby=date&order=ASC&author_name=author&terms=' . wp_json_encode( array( 'testtax' => array( 'testterm' ) ) ), + 'arch_filters' => 'posts_per_page=10&paged=2&orderby=date&order=ASC&author_name=author&terms=' . wp_json_encode( array( 'testtax' => array( 'testterm' ) ), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ), 'arch_results' => 2, ); $this->assertSame( $expected_view_data, $view_data ); @@ -335,7 +335,7 @@ public function test_get_footer_to_add_applies_filter() { $pixel_details = $method->invoke( new Tracking_Pixel(), $data ); $expected_pixel_details = '_stq = window._stq || []; -_stq.push([ "view", JSON.parse("{\"v\":\"ext\",\"blog\":\"1234\",\"post\":\"0\",\"tz\":\"\",\"srv\":\"replaced.com\"}") ]); +_stq.push([ "view", {"v":"ext","blog":"1234","post":"0","tz":"","srv":"replaced.com"} ]); _stq.push([ "clickTrackerInit", "1234", "0" ]);'; remove_filter( 'stats_array', array( $this, 'stats_array_filter_replace_srv' ) ); diff --git a/projects/packages/stats/tests/php/WPCOM_Stats_Test.php b/projects/packages/stats/tests/php/WPCOM_Stats_Test.php index 8cf5324c4455..9ff7ea112761 100644 --- a/projects/packages/stats/tests/php/WPCOM_Stats_Test.php +++ b/projects/packages/stats/tests/php/WPCOM_Stats_Test.php @@ -56,7 +56,7 @@ public function test_get_stats() { $stats = $this->wpcom_stats->get_stats(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/' ) ); } /** @@ -85,7 +85,7 @@ public function test_get_stats_summary() { $stats = $this->wpcom_stats->get_stats_summary(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/summary' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/summary' ) ); } /** @@ -114,7 +114,7 @@ public function test_get_top_posts() { $stats = $this->wpcom_stats->get_top_posts(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/top-posts' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/top-posts' ) ); } /** @@ -145,7 +145,7 @@ public function test_get_video_details() { $stats = $this->wpcom_stats->get_video_details( $video_id ); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/video/' . $video_id ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/video/' . $video_id ) ); } /** @@ -175,7 +175,7 @@ public function test_get_referrers() { $stats = $this->wpcom_stats->get_referrers(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/referrers' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/referrers' ) ); } /** @@ -205,7 +205,7 @@ public function test_get_clicks() { $stats = $this->wpcom_stats->get_clicks(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/clicks' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/clicks' ) ); } /** @@ -228,7 +228,7 @@ public function test_get_tags() { $stats = $this->wpcom_stats->get_tags(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/tags' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/tags' ) ); } /** @@ -256,7 +256,7 @@ public function test_get_top_authors() { $stats = $this->wpcom_stats->get_top_authors(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/top-authors' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/top-authors' ) ); } /** @@ -280,7 +280,7 @@ public function test_get_top_comments() { $stats = $this->wpcom_stats->get_top_comments(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/comments' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/comments' ) ); } /** @@ -310,7 +310,7 @@ public function test_get_video_plays() { $stats = $this->wpcom_stats->get_video_plays(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/video-plays' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/video-plays' ) ); } /** @@ -340,7 +340,7 @@ public function test_get_file_downloads() { $stats = $this->wpcom_stats->get_file_downloads(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/file-downloads' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/file-downloads' ) ); } /** @@ -365,7 +365,7 @@ public function test_get_post_views() { $stats = $this->wpcom_stats->get_post_views( $post_id ); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/post/' . $post_id ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/post/' . $post_id ) ); } /** @@ -395,7 +395,7 @@ public function test_get_views_by_country() { $stats = $this->wpcom_stats->get_views_by_country(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/country-views' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/country-views' ) ); } /** @@ -422,7 +422,7 @@ public function test_get_followers() { $stats = $this->wpcom_stats->get_followers(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/followers' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/followers' ) ); } /** @@ -447,7 +447,7 @@ public function test_get_comment_followers() { $stats = $this->wpcom_stats->get_comment_followers(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/comment-followers' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/comment-followers' ) ); } /** @@ -469,7 +469,7 @@ public function test_get_publicize_followers() { $stats = $this->wpcom_stats->get_publicize_followers(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/publicize' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/publicize' ) ); } /** @@ -500,7 +500,7 @@ public function test_get_search_terms() { $stats = $this->wpcom_stats->get_search_terms(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/search-terms' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/search-terms' ) ); } /** @@ -530,7 +530,7 @@ public function test_get_total_post_views() { $stats = $this->wpcom_stats->get_total_post_views(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/views/posts' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/views/posts' ) ); } /** @@ -617,7 +617,7 @@ public function test_get_visits() { $stats = $this->wpcom_stats->get_visits(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/visits' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/visits' ) ); } /** @@ -658,7 +658,7 @@ public function test_get_highlights() { $stats = $this->wpcom_stats->get_highlights(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/highlights' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/highlights' ) ); } /** @@ -714,7 +714,7 @@ public function test_get_insights() { $stats = $this->wpcom_stats->get_insights(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/insights' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/insights' ) ); } /** @@ -752,7 +752,7 @@ public function test_get_streak() { $stats = $this->wpcom_stats->get_streak(); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/streak' ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/streak' ) ); } /** @@ -838,7 +838,7 @@ public function test_get_stats_with_arguments() { $stats = $this->wpcom_stats->get_stats( $args ); $this->assertSame( $expected_stats, $stats ); - $this->assertSame( wp_json_encode( $expected_stats ), self::get_stats_transient( '/sites/1234/stats/', $args ) ); + $this->assertSame( wp_json_encode( $expected_stats, JSON_UNESCAPED_SLASHES ), self::get_stats_transient( '/sites/1234/stats/', $args ) ); } /** @@ -849,7 +849,7 @@ public function test_get_stats_with_arguments() { * @return string|false The transient value if set, otherwise false */ private static function get_stats_transient( $endpoint, $args = array() ) { - $cache_key = md5( implode( '|', array( $endpoint, WPCOM_Stats::STATS_REST_API_VERSION, wp_json_encode( $args ) ) ) ); + $cache_key = md5( implode( '|', array( $endpoint, WPCOM_Stats::STATS_REST_API_VERSION, wp_json_encode( $args, JSON_UNESCAPED_SLASHES ) ) ) ); $transient_name = WPCOM_Stats::STATS_CACHE_TRANSIENT_PREFIX . $cache_key; $stats_cache = get_transient( $transient_name ); diff --git a/projects/packages/sync/changelog/fix-audit_json_encode_flags b/projects/packages/sync/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/sync/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/sync/src/class-actions.php b/projects/packages/sync/src/class-actions.php index a10a1f1618d0..ca69ef3abcf6 100644 --- a/projects/packages/sync/src/class-actions.php +++ b/projects/packages/sync/src/class-actions.php @@ -1170,7 +1170,7 @@ private static function prepare_jsonl_data( $data ) { "\n", array_map( function ( $key, $value ) { - return wp_json_encode( array( $key => $value ) ); + return wp_json_encode( array( $key => $value ), JSON_UNESCAPED_SLASHES ); }, array_keys( (array) $data ), array_values( (array) $data ) diff --git a/projects/packages/sync/src/class-functions.php b/projects/packages/sync/src/class-functions.php index 91fe9d7d98ac..a00bfd1d96d6 100644 --- a/projects/packages/sync/src/class-functions.php +++ b/projects/packages/sync/src/class-functions.php @@ -71,7 +71,7 @@ public static function get_shortcodes() { public static function sanitize_taxonomy( $taxonomy ) { // Lets clone the taxonomy object instead of modifing the global one. - $cloned_taxonomy = json_decode( wp_json_encode( $taxonomy ) ); + $cloned_taxonomy = json_decode( wp_json_encode( $taxonomy, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); // recursive taxonomies are no fun. if ( $cloned_taxonomy === null ) { diff --git a/projects/packages/sync/src/class-json-deflate-array-codec.php b/projects/packages/sync/src/class-json-deflate-array-codec.php index a0452232b60a..3dcaf4e9260f 100644 --- a/projects/packages/sync/src/class-json-deflate-array-codec.php +++ b/projects/packages/sync/src/class-json-deflate-array-codec.php @@ -61,7 +61,7 @@ public function decode( $input ) { * @return false|string */ protected function json_serialize( $any ) { - return wp_json_encode( Functions::json_wrap( $any ) ); + return wp_json_encode( Functions::json_wrap( $any ), JSON_UNESCAPED_SLASHES ); } /** diff --git a/projects/packages/sync/src/modules/class-module.php b/projects/packages/sync/src/modules/class-module.php index 0e03841fbde1..8bcf4f1ea21f 100644 --- a/projects/packages/sync/src/modules/class-module.php +++ b/projects/packages/sync/src/modules/class-module.php @@ -246,7 +246,12 @@ protected function get_check_sum( $values, $sort = true ) { if ( $sort && is_array( $values ) ) { $this->recursive_ksort( $values ); } - return crc32( wp_json_encode( Functions::json_wrap( $values ) ) ); + return crc32( + wp_json_encode( + Functions::json_wrap( $values ), + 0 // No `json_encode()` flags because we don't want disrupt the checksum algorithm. + ) + ); } /** @@ -449,7 +454,7 @@ public function send_full_sync_actions( $config, $status, $send_until, $started // If we have objects as a key it means get_next_chunk is being overridden, we need to check for it being an empty array. // In case it is an empty array, we should not send the action or increase the chunks_sent, we just need to update the status. if ( ! isset( $objects['objects'] ) || array() !== $objects['objects'] ) { - $key = $this->full_sync_action_name() . '_' . crc32( wp_json_encode( $status['last_sent'] ) ); + $key = $this->full_sync_action_name() . '_' . crc32( wp_json_encode( $status['last_sent'], JSON_UNESCAPED_SLASHES ) ); $result = $this->send_action( $this->full_sync_action_name(), array( $objects, $status['last_sent'] ), $key ); if ( is_wp_error( $result ) || $wpdb->last_error ) { $status['error'] = true; diff --git a/projects/packages/sync/src/modules/class-updates.php b/projects/packages/sync/src/modules/class-updates.php index 37774d5e77c3..555b0f9ec5f2 100644 --- a/projects/packages/sync/src/modules/class-updates.php +++ b/projects/packages/sync/src/modules/class-updates.php @@ -514,7 +514,7 @@ public function expand_themes( $args ) { } if ( ! is_array( $args[0]->response ) ) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error - trigger_error( 'Warning: Not an Array as expected but -> ' . wp_json_encode( $args[0]->response ) . ' instead', E_USER_WARNING ); + trigger_error( 'Warning: Not an Array as expected but -> ' . wp_json_encode( $args[0]->response, JSON_UNESCAPED_SLASHES ) . ' instead', E_USER_WARNING ); return $args; } foreach ( $args[0]->response as $stylesheet => &$theme_data ) { diff --git a/projects/packages/sync/tests/php/Actions_Test.php b/projects/packages/sync/tests/php/Actions_Test.php index c92baad9f7db..929067e5611b 100644 --- a/projects/packages/sync/tests/php/Actions_Test.php +++ b/projects/packages/sync/tests/php/Actions_Test.php @@ -191,7 +191,8 @@ public static function send_data_with_wpcom_rest_api_enabled_data_provider() { 'body' => wp_json_encode( array( 'processed_items' => array( 'dummy' ), - ) + ), + JSON_UNESCAPED_SLASHES ), ); }, @@ -236,7 +237,8 @@ public static function send_data_with_wpcom_rest_api_enabled_data_provider() { 'code' => 'rest_invalid_param', 'message' => 'Invalid parameter(s): sync', 'data' => array( 'status' => 400 ), - ) + ), + JSON_UNESCAPED_SLASHES ), ); }, diff --git a/projects/packages/transport-helper/changelog/fix-audit_json_encode_flags b/projects/packages/transport-helper/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/transport-helper/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/transport-helper/tests/php/REST_Controller_Test.php b/projects/packages/transport-helper/tests/php/REST_Controller_Test.php index ae2b51a9729c..c7144337dd7a 100644 --- a/projects/packages/transport-helper/tests/php/REST_Controller_Test.php +++ b/projects/packages/transport-helper/tests/php/REST_Controller_Test.php @@ -110,7 +110,7 @@ public function test_install_helper_script_unauthorized() { ); $request = new WP_REST_Request( 'POST', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 403, $response->get_status() ); $this->assertEquals( 'You are not allowed to perform this action.', $response->get_data()['message'] ); @@ -126,7 +126,7 @@ public function test_install_helper_script_success() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->dispatch_request_signed_with_blog_token( $request ); $response_data = $response->get_data(); @@ -165,7 +165,7 @@ public function test_install_helper_script_bad_header() { $request = new WP_REST_Request( 'POST', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->dispatch_request_signed_with_blog_token( $request ); $this->assertEquals( 400, $response->get_status() ); @@ -194,7 +194,7 @@ public function test_delete_helper_script_unauthorized() { $request = new WP_REST_Request( 'DELETE', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertEquals( 403, $response->get_status() ); @@ -211,7 +211,7 @@ public function test_delete_helper_script_success() { $request = new WP_REST_Request( 'DELETE', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->dispatch_request_signed_with_blog_token( $request ); $this->assertEquals( 200, $response->get_status() ); @@ -230,7 +230,7 @@ public function test_delete_helper_script_bad_header() { $request = new WP_REST_Request( 'DELETE', '/jetpack/v4/backup-helper-script' ); $request->set_header( 'content-type', 'application/json' ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->dispatch_request_signed_with_blog_token( $request ); $this->assertEquals( 500, $response->get_status() ); diff --git a/projects/packages/videopress/changelog/fix-audit_json_encode_flags b/projects/packages/videopress/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/videopress/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/videopress/src/class-admin-ui.php b/projects/packages/videopress/src/class-admin-ui.php index 71d429d2c5f4..6241a45cb62e 100644 --- a/projects/packages/videopress/src/class-admin-ui.php +++ b/projects/packages/videopress/src/class-admin-ui.php @@ -169,7 +169,7 @@ public static function enqueue_admin_scripts() { * @return string */ public static function render_initial_state() { - return 'var jetpackVideoPressInitialState=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( self::initial_state() ) ) . '"));'; + return 'var jetpackVideoPressInitialState=' . wp_json_encode( self::initial_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } /** diff --git a/projects/packages/videopress/src/class-initializer.php b/projects/packages/videopress/src/class-initializer.php index a62756cdf4b4..ee119f3a5c34 100644 --- a/projects/packages/videopress/src/class-initializer.php +++ b/projects/packages/videopress/src/class-initializer.php @@ -280,7 +280,7 @@ public static function render_videopress_video_block( $block_attributes, $conten $preview_on_hover = sprintf( '
', $inline_style, - wp_json_encode( $preview_on_hover ) + wp_json_encode( $preview_on_hover, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) ); // Set `autoplay` and `muted` attributes to the video element. diff --git a/projects/packages/videopress/src/class-wpcom-rest-api-v2-endpoint-videopress.php b/projects/packages/videopress/src/class-wpcom-rest-api-v2-endpoint-videopress.php index 557e2ede36ea..726bb5f63e3f 100644 --- a/projects/packages/videopress/src/class-wpcom-rest-api-v2-endpoint-videopress.php +++ b/projects/packages/videopress/src/class-wpcom-rest-api-v2-endpoint-videopress.php @@ -290,7 +290,7 @@ public function videopress_block_update_poster( $request ) { return $this->wpcom_poster_request( $video_guid, $args, - wp_json_encode( $json_params ) + wp_json_encode( $json_params, JSON_UNESCAPED_SLASHES ) ); } catch ( \Exception $e ) { return rest_ensure_response( new WP_Error( 'videopress_block_update_poster_error', $e->getMessage() ) ); @@ -456,7 +456,7 @@ public function videopress_block_update_meta( $request ) { $endpoint, '2', $args, - wp_json_encode( $video_request_params ), + wp_json_encode( $video_request_params, JSON_UNESCAPED_SLASHES ), 'wpcom' ); diff --git a/projects/packages/videopress/src/tus/class-tus-abstract-cache.php b/projects/packages/videopress/src/tus/class-tus-abstract-cache.php index f1563a8f1ed0..fbd16de72b30 100644 --- a/projects/packages/videopress/src/tus/class-tus-abstract-cache.php +++ b/projects/packages/videopress/src/tus/class-tus-abstract-cache.php @@ -166,7 +166,7 @@ public function set( $key, $value ) { $contents[] = $value; } - $status = $this->cache_set( $key, \wp_json_encode( $contents ), ! empty( $cache_data ) ); + $status = $this->cache_set( $key, \wp_json_encode( $contents, JSON_UNESCAPED_SLASHES ), ! empty( $cache_data ) ); return false !== $status; } diff --git a/projects/packages/videopress/tests/php/VideoPress_Uploader_Test.php b/projects/packages/videopress/tests/php/VideoPress_Uploader_Test.php index 96f20a69e6b0..c471035e04a4 100644 --- a/projects/packages/videopress/tests/php/VideoPress_Uploader_Test.php +++ b/projects/packages/videopress/tests/php/VideoPress_Uploader_Test.php @@ -146,7 +146,7 @@ public function return_wp_error() { * @return array */ public function return_valid_response() { - return array( 'body' => wp_json_encode( array( 'upload_token' => 'asd123qwe' ) ) ); + return array( 'body' => wp_json_encode( array( 'upload_token' => 'asd123qwe' ), JSON_UNESCAPED_SLASHES ) ); } /** diff --git a/projects/packages/waf/changelog/fix-audit_json_encode_flags b/projects/packages/waf/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/waf/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/waf/src/class-brute-force-protection.php b/projects/packages/waf/src/class-brute-force-protection.php index cb22baf726bc..798adbd55fc6 100644 --- a/projects/packages/waf/src/class-brute-force-protection.php +++ b/projects/packages/waf/src/class-brute-force-protection.php @@ -1007,7 +1007,7 @@ public function protect_call( $action = 'check_ip', $request = array() ) { $request['action'] = $action; $request['ip'] = IP_Utils::get_ip(); $request['host'] = $this->get_local_host(); - $request['headers'] = wp_json_encode( $this->get_headers() ); + $request['headers'] = wp_json_encode( $this->get_headers(), JSON_UNESCAPED_SLASHES ); $request['jetpack_version'] = null; $request['wordpress_version'] = (string) $wp_version; $request['api_key'] = $api_key; @@ -1085,7 +1085,7 @@ public function protect_call( $action = 'check_ip', $request = array() ) { */ public function get_transient_name() { $headers = $this->get_headers(); - $header_hash = md5( wp_json_encode( $headers ) ); + $header_hash = md5( wp_json_encode( $headers, JSON_UNESCAPED_SLASHES ) ); return 'jpp_li_' . $header_hash; } diff --git a/projects/packages/waf/src/class-waf-blocklog-manager.php b/projects/packages/waf/src/class-waf-blocklog-manager.php index 031c71ff71c3..74178ad7b385 100644 --- a/projects/packages/waf/src/class-waf-blocklog-manager.php +++ b/projects/packages/waf/src/class-waf-blocklog-manager.php @@ -409,10 +409,10 @@ public static function write_blocklog( $rule_id, $reason ) { $log_data['user_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? \stripslashes( $_SERVER['HTTP_USER_AGENT'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash $log_data['referer'] = isset( $_SERVER['HTTP_REFERER'] ) ? \stripslashes( $_SERVER['HTTP_REFERER'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash $log_data['content_type'] = isset( $_SERVER['CONTENT_TYPE'] ) ? \stripslashes( $_SERVER['CONTENT_TYPE'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash - $log_data['get_params'] = json_encode( $_GET ); + $log_data['get_params'] = json_encode( $_GET, JSON_UNESCAPED_SLASHES ); if ( defined( 'JETPACK_WAF_SHARE_DEBUG_DATA' ) && JETPACK_WAF_SHARE_DEBUG_DATA ) { - $log_data['post_params'] = json_encode( $_POST ); + $log_data['post_params'] = json_encode( $_POST, JSON_UNESCAPED_SLASHES ); $log_data['headers'] = self::get_request_headers(); } @@ -425,7 +425,7 @@ public static function write_blocklog( $rule_id, $reason ) { if ( $fp ) { try { - fwrite( $fp, json_encode( $log_data ) . "\n" ); + fwrite( $fp, json_encode( $log_data, JSON_UNESCAPED_SLASHES ) . "\n" ); } finally { fclose( $fp ); } diff --git a/projects/packages/waf/tests/php/integration/WafActivationTest.php b/projects/packages/waf/tests/php/integration/WafActivationTest.php index 12ec13b57af9..0aeba1d38e00 100644 --- a/projects/packages/waf/tests/php/integration/WafActivationTest.php +++ b/projects/packages/waf/tests/php/integration/WafActivationTest.php @@ -40,7 +40,7 @@ public function return_sample_response() { ); return array( - 'body' => wp_json_encode( $sample_response ), + 'body' => wp_json_encode( $sample_response, JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200, 'message' => '', diff --git a/projects/packages/waf/tests/php/integration/WafRestIntegrationTest.php b/projects/packages/waf/tests/php/integration/WafRestIntegrationTest.php index a4a0d419850b..8be0b6b00efb 100644 --- a/projects/packages/waf/tests/php/integration/WafRestIntegrationTest.php +++ b/projects/packages/waf/tests/php/integration/WafRestIntegrationTest.php @@ -36,7 +36,7 @@ public function return_sample_response() { ); return array( - 'body' => wp_json_encode( $sample_response ), + 'body' => wp_json_encode( $sample_response, JSON_UNESCAPED_SLASHES ), 'response' => array( 'code' => 200, 'message' => '', @@ -139,7 +139,8 @@ public function testUpdateWaf() { wp_json_encode( array( Waf_Rules_Manager::AUTOMATIC_RULES_ENABLED_OPTION_NAME => true, - ) + ), + JSON_UNESCAPED_SLASHES ) ); @@ -167,7 +168,8 @@ public function testUpdateWafFilesystemUnavailable() { wp_json_encode( array( 'jetpack_waf_automatic_rules_enabled' => true, - ) + ), + JSON_UNESCAPED_SLASHES ) ); diff --git a/projects/packages/waf/tests/php/unit/WafRequestTest.php b/projects/packages/waf/tests/php/unit/WafRequestTest.php index 44793fd4b14c..fb4efba0caaa 100644 --- a/projects/packages/waf/tests/php/unit/WafRequestTest.php +++ b/projects/packages/waf/tests/php/unit/WafRequestTest.php @@ -318,7 +318,8 @@ public function testGetVarsPostWithJsonBodyProcessor() { 'str' => 'value', 'arr' => array( 'a', 'b', 'c' ), 'obj' => (object) array( 'foo' => 'bar' ), - ) + ), + JSON_UNESCAPED_SLASHES ), ) ); @@ -376,7 +377,8 @@ public function testGetVarsPostWithJson() { 'str' => 'value', 'arr' => array( 'a', 'b', 'c' ), 'obj' => (object) array( 'foo' => 'bar' ), - ) + ), + JSON_UNESCAPED_SLASHES ), ) ); diff --git a/projects/packages/waf/tests/php/unit/WafRuntimeTargetsTest.php b/projects/packages/waf/tests/php/unit/WafRuntimeTargetsTest.php index 7902b014e759..ce36fcf854a1 100644 --- a/projects/packages/waf/tests/php/unit/WafRuntimeTargetsTest.php +++ b/projects/packages/waf/tests/php/unit/WafRuntimeTargetsTest.php @@ -44,7 +44,7 @@ public function testArrayTargets( $runtimeFactory, $target_name, $expected_names $values = $runtime->normalize_targets( array( $target_name => array() ) ); $this->assertCount( $expected_count, $values, "$target_name 'all' test returned incorrect count" ); foreach ( $expected as $exp ) { - $this->assertContains( $exp, $values, "$target_name 'all' test did not contain " . json_encode( $exp ) . ' in ' . json_encode( $values ) ); + $this->assertContains( $exp, $values, "$target_name 'all' test did not contain " . json_encode( $exp, JSON_UNESCAPED_SLASHES ) . ' in ' . json_encode( $values, JSON_UNESCAPED_SLASHES ) ); } // test "only" filter $values = $runtime->normalize_targets( array( $target_name => array( 'only' => array( $expected[1]['name'] ) ) ) ); diff --git a/projects/packages/woocommerce-analytics/changelog/fix-audit_json_encode_flags b/projects/packages/woocommerce-analytics/changelog/fix-audit_json_encode_flags new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/packages/woocommerce-analytics/changelog/fix-audit_json_encode_flags @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/woocommerce-analytics/src/class-universal.php b/projects/packages/woocommerce-analytics/src/class-universal.php index d9f27ab22463..6595422dfda5 100644 --- a/projects/packages/woocommerce-analytics/src/class-universal.php +++ b/projects/packages/woocommerce-analytics/src/class-universal.php @@ -90,10 +90,10 @@ public function inject_analytics_data() { wcAnalytics.trackEndpoint = ''; // Set common properties for all events. - wcAnalytics.commonProps = ; + wcAnalytics.commonProps = ; // Set the event queue. - wcAnalytics.eventQueue = ; + wcAnalytics.eventQueue = ; // Features. wcAnalytics.features = { @@ -102,7 +102,7 @@ public function inject_analytics_data() { proxy: , }; - wcAnalytics.breadcrumbs = get_breadcrumb_titles(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?>; + wcAnalytics.breadcrumbs = get_breadcrumb_titles(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); ?>; // Page context flags. wcAnalytics.pages = { diff --git a/projects/packages/woocommerce-analytics/src/class-wc-analytics-tracking.php b/projects/packages/woocommerce-analytics/src/class-wc-analytics-tracking.php index b70a950aabca..582bd9695877 100644 --- a/projects/packages/woocommerce-analytics/src/class-wc-analytics-tracking.php +++ b/projects/packages/woocommerce-analytics/src/class-wc-analytics-tracking.php @@ -356,7 +356,7 @@ public static function get_properties( $event_name, $event_properties ) { } // Serialize non-indexed arrays to JSON strings. - $all_properties[ $key ] = wp_json_encode( $value ); + $all_properties[ $key ] = wp_json_encode( $value, JSON_UNESCAPED_SLASHES ); } return $all_properties; diff --git a/projects/packages/woocommerce-analytics/src/class-woo-analytics-trait.php b/projects/packages/woocommerce-analytics/src/class-woo-analytics-trait.php index 648c1ee2fce2..254eff911364 100644 --- a/projects/packages/woocommerce-analytics/src/class-woo-analytics-trait.php +++ b/projects/packages/woocommerce-analytics/src/class-woo-analytics-trait.php @@ -90,7 +90,7 @@ protected function format_items_to_json( $items ) { $products[] = $data; } - return wp_json_encode( $products, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); + return wp_json_encode( $products, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG ); } /** diff --git a/tools/cli/helpers/doc-parser/src/class-doc-parser.php b/tools/cli/helpers/doc-parser/src/class-doc-parser.php index 83d7002d6b79..961b9bed5e00 100644 --- a/tools/cli/helpers/doc-parser/src/class-doc-parser.php +++ b/tools/cli/helpers/doc-parser/src/class-doc-parser.php @@ -102,7 +102,7 @@ public function generate( $path, $dest, $output_file = 'phpdoc.json' ) { // Get data from the PHPDoc. $json = $this->get_phpdoc_data( $directory ); - $output = json_encode( $json ); + $output = json_encode( $json, JSON_UNESCAPED_SLASHES ); // Write to $output_file. $error = ! file_put_contents( $destination_path, $output ); diff --git a/tools/docker/mu-plugins/debug.php b/tools/docker/mu-plugins/debug.php index e250c77e35fa..316434973226 100644 --- a/tools/docker/mu-plugins/debug.php +++ b/tools/docker/mu-plugins/debug.php @@ -151,7 +151,7 @@ function lo( $stuff ) { * @return false|string */ function l_json_encode_pretty( $data ) { - return wp_json_encode( $data, JSON_PRETTY_PRINT ); + return wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ); } /** diff --git a/tools/e2e-commons/plugins/e2e-plan-helper.php b/tools/e2e-commons/plugins/e2e-plan-helper.php index e6291d421a64..bdd030e7c5fc 100644 --- a/tools/e2e-commons/plugins/e2e-plan-helper.php +++ b/tools/e2e-commons/plugins/e2e-plan-helper.php @@ -87,7 +87,7 @@ function e2e_helper_set_plan_data( $request ) { delete_option( 'e2e_jetpack_plan_data' ); - $success = update_option( 'e2e_jetpack_plan_data', wp_json_encode( $plan_data ) ); + $success = update_option( 'e2e_jetpack_plan_data', wp_json_encode( $plan_data, JSON_UNESCAPED_SLASHES ) ); if ( $success ) { return new WP_REST_Response( diff --git a/tools/e2e-commons/plugins/e2e-waf-data-interceptor.php b/tools/e2e-commons/plugins/e2e-waf-data-interceptor.php index 46ae71be327b..4c1868cca917 100644 --- a/tools/e2e-commons/plugins/e2e-waf-data-interceptor.php +++ b/tools/e2e-commons/plugins/e2e-waf-data-interceptor.php @@ -90,7 +90,8 @@ function e2e_intercept_waf_data_request( $return, $_parsed_args, $url ) { 'body' => wp_json_encode( array( 'data' => $rules, - ) + ), + JSON_UNESCAPED_SLASHES ), ); } From 33f89960a6e9a9834fe4fcb39a4882b8823348c4 Mon Sep 17 00:00:00 2001 From: Automattic Bot Date: Wed, 3 Dec 2025 20:05:53 +0100 Subject: [PATCH 20/49] Update actions/checkout action to v6 (#46184) Co-authored-by: Renovate Bot --- .../gh-autorelease/workflows/autorelease.yml | 2 +- .../gh-autotagger/workflows/autotagger.yml | 2 +- .../workflows/npmjs-autopublisher.yml | 2 +- .../workflows/wp-svn-autopublish.yml | 2 +- .github/workflows/autotagger.yml | 2 +- .github/workflows/build-docker-monorepo.yml | 4 +- .github/workflows/build-docker.yml | 4 +- .github/workflows/build.yml | 6 +-- .github/workflows/coverage-check.yml | 2 +- .github/workflows/delete-mirror-branches.yml | 2 +- .github/workflows/e2e-tests.yml | 12 +++--- .github/workflows/gardening.yml | 4 +- .github/workflows/linting.yml | 38 +++++++++---------- .github/workflows/phpcompatibility-dev.yml | 2 +- .github/workflows/post-build.yml | 20 +++++----- .github/workflows/pr-is-up-to-date.yml | 4 +- .github/workflows/renovate.yml | 2 +- .../slack-branch-existence-notification.yml | 2 +- .github/workflows/slack-workflow-failed.yml | 2 +- .github/workflows/tests.yml | 10 ++--- .../update-jetpack-staging-sites.yml | 6 +-- .github/workflows/update-phan-stubs.yml | 2 +- .github/workflows/wpcloud.yml | 4 +- 23 files changed, 68 insertions(+), 68 deletions(-) diff --git a/.github/files/gh-autorelease/workflows/autorelease.yml b/.github/files/gh-autorelease/workflows/autorelease.yml index 0682a03f1e8a..865d57e5d604 100644 --- a/.github/files/gh-autorelease/workflows/autorelease.yml +++ b/.github/files/gh-autorelease/workflows/autorelease.yml @@ -18,7 +18,7 @@ jobs: name: Release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Create release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/files/gh-autotagger/workflows/autotagger.yml b/.github/files/gh-autotagger/workflows/autotagger.yml index 526bfb3932cf..7ea514ccd6f1 100644 --- a/.github/files/gh-autotagger/workflows/autotagger.yml +++ b/.github/files/gh-autotagger/workflows/autotagger.yml @@ -22,7 +22,7 @@ jobs: exit 1 fi - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: # We want to potentially trigger "tag" events, but the default GITHUB_TOKEN # explicitly does not trigger events. diff --git a/.github/files/gh-npmjs-autopublisher/workflows/npmjs-autopublisher.yml b/.github/files/gh-npmjs-autopublisher/workflows/npmjs-autopublisher.yml index b098b8608c85..6dfee80c7b48 100644 --- a/.github/files/gh-npmjs-autopublisher/workflows/npmjs-autopublisher.yml +++ b/.github/files/gh-npmjs-autopublisher/workflows/npmjs-autopublisher.yml @@ -15,7 +15,7 @@ jobs: name: Publish runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions/setup-node@v4 with: diff --git a/.github/files/gh-wp-svn-autopublish/workflows/wp-svn-autopublish.yml b/.github/files/gh-wp-svn-autopublish/workflows/wp-svn-autopublish.yml index 2e343874b9ed..5a373c64b978 100644 --- a/.github/files/gh-wp-svn-autopublish/workflows/wp-svn-autopublish.yml +++ b/.github/files/gh-wp-svn-autopublish/workflows/wp-svn-autopublish.yml @@ -34,7 +34,7 @@ jobs: - name: Install svn run: command -v svn || sudo apt-get install -y subversion - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: path: src diff --git a/.github/workflows/autotagger.yml b/.github/workflows/autotagger.yml index d1ed78638d52..2a27aea9ea91 100644 --- a/.github/workflows/autotagger.yml +++ b/.github/workflows/autotagger.yml @@ -19,7 +19,7 @@ jobs: name: Tag runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Fetch tags, shallowly and blobless run: | diff --git a/.github/workflows/build-docker-monorepo.yml b/.github/workflows/build-docker-monorepo.yml index 9a92f618df7d..6169e772d0ae 100644 --- a/.github/workflows/build-docker-monorepo.yml +++ b/.github/workflows/build-docker-monorepo.yml @@ -34,7 +34,7 @@ jobs: images: ${{ steps.buildargs.outputs.images }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Fetch build args id: buildargs @@ -82,7 +82,7 @@ jobs: platform: arm64 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 0c37420abd0e..3f8f5676a58d 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -36,7 +36,7 @@ jobs: images: ${{ steps.buildargs.outputs.images }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Fetch build args id: buildargs @@ -84,7 +84,7 @@ jobs: platform: arm64 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07b5bfa5f5de..0fe51ee7325f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: changed_projects: ${{ steps.changed.outputs.projects }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 # For pull requests, list-changed-projects.sh needs the merge base. # But it doesn't have to be checked out. @@ -186,7 +186,7 @@ jobs: if: needs.build.outputs.any_plugins == 'true' timeout-minutes: 10 # 2025-11-06: Successful runs should take about 30 seconds. But sometimes the upload is slow. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: path: monorepo @@ -282,7 +282,7 @@ jobs: # Not setting a job-level timeout because it would be kind of pointless with the blocking step. Set a step timeout for all other steps instead. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: path: monorepo timeout-minutes: 1 # 2025-11-06: Successful runs seem to take a few seconds diff --git a/.github/workflows/coverage-check.yml b/.github/workflows/coverage-check.yml index af3322370edc..627f80a0ddc5 100644 --- a/.github/workflows/coverage-check.yml +++ b/.github/workflows/coverage-check.yml @@ -28,7 +28,7 @@ jobs: timeout-minutes: 5 # 2025-11-20: Less than 30 seconds. steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Get token id: get_token diff --git a/.github/workflows/delete-mirror-branches.yml b/.github/workflows/delete-mirror-branches.yml index 85c4b0b9c568..83bdfcc1cb15 100644 --- a/.github/workflows/delete-mirror-branches.yml +++ b/.github/workflows/delete-mirror-branches.yml @@ -14,7 +14,7 @@ jobs: timeout-minutes: 5 # 2025-11-20: Less than a minute. if: github.event_name == 'delete' && github.repository == 'Automattic/jetpack' && github.event.ref == 'prerelease' steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: trunk - name: Delete branches diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 92ad5a148c34..7179f70eda78 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -31,7 +31,7 @@ jobs: matrix: ${{ steps.evaluate.outputs.matrix }} build-matrix: ${{ steps.evaluate.outputs.build-matrix }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 # For pull requests, list-changed-projects.sh needs the merge base. - name: Deepen to merge base @@ -93,7 +93,7 @@ jobs: - name: Checkout code if: steps.jetpack-build-cache.outputs.cache-hit != 'true' - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup tools if: steps.jetpack-build-cache.outputs.cache-hit != 'true' @@ -158,7 +158,7 @@ jobs: matrix: include: ${{ fromJson( needs.create-test-matrix.outputs.matrix ) }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Restore ${{ matrix.buildGroup }} build cache id: jetpack-build-cache @@ -187,14 +187,14 @@ jobs: - name: Checkout jetpack-production if: github.event_name == 'repository_dispatch' && github.event.client_payload.repository != 'Automattic/jetpack-production' - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: repository: Automattic/jetpack-production path: build-output/build/Automattic/jetpack-production - name: Checkout mirror repo if: github.event_name == 'repository_dispatch' - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: repository: ${{ github.event.client_payload.repository }} ref: ${{ github.event.client_payload.ref_name }} @@ -383,7 +383,7 @@ jobs: needs: [e2e-tests] steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set up tools uses: ./.github/actions/tool-setup diff --git a/.github/workflows/gardening.yml b/.github/workflows/gardening.yml index cc6fdab583ca..fce75ba4e4df 100644 --- a/.github/workflows/gardening.yml +++ b/.github/workflows/gardening.yml @@ -37,7 +37,7 @@ jobs: timeout-minutes: 10 # 2025-11-06: Successful runs seem to take a minute or two, primarily since we wait for previous runs to complete. steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -53,7 +53,7 @@ jobs: - name: Check out the PR if: github.event_name == 'pull_request_target' && github.event.pull_request.state != 'closed' - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index a2ecdf7e56e8..2519505f019c 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -77,7 +77,7 @@ jobs: steps: - if: github.event_name == 'pull_request' - uses: actions/checkout@v5 + uses: actions/checkout@v6 - if: github.event_name == 'pull_request' uses: dorny/paths-filter@v3 @@ -222,7 +222,7 @@ jobs: experimental: [ false ] steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -256,7 +256,7 @@ jobs: timeout-minutes: 5 # 2025-11-06: Successful runs seem to take ~2 minutes. Leaving some extra for future expansion. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -284,7 +284,7 @@ jobs: timeout-minutes: 5 # 2025-11-06: Successful runs seem to take ~1 minute. Leaving some extra for future expansion. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -315,7 +315,7 @@ jobs: steps: # We don't need full git history, but phpcs-changed does need everything up to the merge-base. - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 10 @@ -352,7 +352,7 @@ jobs: timeout-minutes: 10 # 2025-11-06: Runs now take ~5 minutes due to now installing all php/js deps to ensure valid linting. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -376,7 +376,7 @@ jobs: steps: # We don't need full git history, but eslint-changed does need everything up to the merge-base. - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 10 @@ -405,7 +405,7 @@ jobs: timeout-minutes: 5 # 2025-11-06: Takes a bit more than a minute, so give a little wiggle room. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -426,7 +426,7 @@ jobs: if: github.event_name == 'push' || needs.changed_files.outputs.ghactionsfiles == 'true' || needs.changed_files.outputs.misc == 'true' timeout-minutes: 5 # 2025-11-06: Takes less than a minute. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -445,7 +445,7 @@ jobs: timeout-minutes: 1 # 2025-11-06: Successful runs seem to take a few seconds. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - run: ./tools/check-copied-files.sh ### Runs tools/cleanup-excludelists.sh and checks for any changes @@ -459,7 +459,7 @@ jobs: if: github.event_name == 'push' || needs.changed_files.outputs.excludelist == 'true' timeout-minutes: 10 # 2025-11-06: The check itself takes 2 minutes. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -482,7 +482,7 @@ jobs: timeout-minutes: 5 # 2025-11-06: Takes a few seconds. steps: # We don't need full git history, but tools/check-changelogger-use.php does need everything up to the merge-base. - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 10 @@ -506,7 +506,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 # 2025-11-06: Takes less than a minute. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -528,7 +528,7 @@ jobs: if: github.event_name == 'push' || needs.changed_files.outputs.lockfiles == 'true' || needs.changed_files.outputs.misc == 'true' timeout-minutes: 7 # 2025-11-06: Successful runs seem to take about 2 minutes. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -546,7 +546,7 @@ jobs: if: github.event_name == 'push' || needs.changed_files.outputs.lockfiles == 'true' || needs.changed_files.outputs.misc == 'true' timeout-minutes: 7 # 2025-11-06: Takes a minute or two. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup - run: pnpm install @@ -560,7 +560,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 # 2025-11-06: Takes a minute or two. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup @@ -581,7 +581,7 @@ jobs: # step "Warn about stubs" pull-requests: write steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: ./.github/actions/deepen-to-merge-base id: deepen - name: Warn about stubs @@ -609,7 +609,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 # 2025-11-20: Takes around 3 minutes. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup - name: Pnpm install @@ -632,7 +632,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 25 # 2025-11-20: Up to about 10 minutes now that we're running against the old WP and Woo stubs too. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup - name: Pnpm install diff --git a/.github/workflows/phpcompatibility-dev.yml b/.github/workflows/phpcompatibility-dev.yml index 3a3f323c4807..3d21da1709da 100644 --- a/.github/workflows/phpcompatibility-dev.yml +++ b/.github/workflows/phpcompatibility-dev.yml @@ -61,7 +61,7 @@ jobs: timeout-minutes: 7 # 2025-11-06: Successful runs seem to take ~2 minutes. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup diff --git a/.github/workflows/post-build.yml b/.github/workflows/post-build.yml index e1e8ee75142b..52714a937ae8 100644 --- a/.github/workflows/post-build.yml +++ b/.github/workflows/post-build.yml @@ -45,7 +45,7 @@ jobs: run: | echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Get token id: get_token @@ -85,7 +85,7 @@ jobs: if: github.event.workflow_run.conclusion != 'success' timeout-minutes: 2 # 2025-11-20: Seems like it should be fast. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Get token id: get_token @@ -128,7 +128,7 @@ jobs: zip_url: ${{ steps.run.outputs.zip_url }} any_plugins: ${{ steps.run.outputs.any_plugins }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Find artifact id: run @@ -201,7 +201,7 @@ jobs: if: needs.find_artifact.outputs.any_plugins == 'false' timeout-minutes: 2 # 2025-11-20: Takes a few seconds. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Get token id: get_token @@ -244,7 +244,7 @@ jobs: timeout-minutes: 5 # 2025-11-20: Takes a few seconds. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Get token id: get_token @@ -336,10 +336,10 @@ jobs: - 80:80 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: path: trunk - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: ${{ github.event.workflow_run.head_commit.id }} path: commit @@ -383,7 +383,7 @@ jobs: timeout-minutes: 5 # 2025-11-20: Takes a few seconds. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Get token id: get_token @@ -414,10 +414,10 @@ jobs: if: needs.find_artifact.outputs.any_plugins == 'true' timeout-minutes: 15 # 2025-11-20: Less than a minute, but leave time for the downloads. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: path: trunk - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: ${{ github.event.workflow_run.head_commit.id }} path: commit diff --git a/.github/workflows/pr-is-up-to-date.yml b/.github/workflows/pr-is-up-to-date.yml index 7acc9513bab6..45311f4378f6 100644 --- a/.github/workflows/pr-is-up-to-date.yml +++ b/.github/workflows/pr-is-up-to-date.yml @@ -27,7 +27,7 @@ jobs: # First, the "PR or tag" job. - name: Checkout trunk for tag push or PR - uses: actions/checkout@v5 + uses: actions/checkout@v6 if: github.event_name != 'push' || github.ref != 'refs/heads/trunk' with: ref: trunk @@ -76,7 +76,7 @@ jobs: # Second, the "push to trunk" job. - name: Checkout push to trunk - uses: actions/checkout@v5 + uses: actions/checkout@v6 if: github.event_name == 'push' && github.ref == 'refs/heads/trunk' with: # The "Check whether the tag needs updating for trunk commit" needs the previous commit for diffing. diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index df7209073ce5..7d9a8e27f94a 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -36,7 +36,7 @@ jobs: name: Renovate runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: path: monorepo - env: diff --git a/.github/workflows/slack-branch-existence-notification.yml b/.github/workflows/slack-branch-existence-notification.yml index 732b65980ff3..cd26e4cc45e8 100644 --- a/.github/workflows/slack-branch-existence-notification.yml +++ b/.github/workflows/slack-branch-existence-notification.yml @@ -15,7 +15,7 @@ jobs: if: github.event.ref == 'prerelease' steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: trunk - name: Generate message diff --git a/.github/workflows/slack-workflow-failed.yml b/.github/workflows/slack-workflow-failed.yml index 5807d7e4984e..2daaf3b103d3 100644 --- a/.github/workflows/slack-workflow-failed.yml +++ b/.github/workflows/slack-workflow-failed.yml @@ -28,7 +28,7 @@ jobs: if: ${{ github.repository == 'Automattic/jetpack' && github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event != 'issues' && github.event.workflow_run.event != 'issue_comment' }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Generate message id: message env: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bbfca7995d4f..ea9bb8bcabd4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,7 +26,7 @@ jobs: outputs: matrix: ${{ steps.create-matrix.outputs.matrix }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - id: create-matrix run: | MATRIX="$(.github/files/generate-ci-matrix.php)" @@ -65,7 +65,7 @@ jobs: coverage-status: ${{ matrix.script == 'test-coverage' && steps.run-tests.conclusion || '' }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: # Test coverage checks require a fetch depth > 1. fetch-depth: 2 @@ -323,7 +323,7 @@ jobs: needs: run-tests if: always() && needs.run-tests.outputs.did-coverage == 'true' && github.repository == 'Automattic/jetpack' && ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name || github.event_name == 'push' && github.ref == 'refs/heads/trunk' ) steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Get token id: get_token @@ -356,7 +356,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 # 2025-11-20: Takes about 4 minutes steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 # For pull requests, list-changed-projects.sh needs the merge base. # But it doesn't have to be checked out. @@ -412,7 +412,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 # 2025-11-20: Takes less than a minute. steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup tools uses: ./.github/actions/tool-setup with: diff --git a/.github/workflows/update-jetpack-staging-sites.yml b/.github/workflows/update-jetpack-staging-sites.yml index 6d0d959a40a9..ff473ed344d8 100644 --- a/.github/workflows/update-jetpack-staging-sites.yml +++ b/.github/workflows/update-jetpack-staging-sites.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Env config env: @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Run k6 frontend tests uses: grafana/k6-action@v0.3.0 @@ -58,7 +58,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Execute shell script shell: bash diff --git a/.github/workflows/update-phan-stubs.yml b/.github/workflows/update-phan-stubs.yml index 9a16c158d526..05f7ac67d53c 100644 --- a/.github/workflows/update-phan-stubs.yml +++ b/.github/workflows/update-phan-stubs.yml @@ -20,7 +20,7 @@ jobs: name: Update stubs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: # Use the matticbot token so CI runs on the created PR. token: ${{ secrets.STUB_UPDATE_TOKEN_GITHUB }} diff --git a/.github/workflows/wpcloud.yml b/.github/workflows/wpcloud.yml index ec36f8f0e248..6266755ebeaf 100644 --- a/.github/workflows/wpcloud.yml +++ b/.github/workflows/wpcloud.yml @@ -21,7 +21,7 @@ jobs: outputs: wpcomsh: ${{ steps.changed.outputs.wpcomsh }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 # For pull requests, list-changed-projects.sh needs the merge base. # But it doesn't have to be checked out. @@ -85,7 +85,7 @@ jobs: needs: build if: needs.build.outputs.wpcomsh == 'true' steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Restore wpcomsh build cache id: wpcomsh-build-cache From f05e9afa3b4c3e930349560d6d41f459ba03130a Mon Sep 17 00:00:00 2001 From: Robert Sreberski Date: Wed, 3 Dec 2025 21:31:34 +0100 Subject: [PATCH 21/49] Backporting stable 15.3 (#46183) * Bump version to stable * Bump version in changelog * Squash changelog * Update readme * Update stable release --- projects/plugins/jetpack/CHANGELOG.md | 102 ++++++++++--------------- projects/plugins/jetpack/composer.json | 2 +- projects/plugins/jetpack/jetpack.php | 4 +- projects/plugins/jetpack/readme.txt | 9 ++- 4 files changed, 49 insertions(+), 68 deletions(-) diff --git a/projects/plugins/jetpack/CHANGELOG.md b/projects/plugins/jetpack/CHANGELOG.md index 0231885905fa..1c693c7a1d33 100644 --- a/projects/plugins/jetpack/CHANGELOG.md +++ b/projects/plugins/jetpack/CHANGELOG.md @@ -2,96 +2,72 @@ ### This is a list detailing changes for all Jetpack releases. -## 15.3-beta - 2025-12-01 +## 15.3 - 2025-12-03 + +Incorrectly tagged without releasing new versions of Jetpack Forms. 15.3-beta.3 was created immediately to fix the issue. + ### Enhancements +- Forms: Add browser info to the form response email notification. [#45710] - Forms: Add form response webhook support. [#46059] +- Forms: Add integrations to dashboard mobile menu. [#45744] +- Forms: Add keyboard navigation to go through reponses quickly. [#45811] - Forms: Add WordPress Abilities API integration for form submissions management and integrations access. [#45998] +- Forms: Change integrations modal width. [#45855] +- Forms: Improve MailPoet subscriber handling. [#45905] - Forms: Improve name variation handling. [#46054] - Forms: Remove related-posts from API calls. [#45928] -- Premium Content Block: Added email rendering callback. [#46006] - -### Bug fixes -- Cookies & Consents Banner Widget: ensure form headings are properly displayed. [#46144] -- Forms: Do not link to empty source link. [#46133] -- Forms: Reject form submissions when the parent post/page with the form has been deleted or is no longer published. [#46103] -- Forms: Remove clashing between meta dn field names on export. [#46130] -- GSheets embed: Give time for the iframe to finish before showing an error. [#46109] - -### Other changes -- Blocks: Add filter to disable Jetpack block collection in editor. [#46077] -- Media Summary: Allow skipping excerpt and text counts. [#46091] -- Newsletters: Add skeleton for new settings screen. [#46049] -- Podcasts block: Prevent warnings when podcast content is malformed. [#46083] -- Updated Jetpack sidebar labels for post editor sidebar. [#46098] -- Update package dependencies. [#46072] [#46079] [#46143] - -## 15.3-a.9 - 2025-11-24 -### Enhancements - Forms: Update dashboard header buttons. [#45983] +- Forms: Use core WP colors for basic primitive components such as buttons at Forms dashboard. [#45845] - Forms: Use first/last name for author. [#45944] -- Social: Improve the sidebar by making titles more descriptive and combining sections. [#46007] - -### Bug fixes -- Forms: Fix name variation isActive setting. [#46028] -- Remove `getIconColor` functions for block icons. [#45992] -- My Jetpack: Fix expiring renewal prompt to show all products. [#45995] - -### Other changes -- Likes: Update filter docblock formatting. [#46009] -- Phan: Address PhanPossiblyUndeclaredVariable violations. [#45911] -- Update Social preview to show title as well with the preview. [#45938] -- Update to-test.md file. [#46042] - -## 15.3-a.7 - 2025-11-19 -### Enhancements +- Premium Content Block: Added email rendering callback. [#46006] - Social: Improve auto-share UI in the editor by streamlining the notices and descriptions. [#45970] +- Social: Improve the sidebar by making titles more descriptive and combining sections. [#46007] - Social: Update the connections list in the editor to a vertical toggle list with labels and icons. [#45939] -## 15.3-a.5 - 2025-11-18 -### Bug fixes -- Fix a compatibility bug with the Gutenberg plugin. [#45967] - -### Other changes -- Update package dependencies. [#45961] - -## 15.3-a.3 - 2025-11-17 -### Enhancements -- Forms: Improve MailPoet subscriber handling. [#45905] -- Forms: Use core WP colors for basic primitive components such as buttons at Forms dashboard. [#45845] - -### Bug fixes -- GifBlock: Ensure url is not reset when publishing post. [#45900] -- Social: Fix connection icon not reflecting the change when profile picture is updated. [#45937] - -### Other changes -- Editor assets endpoint: Mitigate hook errors originating from plugins referencing conditionally defined functions via `is_admin()`, which is false for the REST API. [#45924] -- Update Jetpack notifications script tag to use wp_print_inline_script_tag. This allows for injection of a nonce attribute and CSP compatibility. [#45878] -- Update package dependencies. [#45915] [#45958] - -## 15.3-a.1 - 2025-11-10 -### Enhancements -- Forms: Add browser info to the form response email notification. [#45710] -- Forms: Add integrations to dashboard mobile menu. [#45744] -- Forms: Add keyboard navigation to go through reponses quickly. [#45811] -- Forms: Change integrations modal width. [#45855] - ### Improved compatibility - Replace icons removed from @wordpress/icons with alternatives. [#45760] ### Bug fixes +- Cookies & Consents Banner Widget: ensure form headings are properly displayed. [#46144] +- Fix a compatibility bug with the Gutenberg plugin. [#45967] +- Forms: Do not link to empty source link. [#46133] - Forms: Ensure we show duplicate form field values on export. [#45809] - Forms: Fix integrations modal flash. [#45775] +- Forms: Fix name variation isActive setting. [#46028] +- Forms: Fix the flickering between the sidebar loading on different browser widths. +- Forms: Reject form submissions when the parent post/page with the form has been deleted or is no longer published. [#46103] +- Forms: Remove clashing between meta dn field names on export. [#46130] +- GifBlock: Ensure url is not reset when publishing post. [#45900] - Google Docs: Ensure that slides/sheets embeds render on the front-end. [#45776] +- GSheets embed: Give time for the iframe to finish before showing an error. [#46109] +- My Jetpack: Fix expiring renewal prompt to show all products. [#45995] +- Remove `getIconColor` functions for block icons. [#45992] +- Restrict inline file preview to only image formats and PDFs, force download for other file types for security. +- Social: Fix connection icon not reflecting the change when profile picture is updated. [#45937] ### Other changes - About page: Remove Co-Authors Plus from and add ActivityPub to list of featured plugins. [#45792] +- Blocks: Add filter to disable Jetpack block collection in editor. [#46077] - Editor assets endpoint: Filter returned assets with exclude query parameter. [#45715] +- Editor assets endpoint: Mitigate hook errors originating from plugins referencing conditionally defined functions via `is_admin()`, which is false for the REST API. [#45924] - Editor assets endpoint: Refactor to reduce complexity. [#45714] - Improve PHP 8.5 compatibility. [#45771] - Jetpack AI: Remove tooltip for reading grade score. [#45847] +- Likes: Update filter docblock formatting. [#46009] +- Media Summary: Allow skipping excerpt and text counts. [#46091] +- Newsletters: Add skeleton for new settings screen. [#46049] +- Phan: Address PhanPossiblyUndeclaredVariable violations. [#45911] +- Podcasts block: Prevent warnings when podcast content is malformed. [#46083] - Shortcodes: Extract the jmpress.js dependency into pnpm. [#45707] - Tests: Ensure PHP 8.5 compatibility. [#45769] +- Updated Jetpack sidebar labels for post editor sidebar. [#46098] +- Update Jetpack notifications script tag to use wp_print_inline_script_tag. This allows for injection of a nonce attribute and CSP compatibility. [#45878] - Update package dependencies. [#45737] [#45756] [#45758] +- Update package dependencies. [#45915] [#45958] +- Update package dependencies. [#45961] +- Update package dependencies. [#46072] [#46079] [#46143] +- Update Social preview to show title as well with the preview. [#45938] +- Update to-test.md file. [#46042] ## 15.2 - 2025-11-04 ### Enhancements diff --git a/projects/plugins/jetpack/composer.json b/projects/plugins/jetpack/composer.json index 14be73236507..97871be8879a 100644 --- a/projects/plugins/jetpack/composer.json +++ b/projects/plugins/jetpack/composer.json @@ -111,7 +111,7 @@ "platform": { "ext-intl": "0.0.0" }, - "autoloader-suffix": "f11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ15_3_beta", + "autoloader-suffix": "f11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ15_3", "allow-plugins": { "automattic/jetpack-autoloader": true, "automattic/jetpack-composer-plugin": true diff --git a/projects/plugins/jetpack/jetpack.php b/projects/plugins/jetpack/jetpack.php index b7f2ca5647e7..54badafadfb5 100644 --- a/projects/plugins/jetpack/jetpack.php +++ b/projects/plugins/jetpack/jetpack.php @@ -4,7 +4,7 @@ * Plugin URI: https://jetpack.com * Description: Security, performance, and marketing tools made by WordPress experts. Jetpack keeps your site protected so you can focus on more important things. * Author: Automattic - * Version: 15.3-beta + * Version: 15.3 * Author URI: https://jetpack.com * License: GPL2+ * Text Domain: jetpack @@ -38,7 +38,7 @@ if ( ! defined( 'JETPACK__VERSION' ) ) { // This breaks the project version checks when a one-liner. - define( 'JETPACK__VERSION', '15.3-beta' ); + define( 'JETPACK__VERSION', '15.3' ); } defined( 'JETPACK__MINIMUM_WP_VERSION' ) || define( 'JETPACK__MINIMUM_WP_VERSION', '6.7' ); defined( 'JETPACK__MINIMUM_PHP_VERSION' ) || define( 'JETPACK__MINIMUM_PHP_VERSION', '7.2' ); diff --git a/projects/plugins/jetpack/readme.txt b/projects/plugins/jetpack/readme.txt index 86d2acf7fb8e..6f548e92374a 100644 --- a/projects/plugins/jetpack/readme.txt +++ b/projects/plugins/jetpack/readme.txt @@ -1,7 +1,7 @@ === Jetpack - WP Security, Backup, Speed, & Growth === Contributors: automattic, adamkheckler, adrianmoldovanwp, aduth, akirk, allendav, alternatekev, andy, annamcphee, annezazu, apeatling, arcangelini, arsihasi, azaozz, barry, batmoo, beaulebens, bindlegirl, biskobe, bjorsch, blobaugh, brbrr, brileyhooper, cainm, cena, cfinke, cgastrell, chaselivingston, chellycat, clickysteve, csonnek, danielbachhuber, daniloercoli, davoraltman, delawski, designsimply, dkmyta, dllh, drawmyface, dsmart, dun2mis, dzver, ebinnion, egregor, eliorivero, enej, eoigal, erania-pinnera, ethitter, fgiannar, gcorne, georgestephanis, gibrown, goldsounds, hew, hugobaeta, hypertextranch, iammattthomas, iandunn, joen, jblz, jeffgolenski, jeherve, jenhooks, jenia, jessefriedman, jgs, jkudish, jmdodd, joanrho, johnjamesjacoby, jshreve, kbrownkd, keoshi, koke, kraftbj, lancewillett, leogermani, lhkowalski, lschuyler, macmanx, martinremy, matt, mattwiebe, matveb, maverick3x6, mcsf, mdawaffe, mdbitz, MichaelArestad, migueluy, miguelxavierpenha, mikeyarce, mkaz, nancythanki, nickmomrik, njweller, nunyvega, obenland, oskosk, pento, professor44, rachelsquirrel, rdcoll, renatoagds, retrofox, richardmtl, richardmuscat, robertbpugh, roccotripaldi, ryancowles, samhotchkiss, samiff, scarstocea, scottsweb, sdixon194, sdquirk, sermitr, simison, stephdau, thehenridev, tmoorewp, tyxla, Viper007Bond, westi, williamvianas, wpkaren, yoavf, zinigor Tags: Security, backup, malware, scan, performance -Stable tag: 15.3-beta +Stable tag: 15.3 Requires at least: 6.7 Requires PHP: 7.2 Tested up to: 6.9 @@ -326,7 +326,10 @@ Jetpack Backup can do a full website migration to a new host, migrate theme file == Changelog == -### 15.3-beta - 2025-12-01 +### 15.3 - 2025-12-03 + +Incorrectly tagged without releasing new versions of Jetpack Forms. 15.3-beta.3 was created immediately to fix the issue. + #### Enhancements - Forms: Add browser info to the form response email notification. - Forms: Add form response webhook support. @@ -355,6 +358,7 @@ Jetpack Backup can do a full website migration to a new host, migrate theme file - Forms: Ensure we show duplicate form field values on export. - Forms: Fix integrations modal flash. - Forms: Fix name variation isActive setting. +- Forms: Fix the flickering between the sidebar loading on different browser widths. - Forms: Reject form submissions when the parent post/page with the form has been deleted or is no longer published. - Forms: Remove clashing between meta dn field names on export. - GifBlock: Ensure url is not reset when publishing post. @@ -362,6 +366,7 @@ Jetpack Backup can do a full website migration to a new host, migrate theme file - GSheets embed: Give time for the iframe to finish before showing an error. - My Jetpack: Fix expiring renewal prompt to show all products. - Remove `getIconColor` functions for block icons. +- Restrict inline file preview to only image formats and PDFs, force download for other file types for security. - Social: Fix connection icon not reflecting the change when profile picture is updated. -------- From aa0acf470439ec016f4e0154fb539a14a1c4b80a Mon Sep 17 00:00:00 2001 From: Automattic Bot Date: Wed, 3 Dec 2025 21:32:20 +0100 Subject: [PATCH 22/49] Update Eslint packages (major) (#46185) * Update Eslint packages * Disable jsdoc/reject-any-type and jsdoc/reject-function-type Too many of these to clean up now. Unclear if we even want to. * Fix new lints --------- Co-authored-by: Renovate Bot Co-authored-by: Brad Jorsch --- .../check-test-reminder-comment.js | 6 +- .../get-check-comments.js | 2 +- pnpm-lock.yaml | 135 ++++++++++++++---- .../changelog/renovate-major-eslint-packages | 5 + .../with-responsive/with-responsive.tsx | 2 +- .../charts/src/utils/color-utils.ts | 14 +- .../charts/src/utils/format-metric-value.ts | 2 +- .../charts/src/utils/format-percentage.ts | 2 +- .../changelog/renovate-major-eslint-packages | 5 + .../js-packages/connection/declarations.d.ts | 2 +- .../changelog/renovate-major-eslint-packages | 5 + .../src/GettextExtractor.js | 12 +- .../changelog/renovate-major-eslint-packages | 5 + .../components/activation-screen/index.jsx | 2 +- .../changelog/renovate-major-eslint-packages | 5 + .../confirmation-form/index.tsx | 2 +- .../changelog/renovate-major-eslint-packages | 5 + .../react-data-sync-client/src/DataSync.ts | 14 +- .../changelog/renovate-major-eslint-packages | 5 + .../src/webpack/mini-css-with-rtl.js | 2 +- .../changelog/renovate-major-eslint-packages | 5 + .../contact-form/libs/date-picker/lib/date.ts | 4 +- .../contact-form/libs/date-picker/lib/dom.ts | 4 +- .../contact-form/libs/date-picker/lib/fns.ts | 4 +- .../forms/tools/webpack.config.dashboard.js | 6 +- .../changelog/renovate-major-eslint-packages | 5 + .../celebrate-launch/confetti-animation.ts | 2 +- .../codemirror-language-data-plugin.js | 3 +- .../jetpack-mu-wpcom/webpack.config.js | 2 +- .../changelog/renovate-major-eslint-packages | 5 + .../packages/newsletter/webpack.config.js | 6 +- .../changelog/renovate-major-eslint-packages | 5 + .../src/block/register-jetpack-block.js | 2 +- .../critical-css/lib/generate-critical-css.ts | 4 +- .../changelog/renovate-major-eslint-packages | 5 + .../_inc/client/lib/analytics/index.js | 2 +- .../prompts/resource-prompt/index.jsx | 1 - .../state/recommendations/onboarding-utils.ts | 2 +- .../changelog/renovate-major-eslint-packages | 5 + .../blocks/eventbrite/deprecated/v1/index.js | 2 +- .../extensions/blocks/podcast-player/utils.js | 2 +- .../extensions/blocks/videopress/editor.js | 3 +- .../jetpack/extensions/shared/block-styles.js | 2 +- .../videopress/js/videopress-plupload.js | 2 +- tools/cli/commands/changelog.js | 2 +- tools/js-tools/eslintrc/base.mjs | 4 + tools/js-tools/package.json | 6 +- 47 files changed, 235 insertions(+), 92 deletions(-) create mode 100644 projects/js-packages/charts/changelog/renovate-major-eslint-packages create mode 100644 projects/js-packages/connection/changelog/renovate-major-eslint-packages create mode 100644 projects/js-packages/i18n-check-webpack-plugin/changelog/renovate-major-eslint-packages create mode 100644 projects/js-packages/licensing/changelog/renovate-major-eslint-packages create mode 100644 projects/js-packages/publicize-components/changelog/renovate-major-eslint-packages create mode 100644 projects/js-packages/react-data-sync-client/changelog/renovate-major-eslint-packages create mode 100644 projects/js-packages/webpack-config/changelog/renovate-major-eslint-packages create mode 100644 projects/packages/forms/changelog/renovate-major-eslint-packages create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/renovate-major-eslint-packages create mode 100644 projects/packages/newsletter/changelog/renovate-major-eslint-packages create mode 100644 projects/packages/paypal-payments/changelog/renovate-major-eslint-packages create mode 100644 projects/plugins/boost/changelog/renovate-major-eslint-packages create mode 100644 projects/plugins/jetpack/changelog/renovate-major-eslint-packages diff --git a/.github/files/build-reminder-comment/check-test-reminder-comment.js b/.github/files/build-reminder-comment/check-test-reminder-comment.js index ddcc6a107dd2..6737b184684d 100644 --- a/.github/files/build-reminder-comment/check-test-reminder-comment.js +++ b/.github/files/build-reminder-comment/check-test-reminder-comment.js @@ -13,7 +13,7 @@ const getCheckComments = require( './get-check-comments.js' ); * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @param {Core} core - A reference to the @actions/core package + * @param {Core} core - A reference to the `@actions/core` package * @return {Promise} Promise resolving to an object with keys `simple` and `woa`, each being an array of strings identifying what needs testing. */ async function touchedProjectsNeedingTesting( github, owner, repo, number, core ) { @@ -51,7 +51,7 @@ async function touchedProjectsNeedingTesting( github, owner, repo, number, core * * @param {github} github - Pre-authenticated octokit/rest.js client with pagination plugins * @param {object} context - Context of the workflow run - * @param {core} core - A reference to the @actions/core package + * @param {core} core - A reference to the `@actions/core` package * @return {Promise} Promise resolving to an object with the following properties: * - {commentId} - a comment ID, or 0 if no comment is found. * - {simple} - an array of strings identifying what needs testing on Simple. @@ -146,7 +146,7 @@ async function checkTestPendingComment( github, context, core ) { * * @param {github} github - Pre-authenticated octokit/rest.js client with pagination plugins * @param {object} context - Context of the workflow run - * @param {core} core - A reference to the @actions/core package + * @param {core} core - A reference to the `@actions/core` package * @return {Promise} Promise resolving to an object with the following properties: * - {commentId} - a comment ID, or 0 if no comment is found. * - {simple} - an array of strings identifying what needs testing on Simple. diff --git a/.github/files/build-reminder-comment/get-check-comments.js b/.github/files/build-reminder-comment/get-check-comments.js index 6d040422ac6e..6f6c1e72a8f6 100644 --- a/.github/files/build-reminder-comment/get-check-comments.js +++ b/.github/files/build-reminder-comment/get-check-comments.js @@ -9,7 +9,7 @@ const cache = {}; * @param {string} repo - Repository name. * @param {string} number - Issue number. * @param {string} testCommentIndicator - A piece of text unique to all test reminder comments. - * @param {core} core - A reference to the @actions/core package + * @param {core} core - A reference to the `@actions/core` package * @return {Promise} Promise resolving to an array of comment IDs. */ async function getCheckComments( github, owner, repo, number, testCommentIndicator, core ) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dc0511d90416..c05d176bea98 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5939,8 +5939,8 @@ importers: specifier: 7.27.1 version: 7.27.1(@babel/core@7.28.4) '@eslint/compat': - specifier: 1.4.1 - version: 1.4.1(eslint@9.39.1) + specifier: 2.0.0 + version: 2.0.0(eslint@9.39.1) '@eslint/eslintrc': specifier: 3.3.3 version: 3.3.3 @@ -5964,7 +5964,7 @@ importers: version: 6.9.1 '@wordpress/eslint-plugin': specifier: 22.22.0 - version: 22.22.0(@babel/core@7.28.4)(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint-plugin-import@2.32.0)(eslint-plugin-jest@29.2.1(eslint@9.39.1)(jest@30.2.0)(typescript@5.9.3))(eslint-plugin-jsdoc@51.4.1(eslint@9.39.1))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.39.1))(eslint-plugin-playwright@2.4.0(eslint@9.39.1))(eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint@9.39.1)(wp-prettier@3.0.3))(eslint-plugin-react-hooks@5.2.0(eslint@9.39.1))(eslint-plugin-react@7.37.5(eslint@9.39.1))(eslint@9.39.1)(typescript@5.9.3)(wp-prettier@3.0.3) + version: 22.22.0(@babel/core@7.28.4)(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint-plugin-import@2.32.0)(eslint-plugin-jest@29.2.1(eslint@9.39.1)(jest@30.2.0)(typescript@5.9.3))(eslint-plugin-jsdoc@61.4.1(eslint@9.39.1))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.39.1))(eslint-plugin-playwright@2.4.0(eslint@9.39.1))(eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint@9.39.1)(wp-prettier@3.0.3))(eslint-plugin-react-hooks@7.0.1(eslint@9.39.1))(eslint-plugin-react@7.37.5(eslint@9.39.1))(eslint@9.39.1)(typescript@5.9.3)(wp-prettier@3.0.3) '@wordpress/jest-console': specifier: 8.36.0 version: 8.36.0(patch_hash=0c63a888feb97f2f1d416ca013ad85c31b6360b41cc0b6e2b0ae28f778fbdc5b)(jest@30.2.0) @@ -6008,8 +6008,8 @@ importers: specifier: 5.5.0 version: 5.5.0(eslint@9.39.1) eslint-plugin-jsdoc: - specifier: 51.4.1 - version: 51.4.1(eslint@9.39.1) + specifier: 61.4.1 + version: 61.4.1(eslint@9.39.1) eslint-plugin-jsx-a11y: specifier: 6.10.2 version: 6.10.2(eslint@9.39.1) @@ -6032,8 +6032,8 @@ importers: specifier: 7.37.5 version: 7.37.5(eslint@9.39.1) eslint-plugin-react-hooks: - specifier: 5.2.0 - version: 5.2.0(eslint@9.39.1) + specifier: 7.0.1 + version: 7.0.1(eslint@9.39.1) eslint-plugin-svelte: specifier: 3.13.0 version: 3.13.0(eslint@9.39.1)(svelte@4.2.19) @@ -7208,10 +7208,14 @@ packages: '@emotion/weak-memoize@0.4.0': resolution: {integrity: sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==} - '@es-joy/jsdoccomment@0.52.0': - resolution: {integrity: sha512-BXuN7BII+8AyNtn57euU2Yxo9yA/KUDNzrpXyi3pfqKmBhhysR6ZWOebFh3vyPoqA3/j1SOvGgucElMGwlXing==} + '@es-joy/jsdoccomment@0.76.0': + resolution: {integrity: sha512-g+RihtzFgGTx2WYCuTHbdOXJeAlGnROws0TeALx9ow/ZmOROOZkVg5wp/B44n0WJgI4SQFP1eWM2iRPlU2Y14w==} engines: {node: '>=20.11.0'} + '@es-joy/resolve.exports@1.2.0': + resolution: {integrity: sha512-Q9hjxWI5xBM+qW2enxfe8wDKdFWMfd0Z29k5ZJnuBqD/CasY5Zryj09aCA6owbGATWz+39p5uIdaHXpopOcG8g==} + engines: {node: '>=10'} + '@esbuild/aix-ppc64@0.25.9': resolution: {integrity: sha512-OaGtL73Jck6pBKjNIe24BnFE6agGl+6KxDtTfHhy1HmhthfKouEcOhqpSL64K4/0WCtbKFLOdzD/44cJ4k9opA==} engines: {node: '>=18'} @@ -7378,9 +7382,9 @@ packages: resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - '@eslint/compat@1.4.1': - resolution: {integrity: sha512-cfO82V9zxxGBxcQDr1lfaYB7wykTa0b00mGa36FrJl7iTFd0Z2cHfEYuxcBRP/iNijCsWsEkA+jzT8hGYmv33w==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/compat@2.0.0': + resolution: {integrity: sha512-T9AfE1G1uv4wwq94ozgTGio5EUQBqAVe1X9qsQtSNVEYW6j3hvtZVm8Smr4qL1qDPFg+lOB2cL5RxTRMzq4CTA==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} peerDependencies: eslint: ^8.40 || 9 peerDependenciesMeta: @@ -7399,6 +7403,10 @@ packages: resolution: {integrity: sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/core@1.0.0': + resolution: {integrity: sha512-PRfWP+8FOldvbApr6xL7mNCw4cJcSTq4GA7tYbgq15mRb0kWKO/wEB2jr+uwjFH3sZvEZneZyCUGTxsv4Sahyw==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + '@eslint/eslintrc@3.3.3': resolution: {integrity: sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -8780,6 +8788,10 @@ packages: '@sinclair/typebox@0.34.41': resolution: {integrity: sha512-6gS8pZzSXdyRHTIqoqSVknxolr1kzfy4/CeDnrzsVz8TTIWUbOBr6gnzOmTYJ3eXQNh4IYHIGi5aIL7sOZ2G/g==} + '@sindresorhus/base62@1.0.0': + resolution: {integrity: sha512-TeheYy0ILzBEI/CO55CP6zJCSdSWeRtGnHy8U8dWSUH4I68iqTsy7HkMktR4xakThc9jotkPQUXT4ITdbV7cHA==} + engines: {node: '>=18'} + '@sinonjs/commons@3.0.1': resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==} @@ -12026,8 +12038,8 @@ packages: jest: optional: true - eslint-plugin-jsdoc@51.4.1: - resolution: {integrity: sha512-y4CA9OkachG8v5nAtrwvcvjIbdcKgSyS6U//IfQr4FZFFyeBFwZFf/tfSsMr46mWDJgidZjBTqoCRlXywfFBMg==} + eslint-plugin-jsdoc@61.4.1: + resolution: {integrity: sha512-3c1QW/bV25sJ1MsIvsvW+EtLtN6yZMduw7LVQNVt72y2/5BbV5Pg5b//TE5T48LRUxoEQGaZJejCmcj3wCxBzw==} engines: {node: '>=20.11.0'} peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 @@ -12077,9 +12089,9 @@ packages: eslint-config-prettier: optional: true - eslint-plugin-react-hooks@5.2.0: - resolution: {integrity: sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==} - engines: {node: '>=10'} + eslint-plugin-react-hooks@7.0.1: + resolution: {integrity: sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA==} + engines: {node: '>=18'} peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 @@ -12746,6 +12758,12 @@ packages: header-case@2.0.4: resolution: {integrity: sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==} + hermes-estree@0.25.1: + resolution: {integrity: sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==} + + hermes-parser@0.25.1: + resolution: {integrity: sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==} + highlight-words-core@1.2.3: resolution: {integrity: sha512-m1O9HW3/GNHxzSIXWw1wCNXXsgLlxrP0OI6+ycGUhiUHkikqW3OrwVHz+lxeNBe5yqLESdIcj8PowHQ2zLvUvQ==} @@ -13461,9 +13479,9 @@ packages: resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==} hasBin: true - jsdoc-type-pratt-parser@4.1.0: - resolution: {integrity: sha512-Hicd6JK5Njt2QB6XYFS7ok9e37O8AYk3jTcppG4YVQnYjOemymvTcmc7OWsmq/Qqj5TdRFO5/x/tIPmBeRtGHg==} - engines: {node: '>=12.0.0'} + jsdoc-type-pratt-parser@6.10.0: + resolution: {integrity: sha512-+LexoTRyYui5iOhJGn13N9ZazL23nAHGkXsa1p/C8yeq79WRfLBag6ZZ0FQG2aRoc9yfo59JT9EYCQonOkHKkQ==} + engines: {node: '>=20.0.0'} jsdom@26.1.0: resolution: {integrity: sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==} @@ -14245,6 +14263,9 @@ packages: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} + object-deep-merge@2.0.0: + resolution: {integrity: sha512-3DC3UMpeffLTHiuXSy/UG4NOIYTLlY9u3V82+djSCLYClWobZiS4ivYzpIUWrRY/nfsJ8cWsKyG3QfyLePmhvg==} + object-inspect@1.13.4: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} @@ -15410,6 +15431,10 @@ packages: reselect@5.1.1: resolution: {integrity: sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==} + reserved-identifiers@1.2.0: + resolution: {integrity: sha512-yE7KUfFvaBFzGPs5H3Ops1RevfUEsDc5Iz65rOwWg4lE8HJSYtle77uul3+573457oHvBKuHYDl/xqUkKpEEdw==} + engines: {node: '>=18'} + resize-observer-polyfill@1.5.1: resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==} @@ -16481,6 +16506,10 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} + to-valid-identifier@1.0.0: + resolution: {integrity: sha512-41wJyvKep3yT2tyPqX/4blcfybknGB4D+oETKLs7Q76UiPqRpUJK3hr1nxelyYO0PHKVzJwlu0aCeEAsGI6rpw==} + engines: {node: '>=20'} + toidentifier@1.0.1: resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} engines: {node: '>=0.6'} @@ -17223,6 +17252,12 @@ packages: resolution: {integrity: sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==} engines: {node: '>=12.20'} + zod-validation-error@4.0.2: + resolution: {integrity: sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==} + engines: {node: '>=18.0.0'} + peerDependencies: + zod: ^3.25.0 || ^4.0.0 + zod@3.25.76: resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==} @@ -18908,13 +18943,15 @@ snapshots: '@emotion/weak-memoize@0.4.0': {} - '@es-joy/jsdoccomment@0.52.0': + '@es-joy/jsdoccomment@0.76.0': dependencies: '@types/estree': 1.0.8 '@typescript-eslint/types': 8.48.0 comment-parser: 1.4.1 esquery: 1.6.0 - jsdoc-type-pratt-parser: 4.1.0 + jsdoc-type-pratt-parser: 6.10.0 + + '@es-joy/resolve.exports@1.2.0': {} '@esbuild/aix-ppc64@0.25.9': optional: true @@ -19001,9 +19038,9 @@ snapshots: '@eslint-community/regexpp@4.12.2': {} - '@eslint/compat@1.4.1(eslint@9.39.1)': + '@eslint/compat@2.0.0(eslint@9.39.1)': dependencies: - '@eslint/core': 0.17.0 + '@eslint/core': 1.0.0 optionalDependencies: eslint: 9.39.1 @@ -19023,6 +19060,10 @@ snapshots: dependencies: '@types/json-schema': 7.0.15 + '@eslint/core@1.0.0': + dependencies: + '@types/json-schema': 7.0.15 + '@eslint/eslintrc@3.3.3': dependencies: ajv: 6.12.6 @@ -20754,6 +20795,8 @@ snapshots: '@sinclair/typebox@0.34.41': {} + '@sindresorhus/base62@1.0.0': {} + '@sinonjs/commons@3.0.1': dependencies: type-detect: 4.0.8 @@ -23416,7 +23459,7 @@ snapshots: '@wordpress/escape-html@3.36.0(patch_hash=2659f08edd4c0250f15fb428f013852a17e84da9c745e6dae6307de837e4d30b)': {} - '@wordpress/eslint-plugin@22.22.0(@babel/core@7.28.4)(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint-plugin-import@2.32.0)(eslint-plugin-jest@29.2.1(eslint@9.39.1)(jest@30.2.0)(typescript@5.9.3))(eslint-plugin-jsdoc@51.4.1(eslint@9.39.1))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.39.1))(eslint-plugin-playwright@2.4.0(eslint@9.39.1))(eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint@9.39.1)(wp-prettier@3.0.3))(eslint-plugin-react-hooks@5.2.0(eslint@9.39.1))(eslint-plugin-react@7.37.5(eslint@9.39.1))(eslint@9.39.1)(typescript@5.9.3)(wp-prettier@3.0.3)': + '@wordpress/eslint-plugin@22.22.0(@babel/core@7.28.4)(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint-plugin-import@2.32.0)(eslint-plugin-jest@29.2.1(eslint@9.39.1)(jest@30.2.0)(typescript@5.9.3))(eslint-plugin-jsdoc@61.4.1(eslint@9.39.1))(eslint-plugin-jsx-a11y@6.10.2(eslint@9.39.1))(eslint-plugin-playwright@2.4.0(eslint@9.39.1))(eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint@9.39.1)(wp-prettier@3.0.3))(eslint-plugin-react-hooks@7.0.1(eslint@9.39.1))(eslint-plugin-react@7.37.5(eslint@9.39.1))(eslint@9.39.1)(typescript@5.9.3)(wp-prettier@3.0.3)': dependencies: '@babel/core': 7.28.4 '@babel/eslint-parser': 7.28.5(@babel/core@7.28.4)(eslint@9.39.1) @@ -23428,12 +23471,12 @@ snapshots: eslint-import-resolver-typescript: 4.4.4(eslint-plugin-import@2.32.0)(eslint@9.39.1) eslint-plugin-import: 2.32.0(eslint-import-resolver-typescript@4.4.4)(eslint@9.39.1) eslint-plugin-jest: 29.2.1(eslint@9.39.1)(jest@30.2.0)(typescript@5.9.3) - eslint-plugin-jsdoc: 51.4.1(eslint@9.39.1) + eslint-plugin-jsdoc: 61.4.1(eslint@9.39.1) eslint-plugin-jsx-a11y: 6.10.2(eslint@9.39.1) eslint-plugin-playwright: 2.4.0(eslint@9.39.1) eslint-plugin-prettier: 5.5.4(eslint-config-prettier@10.1.8(eslint@9.39.1))(eslint@9.39.1)(wp-prettier@3.0.3) eslint-plugin-react: 7.37.5(eslint@9.39.1) - eslint-plugin-react-hooks: 5.2.0(eslint@9.39.1) + eslint-plugin-react-hooks: 7.0.1(eslint@9.39.1) globals: 13.24.0 requireindex: 1.2.0 optionalDependencies: @@ -26279,9 +26322,10 @@ snapshots: - supports-color - typescript - eslint-plugin-jsdoc@51.4.1(eslint@9.39.1): + eslint-plugin-jsdoc@61.4.1(eslint@9.39.1): dependencies: - '@es-joy/jsdoccomment': 0.52.0 + '@es-joy/jsdoccomment': 0.76.0 + '@es-joy/resolve.exports': 1.2.0 are-docs-informative: 0.0.2 comment-parser: 1.4.1 debug: 4.4.3 @@ -26289,9 +26333,12 @@ snapshots: eslint: 9.39.1 espree: 10.4.0 esquery: 1.6.0 + html-entities: 2.6.0 + object-deep-merge: 2.0.0 parse-imports-exports: 0.2.4 semver: 7.7.3 spdx-expression-parse: 4.0.0 + to-valid-identifier: 1.0.0 transitivePeerDependencies: - supports-color @@ -26365,9 +26412,16 @@ snapshots: optionalDependencies: eslint-config-prettier: 10.1.8(eslint@9.39.1) - eslint-plugin-react-hooks@5.2.0(eslint@9.39.1): + eslint-plugin-react-hooks@7.0.1(eslint@9.39.1): dependencies: + '@babel/core': 7.28.4 + '@babel/parser': 7.28.5 eslint: 9.39.1 + hermes-parser: 0.25.1 + zod: 3.25.76 + zod-validation-error: 4.0.2(zod@3.25.76) + transitivePeerDependencies: + - supports-color eslint-plugin-react@7.37.5(eslint@9.39.1): dependencies: @@ -27162,6 +27216,12 @@ snapshots: capital-case: 1.0.4 tslib: 2.8.1 + hermes-estree@0.25.1: {} + + hermes-parser@0.25.1: + dependencies: + hermes-estree: 0.25.1 + highlight-words-core@1.2.3: {} history@5.3.0: @@ -28156,7 +28216,7 @@ snapshots: dependencies: argparse: 2.0.1 - jsdoc-type-pratt-parser@4.1.0: {} + jsdoc-type-pratt-parser@6.10.0: {} jsdom@26.1.0: dependencies: @@ -29176,6 +29236,8 @@ snapshots: object-assign@4.1.1: {} + object-deep-merge@2.0.0: {} + object-inspect@1.13.4: {} object-is@1.1.6: @@ -30413,6 +30475,8 @@ snapshots: reselect@5.1.1: {} + reserved-identifiers@1.2.0: {} + resize-observer-polyfill@1.5.1: {} resolve-cwd@3.0.0: @@ -31632,6 +31696,11 @@ snapshots: dependencies: is-number: 7.0.0 + to-valid-identifier@1.0.0: + dependencies: + '@sindresorhus/base62': 1.0.0 + reserved-identifiers: 1.2.0 + toidentifier@1.0.1: {} tough-cookie@5.1.2: @@ -32491,6 +32560,10 @@ snapshots: yocto-queue@1.2.1: {} + zod-validation-error@4.0.2(zod@3.25.76): + dependencies: + zod: 3.25.76 + zod@3.25.76: {} zwitch@2.0.4: {} diff --git a/projects/js-packages/charts/changelog/renovate-major-eslint-packages b/projects/js-packages/charts/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/js-packages/charts/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/js-packages/charts/src/components/private/with-responsive/with-responsive.tsx b/projects/js-packages/charts/src/components/private/with-responsive/with-responsive.tsx index b528f191e752..d1a1ebdf9cd2 100644 --- a/projects/js-packages/charts/src/components/private/with-responsive/with-responsive.tsx +++ b/projects/js-packages/charts/src/components/private/with-responsive/with-responsive.tsx @@ -35,7 +35,7 @@ const useResponsiveDimensions = ( { /** * A higher-order component that provides responsive dimensions - * to the wrapped chart component using useParentSize from @visx/responsive. + * to the wrapped chart component using useParentSize from `@visx/responsive`. * * @param WrappedComponent - The chart component to be wrapped. * @return A functional component that renders the wrapped component with responsive dimensions. diff --git a/projects/js-packages/charts/src/utils/color-utils.ts b/projects/js-packages/charts/src/utils/color-utils.ts index 9fa47a4fd21d..4851fd777f26 100644 --- a/projects/js-packages/charts/src/utils/color-utils.ts +++ b/projects/js-packages/charts/src/utils/color-utils.ts @@ -1,7 +1,7 @@ /** * Validate hex color format - * @param hex - The hex color string to validate - * @throws Error if hex string is malformed + * @param hex - The hex color string to validate + * @throws {Error} if hex string is malformed */ const validateHexColor = ( hex: string ): void => { // Validate hex format @@ -29,10 +29,10 @@ const validateHexColor = ( hex: string ): void => { /** * Convert hex color to rgba with specified opacity * This is genuinely reusable across chart components - * @param hex - The hex color string (e.g., '#ff0000') - * @param alpha - The opacity value between 0 and 1 + * @param hex - The hex color string (e.g., '#ff0000') + * @param alpha - The opacity value between 0 and 1 * @return The rgba color string (e.g., 'rgba(255, 0, 0, 0.5)') - * @throws Error if hex string is malformed + * @throws {Error} if hex string is malformed */ export const hexToRgba = ( hex: string, alpha: number ): string => { validateHexColor( hex ); @@ -50,9 +50,9 @@ export const hexToRgba = ( hex: string, alpha: number ): string => { /** * Convert hex color to HSL - * @param hex - hex color string + * @param hex - hex color string * @return HSL values as [h, s, l] - * @throws Error if hex string is malformed + * @throws {Error} if hex string is malformed */ export const hexToHsl = ( hex: string ): [ number, number, number ] => { validateHexColor( hex ); diff --git a/projects/js-packages/charts/src/utils/format-metric-value.ts b/projects/js-packages/charts/src/utils/format-metric-value.ts index 0e81620e9b55..be3fddb0dd8b 100644 --- a/projects/js-packages/charts/src/utils/format-metric-value.ts +++ b/projects/js-packages/charts/src/utils/format-metric-value.ts @@ -13,7 +13,7 @@ type FormatMetricValueOptions = { /** * Format a numeric metric value based on type, precision and scale. - * Supports currency, number and percentage, using @automattic/number-formatters. + * Supports currency, number and percentage, using `@automattic/number-formatters`. * * @param value - The value to format * @param type - The type of formatting to apply diff --git a/projects/js-packages/charts/src/utils/format-percentage.ts b/projects/js-packages/charts/src/utils/format-percentage.ts index 3dd55e539b3d..c8f175099c27 100644 --- a/projects/js-packages/charts/src/utils/format-percentage.ts +++ b/projects/js-packages/charts/src/utils/format-percentage.ts @@ -2,7 +2,7 @@ import { formatNumber } from '@automattic/number-formatters'; /** * Format a percentage value with smart decimal handling. - * Uses @automattic/number-formatters for consistent formatting. + * Uses `@automattic/number-formatters` for consistent formatting. * Removes unnecessary trailing zeros and caps at 2 decimal places. * * @param value - The percentage value (0-100 range) diff --git a/projects/js-packages/connection/changelog/renovate-major-eslint-packages b/projects/js-packages/connection/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/js-packages/connection/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/js-packages/connection/declarations.d.ts b/projects/js-packages/connection/declarations.d.ts index 2c04b62c9329..a4d1c949b54f 100644 --- a/projects/js-packages/connection/declarations.d.ts +++ b/projects/js-packages/connection/declarations.d.ts @@ -10,7 +10,7 @@ declare module '@automattic/jetpack-script-data' { declare global { interface Window { /** - * @deprecated In favor of getScriptData from @automattic/jetpack-script-data + * @deprecated In favor of getScriptData from `@automattic/jetpack-script-data` */ JP_CONNECTION_INITIAL_STATE: ConnectionScriptData; } diff --git a/projects/js-packages/i18n-check-webpack-plugin/changelog/renovate-major-eslint-packages b/projects/js-packages/i18n-check-webpack-plugin/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/js-packages/i18n-check-webpack-plugin/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/js-packages/i18n-check-webpack-plugin/src/GettextExtractor.js b/projects/js-packages/i18n-check-webpack-plugin/src/GettextExtractor.js index fb8f6e06c553..edb9b4e8a659 100644 --- a/projects/js-packages/i18n-check-webpack-plugin/src/GettextExtractor.js +++ b/projects/js-packages/i18n-check-webpack-plugin/src/GettextExtractor.js @@ -8,9 +8,9 @@ const debug = require( 'debug' )( `${ PLUGIN_NAME }:gettext` ); // eslint-disabl const { parseAsync, parseSync, traverse, types: t } = babel; // Some typedefs for jsdoc. Babel doesn't export the actual constructors for us. -/** @typedef babel.Node */ -/** @typedef babel.Comment */ -/** @typedef {babel.Node} babel.CallExpression */ +/** @typedef {babel.Node} BabelNode */ +/** @typedef {babel.Comment} BabelComment */ +/** @typedef {babel.Node} BabelCallExpression */ /** * Default function mappings. @@ -310,7 +310,7 @@ class GettextExtractor { * Resolve the callee of a CallExpression. * * @see https://github.com/wp-cli/i18n-command/blob/e9eef8aab4b5e43c3aa09bf60e1e7a9d6d30d302/src/JsFunctionsScanner.php#L254 - * @param {babel.CallExpression} node - CallExpression node. + * @param {BabelCallExpression} node - CallExpression node. * @return {{ name: string, comments: string[] }|undefined} Callee name and comments, or undefined. */ #resolveExpressionCallee( node ) { @@ -421,8 +421,8 @@ class GettextExtractor { * Test if the comment comes before the node. * * @see https://github.com/wp-cli/i18n-command/blob/e9eef8aab4b5e43c3aa09bf60e1e7a9d6d30d302/src/JsFunctionsScanner.php#L364 - * @param {babel.Comment} comment - Comment. - * @param {babel.Node} node - Node. + * @param {BabelComment} comment - Comment. + * @param {BabelNode} node - Node. * @return {boolean} Whether the comment comes before the node. */ #commentPrecedesNode( comment, node ) { diff --git a/projects/js-packages/licensing/changelog/renovate-major-eslint-packages b/projects/js-packages/licensing/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/js-packages/licensing/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/js-packages/licensing/components/activation-screen/index.jsx b/projects/js-packages/licensing/components/activation-screen/index.jsx index c5842ecb44ed..09d71fbe0d8a 100644 --- a/projects/js-packages/licensing/components/activation-screen/index.jsx +++ b/projects/js-packages/licensing/components/activation-screen/index.jsx @@ -17,7 +17,7 @@ import './style.scss'; * * @param {(object|Array)} result -- the result from the attachLicenses request * @return {number} The activatedProductId from the result - * @throws Errors either from the API response or from any issues parsing the response + * @throws {Error} either from the API response or from any issues parsing the response */ const parseAttachLicensesResult = result => { let currentResult = result; diff --git a/projects/js-packages/publicize-components/changelog/renovate-major-eslint-packages b/projects/js-packages/publicize-components/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx b/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx index 7966da720292..705f3bc2603c 100644 --- a/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx +++ b/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx @@ -226,7 +226,7 @@ export function ConfirmationForm( { { // /** - * It is such a shame that we can't use any of the form components from @wordpress/components here. + * It is such a shame that we can't use any of the form components from `@wordpress/components` here. * Because of the way the components are designed, we can't use them in an uncontrolled way. * Every component is forced be used only in controlled mode. * diff --git a/projects/js-packages/react-data-sync-client/changelog/renovate-major-eslint-packages b/projects/js-packages/react-data-sync-client/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/js-packages/react-data-sync-client/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/js-packages/react-data-sync-client/src/DataSync.ts b/projects/js-packages/react-data-sync-client/src/DataSync.ts index 19e06bf948c1..a1cd3d022696 100644 --- a/projects/js-packages/react-data-sync-client/src/DataSync.ts +++ b/projects/js-packages/react-data-sync-client/src/DataSync.ts @@ -175,14 +175,14 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema /** * Method to make a request to the endpoint. - * @param method - The request method. - * @param partialPathname - The request path. - * @param value - Data to send when using POST. - * @param params - Append query params to the URL. Takes in an object of key/value pairs. - * @param abortSignal - The abort signal. + * @param method - The request method. + * @param partialPathname - The request path. + * @param value - Data to send when using POST. + * @param params - Append query params to the URL. Takes in an object of key/value pairs. + * @param abortSignal - The abort signal. * @returns The parsed value. - * @throws ApiError - * @throws Error + * @throws {ApiError} + * @throws {Error} */ private async request( method: RequestMethods, diff --git a/projects/js-packages/webpack-config/changelog/renovate-major-eslint-packages b/projects/js-packages/webpack-config/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/js-packages/webpack-config/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/js-packages/webpack-config/src/webpack/mini-css-with-rtl.js b/projects/js-packages/webpack-config/src/webpack/mini-css-with-rtl.js index 845cdfeaff5c..7465a96265c1 100644 --- a/projects/js-packages/webpack-config/src/webpack/mini-css-with-rtl.js +++ b/projects/js-packages/webpack-config/src/webpack/mini-css-with-rtl.js @@ -3,7 +3,7 @@ * function with one that conditionally substitutes the rtl asset from * `@automattic/webpack-rtl-plugin`. * - * Forked from @automattic/calypso-build v9.0.0, then significantly cleaned up. + * Forked from `@automattic/calypso-build` v9.0.0, then significantly cleaned up. */ const webpack = require( 'webpack' ); const PLUGIN_NAME = 'MiniCSSWithRTL'; diff --git a/projects/packages/forms/changelog/renovate-major-eslint-packages b/projects/packages/forms/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/packages/forms/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/packages/forms/src/contact-form/libs/date-picker/lib/date.ts b/projects/packages/forms/src/contact-form/libs/date-picker/lib/date.ts index 9c35166b1eda..3ea24b7c7325 100644 --- a/projects/packages/forms/src/contact-form/libs/date-picker/lib/date.ts +++ b/projects/packages/forms/src/contact-form/libs/date-picker/lib/date.ts @@ -118,9 +118,9 @@ type DateOrParse = ( dt: Date | string, dateFormat: string ) => Date; /** * dateOrParse creates a function which, given a date or string, returns a date * - * @param {function} parse the function used to parse strings + * @param {Function} parse the function used to parse strings * @param {string} dateFormat the date format to use, overrides the date format passed in the function call - * @returns {function} + * @returns {Function} */ export function dateOrParse( parse: DateOrParse, dateFormat?: string ): DateOrParse { return function ( dt: Date | string, df: string ) { diff --git a/projects/packages/forms/src/contact-form/libs/date-picker/lib/dom.ts b/projects/packages/forms/src/contact-form/libs/date-picker/lib/dom.ts index 430e27387fa1..25d0c4c6bda8 100644 --- a/projects/packages/forms/src/contact-form/libs/date-picker/lib/dom.ts +++ b/projects/packages/forms/src/contact-form/libs/date-picker/lib/dom.ts @@ -19,9 +19,9 @@ export const Key = { * * @param {string} evt the name of the event to handle * @param {HTMLElement} el the element to attach to - * @param {function} handler the event handler + * @param {Function} handler the event handler * - * @returns {function} the off function + * @returns {Function} the off function */ export function on( evt: string, el: HTMLElement, handler: EventListenerOrEventListenerObject ) { el.addEventListener( evt, handler, true ); diff --git a/projects/packages/forms/src/contact-form/libs/date-picker/lib/fns.ts b/projects/packages/forms/src/contact-form/libs/date-picker/lib/fns.ts index f491e63f5243..99d7d7c24bea 100644 --- a/projects/packages/forms/src/contact-form/libs/date-picker/lib/fns.ts +++ b/projects/packages/forms/src/contact-form/libs/date-picker/lib/fns.ts @@ -6,8 +6,8 @@ * bufferFn buffers calls to fn so they only happen every ms milliseconds * * @param {number} ms number of milliseconds - * @param {function} fn the function to be buffered - * @returns {function} + * @param {Function} fn the function to be buffered + * @returns {Function} */ export function bufferFn( ms: number, fn: ( ...args: unknown[] ) => unknown ): () => void { let timeout: ReturnType< typeof setTimeout > | undefined; diff --git a/projects/packages/forms/tools/webpack.config.dashboard.js b/projects/packages/forms/tools/webpack.config.dashboard.js index 58e04b757926..9939cebd6ea8 100644 --- a/projects/packages/forms/tools/webpack.config.dashboard.js +++ b/projects/packages/forms/tools/webpack.config.dashboard.js @@ -12,9 +12,9 @@ const __dirname = path.dirname( __filename ); const require = createRequire( import.meta.url ); /** - * Generate i18n function variants for @automattic/babel-plugin-replace-textdomain. + * Generate i18n function variants for `@automattic/babel-plugin-replace-textdomain`. * - * The @wordpress/dataviews currently uses the i18n functions under a variety of aliases, + * The `@wordpress/dataviews` currently uses the i18n functions under a variety of aliases, * which makes it a pain to add the proper textdomain. This function generates an object * with the base function and 99 more variants as keys. * @@ -85,7 +85,7 @@ export default { } ), /** - * Transpile @wordpress/dataviews in node_modules too. + * Transpile `@wordpress/dataviews` in node_modules too. * * @see https://github.com/Automattic/jetpack/issues/39907 */ diff --git a/projects/packages/jetpack-mu-wpcom/changelog/renovate-major-eslint-packages b/projects/packages/jetpack-mu-wpcom/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/celebrate-launch/confetti-animation.ts b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/celebrate-launch/confetti-animation.ts index c986e8fecfe7..f2eeeb5a3b49 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/celebrate-launch/confetti-animation.ts +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-dashboard-widgets/celebrate-launch/confetti-animation.ts @@ -1,5 +1,5 @@ /** - * Originally sourced from @automattic/components + * Originally sourced from `@automattic/components` * https://github.com/Automattic/wp-calypso/blob/df175811d96c9af3369a7f39978b74668d9f4896/packages/components/src/confetti/index.ts */ diff --git a/projects/packages/jetpack-mu-wpcom/webpack-plugins/codemirror-language-data-plugin.js b/projects/packages/jetpack-mu-wpcom/webpack-plugins/codemirror-language-data-plugin.js index e70e1d62e8de..642428ae1ceb 100644 --- a/projects/packages/jetpack-mu-wpcom/webpack-plugins/codemirror-language-data-plugin.js +++ b/projects/packages/jetpack-mu-wpcom/webpack-plugins/codemirror-language-data-plugin.js @@ -4,7 +4,7 @@ * This plugin creates a virtual module that can be imported using: * import { extensionToLang } from '@@codemirrorLanguageData@@'; * - * The plugin generates the data from @codemirror/language-data at build time + * The plugin generates the data from `@codemirror/language-data` at build time * and makes it available as a virtual module without writing files to disk. */ @@ -91,6 +91,7 @@ class CodeMirrorLanguageDataPlugin { * @param {string} contents - File contents. */ writeVirtualFile( fs, filePath, contents ) { + // eslint-disable-next-line jsdoc/ts-no-empty-object-type /** @type {Extract>,{}>} */ const stats = { isFile: () => true, diff --git a/projects/packages/jetpack-mu-wpcom/webpack.config.js b/projects/packages/jetpack-mu-wpcom/webpack.config.js index 1f533833361c..ecd702b926ac 100644 --- a/projects/packages/jetpack-mu-wpcom/webpack.config.js +++ b/projects/packages/jetpack-mu-wpcom/webpack.config.js @@ -91,7 +91,7 @@ module.exports = async () => { ...jetpackWebpackConfig.resolve, alias: { ...jetpackWebpackConfig.resolve.alias, - /** Replace the classnames used by @automattic/newspack-blocks with clsx because we changed to use clsx */ + /** Replace the `classnames` used by `@automattic/newspack-blocks` with `clsx` because we changed to use `clsx` */ classnames: await findPackage( 'clsx' ), }, fallback: { diff --git a/projects/packages/newsletter/changelog/renovate-major-eslint-packages b/projects/packages/newsletter/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/packages/newsletter/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/packages/newsletter/webpack.config.js b/projects/packages/newsletter/webpack.config.js index 0285f557050f..85c1e7abd4ac 100644 --- a/projects/packages/newsletter/webpack.config.js +++ b/projects/packages/newsletter/webpack.config.js @@ -12,9 +12,9 @@ const __dirname = path.dirname( __filename ); const require = createRequire( import.meta.url ); /** - * Generate i18n function variants for @automattic/babel-plugin-replace-textdomain. + * Generate i18n function variants for `@automattic/babel-plugin-replace-textdomain`. * - * The @wordpress/dataviews currently uses the i18n functions under a variety of aliases, + * The `@wordpress/dataviews` currently uses the i18n functions under a variety of aliases, * which makes it a pain to add the proper textdomain. This function generates an object * with the base function and 99 more variants as keys. * @@ -76,7 +76,7 @@ export default { } ), /** - * Transpile @wordpress/dataviews in node_modules too. + * Transpile `@wordpress/dataviews` in node_modules too. * * @see https://github.com/Automattic/jetpack/issues/39907 */ diff --git a/projects/packages/paypal-payments/changelog/renovate-major-eslint-packages b/projects/packages/paypal-payments/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/packages/paypal-payments/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/packages/paypal-payments/src/block/register-jetpack-block.js b/projects/packages/paypal-payments/src/block/register-jetpack-block.js index 707a3c479748..1020a8b8e213 100644 --- a/projects/packages/paypal-payments/src/block/register-jetpack-block.js +++ b/projects/packages/paypal-payments/src/block/register-jetpack-block.js @@ -2,7 +2,7 @@ * This is a copy of the registerJetpackBlock function from the Jetpack plugin. * It is used to register the PayPal Payments block. * - * @todo Move this functionality to the @automattic/jetpack-shared-extension-utils package, then remove both copies of this file. + * @todo Move this functionality to the `@automattic/jetpack-shared-extension-utils` package, then remove both copies of this file. * * @see https://github.com/Automattic/jetpack/blob/trunk/projects/plugins/jetpack/extensions/shared/register-jetpack-block.js */ diff --git a/projects/plugins/boost/app/assets/src/js/features/critical-css/lib/generate-critical-css.ts b/projects/plugins/boost/app/assets/src/js/features/critical-css/lib/generate-critical-css.ts index 86a98634c6b3..4edbf4e87a80 100644 --- a/projects/plugins/boost/app/assets/src/js/features/critical-css/lib/generate-critical-css.ts +++ b/projects/plugins/boost/app/assets/src/js/features/critical-css/lib/generate-critical-css.ts @@ -377,7 +377,7 @@ function keepAtRule( name: string ): boolean { /** * Helper method to filter out properties that we don't want. * Note this function is used as a filter in the generateCriticalCSS function - * in the @automattic/jetpack-critical-css-gen library (https://github.com/Automattic/jetpack-critical-css-gen). + * in the `@automattic/jetpack-critical-css-gen` library (https://github.com/Automattic/jetpack-critical-css-gen). * * This function has a value parameter which is not being used here but other implementations of this * helper function for the library may require the value parameter for filtering. @@ -396,7 +396,7 @@ function keepProperty( name: string, _value: string ): boolean { * Function to verify that a specific page is valid to run the Critical CSS process on it. * * Note that this function is used as a callback in the generateCriticalCSS function - * in the @automattic/jetpack-critical-css-gen library (https://github.com/Automattic/jetpack-critical-css-gen). + * in the `@automattic/jetpack-critical-css-gen` library (https://github.com/Automattic/jetpack-critical-css-gen). * * This function has a url and innerWindow parameters which are not being used here but this method * is called with URL and InnerWindow in that library to offer flexibility of the verification for other implementation. diff --git a/projects/plugins/boost/changelog/renovate-major-eslint-packages b/projects/plugins/boost/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..7a568881a52e --- /dev/null +++ b/projects/plugins/boost/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/plugins/jetpack/_inc/client/lib/analytics/index.js b/projects/plugins/jetpack/_inc/client/lib/analytics/index.js index e9190bf4ee7f..52e636189752 100644 --- a/projects/plugins/jetpack/_inc/client/lib/analytics/index.js +++ b/projects/plugins/jetpack/_inc/client/lib/analytics/index.js @@ -1,5 +1,5 @@ /** - * A thin wrapper for @automattic/jetpack-analytics + * A thin wrapper for `@automattic/jetpack-analytics` */ import jetpackAnalytics from '@automattic/jetpack-analytics'; diff --git a/projects/plugins/jetpack/_inc/client/recommendations/prompts/resource-prompt/index.jsx b/projects/plugins/jetpack/_inc/client/recommendations/prompts/resource-prompt/index.jsx index 2fab5ad86861..f6bb9f568360 100644 --- a/projects/plugins/jetpack/_inc/client/recommendations/prompts/resource-prompt/index.jsx +++ b/projects/plugins/jetpack/_inc/client/recommendations/prompts/resource-prompt/index.jsx @@ -28,7 +28,6 @@ import { PromptLayout } from '../prompt-layout'; * Similar to Feature prompt, but a resource/ link is provided instead of a feature to enable. * * @param {object} props - Component props. - * @function Object() { [native code] } * @return {Element} - A react component. */ const ResourcePromptComponent = props => { diff --git a/projects/plugins/jetpack/_inc/client/state/recommendations/onboarding-utils.ts b/projects/plugins/jetpack/_inc/client/state/recommendations/onboarding-utils.ts index 7e4096115fb8..dfa447ca6438 100644 --- a/projects/plugins/jetpack/_inc/client/state/recommendations/onboarding-utils.ts +++ b/projects/plugins/jetpack/_inc/client/state/recommendations/onboarding-utils.ts @@ -23,7 +23,7 @@ export function getOnboardingNameByProductSlug( productSlug: string ) { * * @param {string} name - onboarding name * @return {number} the onboarding priority - * @throws exception when the requested onboarding is not in the ONBOARDING_ORDER array. + * @throws {string} exception when the requested onboarding is not in the ONBOARDING_ORDER array. */ function getOnboardingPriority( name: string ) { const index = ONBOARDING_ORDER.indexOf( name ); diff --git a/projects/plugins/jetpack/changelog/renovate-major-eslint-packages b/projects/plugins/jetpack/changelog/renovate-major-eslint-packages new file mode 100644 index 000000000000..1b71169da1a4 --- /dev/null +++ b/projects/plugins/jetpack/changelog/renovate-major-eslint-packages @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Fix new lints in jsdoc comments. Should be no changes to functionality. + + diff --git a/projects/plugins/jetpack/extensions/blocks/eventbrite/deprecated/v1/index.js b/projects/plugins/jetpack/extensions/blocks/eventbrite/deprecated/v1/index.js index b4ccc56aa2d2..5de3cf3bb21b 100644 --- a/projects/plugins/jetpack/extensions/blocks/eventbrite/deprecated/v1/index.js +++ b/projects/plugins/jetpack/extensions/blocks/eventbrite/deprecated/v1/index.js @@ -23,7 +23,7 @@ const deprecatedButtonAttributes = [ /** * Deprecated save function. * - * Adapted button save function from @wordpress/block-library + * Adapted button save function from `@wordpress/block-library` * (Using Gutenberg code that shipped with WordPress 5.3) * * @see https://github.com/WordPress/gutenberg/blob/wp/5.3/packages/block-library/src/button/save.js diff --git a/projects/plugins/jetpack/extensions/blocks/podcast-player/utils.js b/projects/plugins/jetpack/extensions/blocks/podcast-player/utils.js index d9599ca6ac3a..7c3d98354774 100644 --- a/projects/plugins/jetpack/extensions/blocks/podcast-player/utils.js +++ b/projects/plugins/jetpack/extensions/blocks/podcast-player/utils.js @@ -2,7 +2,7 @@ import clsx from 'clsx'; /** * Returns a class based on the context a color is being used and its slug. - * Note: This helper function was copied from core @wordpress/block-editor lib, + * Note: This helper function was copied from core `@wordpress/block-editor` lib, * in order to avoid requiring not-needed dependencies to reduce the size of * compiled files used in the front-end. * diff --git a/projects/plugins/jetpack/extensions/blocks/videopress/editor.js b/projects/plugins/jetpack/extensions/blocks/videopress/editor.js index 87c3ea88f111..63ade4711757 100644 --- a/projects/plugins/jetpack/extensions/blocks/videopress/editor.js +++ b/projects/plugins/jetpack/extensions/blocks/videopress/editor.js @@ -539,7 +539,8 @@ function mapV6AttributesToV5( attributes ) { * * Blocks list: * - core/video - * - core/embed is not auto-converted for the moment. @todo: consider to do it in the future. + * - core/embed is not auto-converted for the moment. + * @todo consider to do it in the future. */ const convertVideoBlockToVideoPressVideoBlock = createHigherOrderComponent( BlockListBlock => { return props => { diff --git a/projects/plugins/jetpack/extensions/shared/block-styles.js b/projects/plugins/jetpack/extensions/shared/block-styles.js index be1d8898888f..84a79b53e2fa 100644 --- a/projects/plugins/jetpack/extensions/shared/block-styles.js +++ b/projects/plugins/jetpack/extensions/shared/block-styles.js @@ -3,7 +3,7 @@ import TokenList from '@wordpress/token-list'; /** * Returns the active style from the given className. * - * From @link https://github.com/WordPress/gutenberg/blob/ddac4f3cf8fd311169c7e125411343a437bdbb5a/packages/editor/src/components/block-styles/index.js#L20-L42 + * From {@link https://github.com/WordPress/gutenberg/blob/ddac4f3cf8fd311169c7e125411343a437bdbb5a/packages/editor/src/components/block-styles/index.js#L20-L42} * * @param {Array} styles - Block style variations. * @param {string} className - Class name diff --git a/projects/plugins/jetpack/modules/videopress/js/videopress-plupload.js b/projects/plugins/jetpack/modules/videopress/js/videopress-plupload.js index 083d451d4241..eccf74baff60 100644 --- a/projects/plugins/jetpack/modules/videopress/js/videopress-plupload.js +++ b/projects/plugins/jetpack/modules/videopress/js/videopress-plupload.js @@ -125,7 +125,7 @@ window.wp = window.wp || {}; * Custom error callback. * * Add a new error to the errors collection, so other modules can track - * and display errors. @see wp.Uploader.errors. + * and display errors. {@see wp.Uploader.errors}. * * @param {string} message * @param {object} data diff --git a/tools/cli/commands/changelog.js b/tools/cli/commands/changelog.js index 426eec96f6d1..db856f7677ea 100644 --- a/tools/cli/commands/changelog.js +++ b/tools/cli/commands/changelog.js @@ -756,7 +756,7 @@ async function checkChangelogFiles( baseRef ) { * * @param {string} fileName - what we want to name the file. * @param {Array} needChangelog - projects that need changelog. - * @return {argv}. + * @return {boolean} If any projects already have a changelog file by that name. */ function doesFilenameExist( fileName, needChangelog ) { let fileExists = false; diff --git a/tools/js-tools/eslintrc/base.mjs b/tools/js-tools/eslintrc/base.mjs index fd5ec5a56b26..4fa771230179 100644 --- a/tools/js-tools/eslintrc/base.mjs +++ b/tools/js-tools/eslintrc/base.mjs @@ -322,6 +322,10 @@ export function makeBaseConfig( configurl, opts = {} ) { 'jsdoc/require-returns': 'warn', 'jsdoc/require-yields': 'warn', + // Too many of these to clean up now. Unclear if we even want to. + 'jsdoc/reject-any-type': 'off', + 'jsdoc/reject-function-type': 'off', + 'jsx-a11y/anchor-has-content': 'off', 'jsx-a11y/anchor-is-valid': 'off', // Redundant roles are sometimes necessary for screen reader support. For instance, VoiceOver diff --git a/tools/js-tools/package.json b/tools/js-tools/package.json index 3eaa1a29891a..f70bd8e3f82d 100644 --- a/tools/js-tools/package.json +++ b/tools/js-tools/package.json @@ -14,7 +14,7 @@ "@babel/core": "7.28.4", "@babel/preset-react": "7.27.1", "@babel/preset-typescript": "7.27.1", - "@eslint/compat": "1.4.1", + "@eslint/compat": "2.0.0", "@eslint/eslintrc": "3.3.3", "@eslint/js": "9.39.1", "@eslint/json": "0.14.0", @@ -37,7 +37,7 @@ "eslint-plugin-import": "2.32.0", "eslint-plugin-jest": "29.2.1", "eslint-plugin-jest-dom": "5.5.0", - "eslint-plugin-jsdoc": "51.4.1", + "eslint-plugin-jsdoc": "61.4.1", "eslint-plugin-jsx-a11y": "6.10.2", "eslint-plugin-lodash": "8.0.0", "eslint-plugin-n": "17.23.1", @@ -45,7 +45,7 @@ "eslint-plugin-playwright": "2.4.0", "eslint-plugin-prettier": "5.5.4", "eslint-plugin-react": "7.37.5", - "eslint-plugin-react-hooks": "5.2.0", + "eslint-plugin-react-hooks": "7.0.1", "eslint-plugin-svelte": "3.13.0", "eslint-plugin-testing-library": "7.13.5", "eslint-plugin-you-dont-need-lodash-underscore": "6.14.0", From bc358dd343496f2db5cf25c8e98963ac0e6a7bf0 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 3 Dec 2025 16:04:17 -0500 Subject: [PATCH 23/49] Remove changelog line that only applied to one of the beta versions. (#46187) --- projects/plugins/jetpack/CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/plugins/jetpack/CHANGELOG.md b/projects/plugins/jetpack/CHANGELOG.md index 1c693c7a1d33..5c9edf7c6f01 100644 --- a/projects/plugins/jetpack/CHANGELOG.md +++ b/projects/plugins/jetpack/CHANGELOG.md @@ -4,8 +4,6 @@ ## 15.3 - 2025-12-03 -Incorrectly tagged without releasing new versions of Jetpack Forms. 15.3-beta.3 was created immediately to fix the issue. - ### Enhancements - Forms: Add browser info to the form response email notification. [#45710] - Forms: Add form response webhook support. [#46059] From b186f842261fa8287864a3ce6ed58f2c6d9fd86c Mon Sep 17 00:00:00 2001 From: Adnan Haque <3737780+haqadn@users.noreply.github.com> Date: Wed, 3 Dec 2025 21:23:46 -0500 Subject: [PATCH 24/49] Boost: Fix Boost e2e errors (#46186) --- .../plugins/boost/changelog/fix-boost-e2e | 5 +++++ .../assets/e2e-external-stylesheet.css | 8 ++++++++ .../e2e-external-css-enqueue.php | 19 +++++++++++++++++++ .../specs/critical-css/critical-css.test.ts | 5 ++++- .../docker/jetpack-docker-config-default.yml | 1 + 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 projects/plugins/boost/changelog/fix-boost-e2e create mode 100644 projects/plugins/boost/tests/e2e/plugins/e2e-external-css-enqueue/assets/e2e-external-stylesheet.css create mode 100644 projects/plugins/boost/tests/e2e/plugins/e2e-external-css-enqueue/e2e-external-css-enqueue.php diff --git a/projects/plugins/boost/changelog/fix-boost-e2e b/projects/plugins/boost/changelog/fix-boost-e2e new file mode 100644 index 000000000000..fba3d77acbe7 --- /dev/null +++ b/projects/plugins/boost/changelog/fix-boost-e2e @@ -0,0 +1,5 @@ +Significance: patch +Type: fixed +Comment: Fixed e2e tests, nothing user facing + + diff --git a/projects/plugins/boost/tests/e2e/plugins/e2e-external-css-enqueue/assets/e2e-external-stylesheet.css b/projects/plugins/boost/tests/e2e/plugins/e2e-external-css-enqueue/assets/e2e-external-stylesheet.css new file mode 100644 index 000000000000..7678623b3b79 --- /dev/null +++ b/projects/plugins/boost/tests/e2e/plugins/e2e-external-css-enqueue/assets/e2e-external-stylesheet.css @@ -0,0 +1,8 @@ +body { + background-color: #f00; + color: #222; + font-family: Arial, Helvetica, sans-serif; + line-height: 1.5; + margin: 0; + padding: 0; +} diff --git a/projects/plugins/boost/tests/e2e/plugins/e2e-external-css-enqueue/e2e-external-css-enqueue.php b/projects/plugins/boost/tests/e2e/plugins/e2e-external-css-enqueue/e2e-external-css-enqueue.php new file mode 100644 index 000000000000..8a2f2a38369a --- /dev/null +++ b/projects/plugins/boost/tests/e2e/plugins/e2e-external-css-enqueue/e2e-external-css-enqueue.php @@ -0,0 +1,19 @@ + { - let previousTheme; + let previousTheme: string | null = null; test.beforeAll( async ( { boostUtils } ) => { await boostUtils.resetEnvironment(); @@ -55,6 +55,9 @@ test.describe.serial( 'Critical CSS module', () => { page, } ) => { await boostUtils.activateBoostModule( 'critical_css' ); + await boostUtils.executeWpCommand( + 'plugin activate e2e-external-css-enqueue/e2e-external-css-enqueue.php' + ); await jetpackBoostPage.visit(); await expect( diff --git a/tools/docker/jetpack-docker-config-default.yml b/tools/docker/jetpack-docker-config-default.yml index 8d3727ba4e85..640dda3ccef9 100644 --- a/tools/docker/jetpack-docker-config-default.yml +++ b/tools/docker/jetpack-docker-config-default.yml @@ -69,6 +69,7 @@ e2e: projects/plugins/boost/tests/e2e/plugins/e2e-mock-speed-score-api.php: /var/www/html/wp-content/plugins/e2e-mock-speed-score-api.php projects/plugins/boost/tests/e2e/plugins/e2e-mock-boost-connection.php: /var/www/html/wp-content/plugins/e2e-mock-boost-connection.php projects/plugins/boost/tests/e2e/plugins/e2e-mock-lcp-optimization-api/: /var/www/html/wp-content/plugins/e2e-mock-lcp-optimization-api/ + projects/plugins/boost/tests/e2e/plugins/e2e-external-css-enqueue/: /var/www/html/wp-content/plugins/e2e-external-css-enqueue/ projects/plugins/boost/tests/e2e/plugins/e2e-mock-premium-features.php: /var/www/html/wp-content/plugins/e2e-mock-premium-features.php projects/plugins/boost/tests/e2e/plugins/e2e-critical-css-force-errors.php: /var/www/html/wp-content/plugins/e2e-critical-css-force-errors.php tools/e2e-commons/plugins/e2e-search-test-helper.php: /var/www/html/wp-content/plugins/e2e-search-test-helper.php From 79486b7511be5b887350604be314d0b6101069b6 Mon Sep 17 00:00:00 2001 From: Douglas Henri Date: Thu, 4 Dec 2025 08:39:17 -0300 Subject: [PATCH 25/49] Forms: Use lowercase on cipher names (#46189) * fix cypher name case * changelog * return fallback jwt instead of throwing error * use foreach to get the cipher with exact value from system (#46190) * fix cypher name case * changelog * use foreach to get the cipher with exact value from system * Add non-encrypted payload fallback * Optimize cipher availability detection --------- Co-authored-by: Douglas Co-authored-by: William Viana --------- Co-authored-by: Christian Gastrell Co-authored-by: William Viana --- .../forms/changelog/fix-forms-jwt-cypher | 4 ++ .../src/contact-form/class-contact-form.php | 64 +++++++++++-------- 2 files changed, 41 insertions(+), 27 deletions(-) create mode 100644 projects/packages/forms/changelog/fix-forms-jwt-cypher diff --git a/projects/packages/forms/changelog/fix-forms-jwt-cypher b/projects/packages/forms/changelog/fix-forms-jwt-cypher new file mode 100644 index 000000000000..0da731db9d9b --- /dev/null +++ b/projects/packages/forms/changelog/fix-forms-jwt-cypher @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Forms: Use the correct case on cipher names diff --git a/projects/packages/forms/src/contact-form/class-contact-form.php b/projects/packages/forms/src/contact-form/class-contact-form.php index 0452989ed8dc..36adcdbc2087 100644 --- a/projects/packages/forms/src/contact-form/class-contact-form.php +++ b/projects/packages/forms/src/contact-form/class-contact-form.php @@ -324,7 +324,7 @@ public static function get_instance_from_jwt( $jwt_token, $throw_exception = fal } // Determine which cipher was used (stored in JWT or default to GCM) - $cipher = isset( $data['cipher'] ) ? $data['cipher'] : 'AES-256-GCM'; + $cipher = isset( $data['cipher'] ) ? $data['cipher'] : 'aes-256-gcm'; // Check if the cipher is available on this server $available_cipher_methods = array_map( 'strtolower', openssl_get_cipher_methods() ); @@ -333,7 +333,7 @@ public static function get_instance_from_jwt( $jwt_token, $throw_exception = fal } // Determine IV and tag sizes based on cipher - $is_gcm = strpos( $cipher, 'GCM' ) !== false; + $is_gcm = stripos( $cipher, 'gcm' ) !== false; if ( $is_gcm ) { // GCM: 12-byte IV + 16-byte tag + ciphertext if ( strlen( $encrypted_blob ) < 29 ) { // 12 + 16 + at least 1 byte @@ -554,23 +554,42 @@ public function get_jwt() { // Content, hash, and source are not sensitive and can remain unencrypted // Check cipher availability with fallback support - $cipher = 'AES-256-GCM'; - $available_cipher_methods = array_map( 'strtolower', openssl_get_cipher_methods() ); + $available_cipher_methods = openssl_get_cipher_methods(); + $cipher = null; + $cipher_fallback = null; $use_encryption = false; $iv_length = 12; // Default for GCM - if ( in_array( strtolower( $cipher ), $available_cipher_methods, true ) ) { - $use_encryption = true; - // IV length already set to 12 (NIST recommended for AES-GCM) - } else { - // Try fallback to AES-256-CBC - $cipher = 'AES-256-CBC'; - if ( in_array( strtolower( $cipher ), $available_cipher_methods, true ) ) { + // Try to find AES-256-GCM first (case-insensitive search) + foreach ( $available_cipher_methods as $method ) { + if ( strtolower( $method ) === 'aes-256-gcm' ) { + $cipher = $method; // Use the actual name with original casing $use_encryption = true; - $iv_length = 16; // 16-byte (128-bit) IV for AES-CBC + // IV length already set to 12 (NIST recommended for AES-GCM) + break; } + // If AES-256-GCM not found, try fallback to AES-256-CBC + if ( strtolower( $method ) === 'aes-256-cbc' ) { + $cipher_fallback = $method; // Use the actual name with original casing + $use_encryption = true; + } + } + + // Use the fallback cipher if the primary cipher is not available. + if ( $cipher === null && $cipher_fallback !== null ) { + $cipher = $cipher_fallback; + $iv_length = 16; // 16-byte (128-bit) IV for AES-CBC } + // Lazy fallback payload in case encryption fails or is unavailable. + $unencrypted_payload = array( + 'attributes' => $attributes, + 'content' => $this->content, + 'hash' => $this->hash, + 'source' => $this->source->serialize(), + // No version field = version 1 (unencrypted) + ); + if ( $use_encryption ) { $iv = random_bytes( $iv_length ); $tag = ''; // Will be populated by openssl_encrypt for GCM @@ -587,11 +606,11 @@ public function get_jwt() { ); if ( $encrypted === false ) { - throw new \Exception( 'Failed to encrypt JWT payload' ); + do_action( 'jetpack_forms_log', 'jwt_encryption_failed', openssl_error_string() ); + return JWT::encode( $unencrypted_payload, $jwt_signing_key ); } - // For GCM, include the authentication tag; for CBC, tag will be empty - $encrypted_blob = strpos( $cipher, 'GCM' ) !== false ? $iv . $tag . $encrypted : $iv . $encrypted; + $encrypted_blob = stripos( $cipher, 'GCM' ) !== false ? $iv . $tag . $encrypted : $iv . $encrypted; return JWT::encode( array( @@ -604,19 +623,10 @@ public function get_jwt() { ), $jwt_signing_key ); - } else { - // No encryption available - fall back to version 1 format (unencrypted) - return JWT::encode( - array( - 'attributes' => $attributes, - 'content' => $this->content, - 'hash' => $this->hash, - 'source' => $this->source->serialize(), - // No version field = version 1 (unencrypted) - ), - $jwt_signing_key - ); } + + // No encryption available - fall back to version 1 format (unencrypted) + return JWT::encode( $unencrypted_payload, $jwt_signing_key ); } /** From 06c5a4ec3e233bcab638752438778ba248b77332 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 4 Dec 2025 09:57:59 -0500 Subject: [PATCH 26/49] Release forms 6.21.2 (#46197) --- projects/packages/forms/CHANGELOG.md | 5 +++++ projects/packages/forms/changelog/fix-forms-jwt-cypher | 4 ---- projects/packages/forms/package.json | 2 +- projects/packages/forms/src/class-jetpack-forms.php | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 projects/packages/forms/changelog/fix-forms-jwt-cypher diff --git a/projects/packages/forms/CHANGELOG.md b/projects/packages/forms/CHANGELOG.md index 8926564d5ffa..94ad1e237a85 100644 --- a/projects/packages/forms/CHANGELOG.md +++ b/projects/packages/forms/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [6.21.2] - 2025-12-04 +### Fixed +- Forms: Use the correct case on cipher names [#46189] + ## [6.21.1] - 2025-12-03 ### Fixed - Fix the flickering between the sidebar loading on different browser widths. @@ -1938,6 +1942,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added a new jetpack/forms package [#28409] - Added a public load_contact_form method for initializing the contact form module. [#28416] +[6.21.2]: https://github.com/automattic/jetpack-forms/compare/v6.21.1...v6.21.2 [6.21.1]: https://github.com/automattic/jetpack-forms/compare/v6.21.0...v6.21.1 [6.21.0]: https://github.com/automattic/jetpack-forms/compare/v6.20.0...v6.21.0 [6.20.0]: https://github.com/automattic/jetpack-forms/compare/v6.19.0...v6.20.0 diff --git a/projects/packages/forms/changelog/fix-forms-jwt-cypher b/projects/packages/forms/changelog/fix-forms-jwt-cypher deleted file mode 100644 index 0da731db9d9b..000000000000 --- a/projects/packages/forms/changelog/fix-forms-jwt-cypher +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Forms: Use the correct case on cipher names diff --git a/projects/packages/forms/package.json b/projects/packages/forms/package.json index 334389c269db..41a447d28ea9 100644 --- a/projects/packages/forms/package.json +++ b/projects/packages/forms/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-forms", - "version": "6.21.1", + "version": "6.21.2", "private": true, "description": "Jetpack Forms", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/forms/#readme", diff --git a/projects/packages/forms/src/class-jetpack-forms.php b/projects/packages/forms/src/class-jetpack-forms.php index 1ae10c4b20b9..5f00ad72750f 100644 --- a/projects/packages/forms/src/class-jetpack-forms.php +++ b/projects/packages/forms/src/class-jetpack-forms.php @@ -14,7 +14,7 @@ */ class Jetpack_Forms { - const PACKAGE_VERSION = '6.21.1'; + const PACKAGE_VERSION = '6.21.2'; /** * Load the contact form module. From d937036262463a2f41b80b9c07b9d6be13e7048f Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 4 Dec 2025 10:33:14 -0500 Subject: [PATCH 27/49] Backport Jetpack 15.3.1 release (#46199) * Bump version to 15.3.1 * Update main changelog * Update readme.txt * Bump readme.txt stable tag in monorepo (won't affect wporg) --------- Co-authored-by: Gergely Juhasz --- projects/plugins/jetpack/CHANGELOG.md | 4 +++- projects/plugins/jetpack/composer.json | 2 +- projects/plugins/jetpack/jetpack.php | 4 ++-- projects/plugins/jetpack/readme.txt | 9 +++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/projects/plugins/jetpack/CHANGELOG.md b/projects/plugins/jetpack/CHANGELOG.md index 5c9edf7c6f01..d9220771b7c1 100644 --- a/projects/plugins/jetpack/CHANGELOG.md +++ b/projects/plugins/jetpack/CHANGELOG.md @@ -2,8 +2,10 @@ ### This is a list detailing changes for all Jetpack releases. -## 15.3 - 2025-12-03 +## 15.3.1 - 2025-12-04 +- Forms: Use the correct case on cipher names. [#46189] +## 15.3 - 2025-12-03 ### Enhancements - Forms: Add browser info to the form response email notification. [#45710] - Forms: Add form response webhook support. [#46059] diff --git a/projects/plugins/jetpack/composer.json b/projects/plugins/jetpack/composer.json index 97871be8879a..646e43342841 100644 --- a/projects/plugins/jetpack/composer.json +++ b/projects/plugins/jetpack/composer.json @@ -111,7 +111,7 @@ "platform": { "ext-intl": "0.0.0" }, - "autoloader-suffix": "f11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ15_3", + "autoloader-suffix": "f11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ15_3_1", "allow-plugins": { "automattic/jetpack-autoloader": true, "automattic/jetpack-composer-plugin": true diff --git a/projects/plugins/jetpack/jetpack.php b/projects/plugins/jetpack/jetpack.php index 54badafadfb5..8b5a662f0b74 100644 --- a/projects/plugins/jetpack/jetpack.php +++ b/projects/plugins/jetpack/jetpack.php @@ -4,7 +4,7 @@ * Plugin URI: https://jetpack.com * Description: Security, performance, and marketing tools made by WordPress experts. Jetpack keeps your site protected so you can focus on more important things. * Author: Automattic - * Version: 15.3 + * Version: 15.3.1 * Author URI: https://jetpack.com * License: GPL2+ * Text Domain: jetpack @@ -38,7 +38,7 @@ if ( ! defined( 'JETPACK__VERSION' ) ) { // This breaks the project version checks when a one-liner. - define( 'JETPACK__VERSION', '15.3' ); + define( 'JETPACK__VERSION', '15.3.1' ); } defined( 'JETPACK__MINIMUM_WP_VERSION' ) || define( 'JETPACK__MINIMUM_WP_VERSION', '6.7' ); defined( 'JETPACK__MINIMUM_PHP_VERSION' ) || define( 'JETPACK__MINIMUM_PHP_VERSION', '7.2' ); diff --git a/projects/plugins/jetpack/readme.txt b/projects/plugins/jetpack/readme.txt index 6f548e92374a..1e5ab9b94f12 100644 --- a/projects/plugins/jetpack/readme.txt +++ b/projects/plugins/jetpack/readme.txt @@ -1,7 +1,7 @@ === Jetpack - WP Security, Backup, Speed, & Growth === Contributors: automattic, adamkheckler, adrianmoldovanwp, aduth, akirk, allendav, alternatekev, andy, annamcphee, annezazu, apeatling, arcangelini, arsihasi, azaozz, barry, batmoo, beaulebens, bindlegirl, biskobe, bjorsch, blobaugh, brbrr, brileyhooper, cainm, cena, cfinke, cgastrell, chaselivingston, chellycat, clickysteve, csonnek, danielbachhuber, daniloercoli, davoraltman, delawski, designsimply, dkmyta, dllh, drawmyface, dsmart, dun2mis, dzver, ebinnion, egregor, eliorivero, enej, eoigal, erania-pinnera, ethitter, fgiannar, gcorne, georgestephanis, gibrown, goldsounds, hew, hugobaeta, hypertextranch, iammattthomas, iandunn, joen, jblz, jeffgolenski, jeherve, jenhooks, jenia, jessefriedman, jgs, jkudish, jmdodd, joanrho, johnjamesjacoby, jshreve, kbrownkd, keoshi, koke, kraftbj, lancewillett, leogermani, lhkowalski, lschuyler, macmanx, martinremy, matt, mattwiebe, matveb, maverick3x6, mcsf, mdawaffe, mdbitz, MichaelArestad, migueluy, miguelxavierpenha, mikeyarce, mkaz, nancythanki, nickmomrik, njweller, nunyvega, obenland, oskosk, pento, professor44, rachelsquirrel, rdcoll, renatoagds, retrofox, richardmtl, richardmuscat, robertbpugh, roccotripaldi, ryancowles, samhotchkiss, samiff, scarstocea, scottsweb, sdixon194, sdquirk, sermitr, simison, stephdau, thehenridev, tmoorewp, tyxla, Viper007Bond, westi, williamvianas, wpkaren, yoavf, zinigor Tags: Security, backup, malware, scan, performance -Stable tag: 15.3 +Stable tag: 15.3.1 Requires at least: 6.7 Requires PHP: 7.2 Tested up to: 6.9 @@ -326,10 +326,11 @@ Jetpack Backup can do a full website migration to a new host, migrate theme file == Changelog == -### 15.3 - 2025-12-03 - -Incorrectly tagged without releasing new versions of Jetpack Forms. 15.3-beta.3 was created immediately to fix the issue. +### 15.3.1 - 2025-12-04 +#### Bug fixes +- Forms: Use the correct case on cipher names. +### 15.3 - 2025-12-03 #### Enhancements - Forms: Add browser info to the form response email notification. - Forms: Add form response webhook support. From 29ca52757862b689501335c95a88b02d036e6334 Mon Sep 17 00:00:00 2001 From: Automattic Bot Date: Thu, 4 Dec 2025 16:45:45 +0100 Subject: [PATCH 28/49] phan: Update custom stubs (#46191) Co-authored-by: matticbot --- .phan/stubs/gutenberg-stubs.php | 2 +- .phan/stubs/woocommerce-internal-stubs.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.phan/stubs/gutenberg-stubs.php b/.phan/stubs/gutenberg-stubs.php index 6aa76f808752..edc589a818b7 100644 --- a/.phan/stubs/gutenberg-stubs.php +++ b/.phan/stubs/gutenberg-stubs.php @@ -1,6 +1,6 @@ Date: Thu, 4 Dec 2025 16:46:36 +0100 Subject: [PATCH 29/49] Forms: Decode HTML entities in CSV exports (#46178) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Forms: Decode HTML entities in CSV exports Fixes FORMS-439 When exporting form responses to CSV, form names containing HTML entities (like – for em dash) were not being decoded, appearing as-is in the exported file instead of the actual characters. This fix decodes HTML entities in two places: 1. In Util::get_export_filename() - for the CSV filename 2. In Contact_Form when setting entry_title - for the CSV data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude * Forms: Decode HTML entities in feedback source title Fixes issue where HTML entities like – (en dash) appear in CSV exports. The issue was that get_the_title() and post_title can contain HTML-encoded characters, which then appear in the CSV "Title" column. By decoding them when the Feedback_Source is created, the actual characters are stored and exported correctly. --------- Co-authored-by: Claude --- .../forms/changelog/fix-forms-html-entities-csv-export | 4 ++++ .../packages/forms/src/contact-form/class-contact-form.php | 2 +- .../forms/src/contact-form/class-feedback-source.php | 6 +++--- projects/packages/forms/src/contact-form/class-util.php | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 projects/packages/forms/changelog/fix-forms-html-entities-csv-export diff --git a/projects/packages/forms/changelog/fix-forms-html-entities-csv-export b/projects/packages/forms/changelog/fix-forms-html-entities-csv-export new file mode 100644 index 000000000000..6b5e7034bf9a --- /dev/null +++ b/projects/packages/forms/changelog/fix-forms-html-entities-csv-export @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Forms: Decode HTML entities in exported form names to prevent codes like – appearing in CSV exports diff --git a/projects/packages/forms/src/contact-form/class-contact-form.php b/projects/packages/forms/src/contact-form/class-contact-form.php index 36adcdbc2087..1bfa69dd9768 100644 --- a/projects/packages/forms/src/contact-form/class-contact-form.php +++ b/projects/packages/forms/src/contact-form/class-contact-form.php @@ -388,7 +388,7 @@ public static function get_instance_from_jwt( $jwt_token, $throw_exception = fal // create a fallback source $source = array( 'source_id' => $post->ID, - 'entry_title' => $post->post_title, + 'entry_title' => html_entity_decode( $post->post_title, ENT_QUOTES | ENT_HTML5, 'UTF-8' ), 'entry_page' => 1, 'source_type' => 'single', 'request_url' => get_permalink( $post ), diff --git a/projects/packages/forms/src/contact-form/class-feedback-source.php b/projects/packages/forms/src/contact-form/class-feedback-source.php index f84ef4c675b9..1cadc4a7097b 100644 --- a/projects/packages/forms/src/contact-form/class-feedback-source.php +++ b/projects/packages/forms/src/contact-form/class-feedback-source.php @@ -81,7 +81,7 @@ public function __construct( $id = 0, $title = '', $page_number = 1, $source_typ $this->page_number = 1; } - $this->title = $title; + $this->title = html_entity_decode( $title, ENT_QUOTES | ENT_HTML5, 'UTF-8' ); $this->permalink = empty( $request_url ) ? home_url() : $request_url; $this->source_type = $source_type; // possible source types: single, widget, block_template, block_template_part $this->request_url = $request_url; @@ -90,7 +90,7 @@ public function __construct( $id = 0, $title = '', $page_number = 1, $source_typ $entry_post = get_post( (int) $id ); if ( $entry_post && $entry_post->post_status === 'publish' ) { $this->permalink = get_permalink( $entry_post ); - $this->title = get_the_title( $entry_post ); + $this->title = html_entity_decode( get_the_title( $entry_post ), ENT_QUOTES | ENT_HTML5, 'UTF-8' ); } elseif ( $entry_post ) { $this->permalink = ''; @@ -121,7 +121,7 @@ public static function from_submission( $current_post, int $current_page_number return new self( 0, '', $current_page_number ); } - $title = $current_post->post_title ?? __( '(no title)', 'jetpack-forms' ); + $title = isset( $current_post->post_title ) ? html_entity_decode( $current_post->post_title, ENT_QUOTES | ENT_HTML5, 'UTF-8' ) : __( '(no title)', 'jetpack-forms' ); return new self( $id, $title, $current_page_number ); } diff --git a/projects/packages/forms/src/contact-form/class-util.php b/projects/packages/forms/src/contact-form/class-util.php index ffa1f5d75ad5..a9a468843040 100644 --- a/projects/packages/forms/src/contact-form/class-util.php +++ b/projects/packages/forms/src/contact-form/class-util.php @@ -456,7 +456,7 @@ public static function get_export_filename( $source = '' ) { /* translators: 1: Site title; 2: post title. Used to craft the export filename, eg "MySite - Jetpack Form Responses - Contact" */ __( '%1$s - Jetpack Form Responses - %2$s', 'jetpack-forms' ), sanitize_file_name( get_bloginfo( 'name' ) ), - sanitize_file_name( $source ) + sanitize_file_name( html_entity_decode( $source, ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ) ); } } From 4c51593941ed7f1b94dc302d4ae89ed1c17d894e Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 4 Dec 2025 10:57:44 -0500 Subject: [PATCH 30/49] eslint-changed: More path fixing (#46180) Following up #46064, the `--diff-only` option also needs some work to work right when absolute paths or subdir paths are used. Also, on Windows apparently `git` needs forward-slashed paths while `path` produces backslashes. Try to fix that to fix #46163. --- .../try-eslint-changed-fix-paths-on-windows | 4 + .../try-eslint-changed-fix-paths-on-windows#2 | 4 + .../js-packages/eslint-changed/src/cli.js | 15 +- .../eslint-changed/tests/cli.test.js | 194 ++++++++++++++++++ 4 files changed, 214 insertions(+), 3 deletions(-) create mode 100644 projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows create mode 100644 projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows#2 diff --git a/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows b/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows new file mode 100644 index 000000000000..d5773db42186 --- /dev/null +++ b/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Do the right thing for `--git --diff-only` and input paths not relative to the repo root. diff --git a/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows#2 b/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows#2 new file mode 100644 index 000000000000..a97c3c9bd4d1 --- /dev/null +++ b/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows#2 @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Try accounting for forward-slash vs backslash paths on Windows. diff --git a/projects/js-packages/eslint-changed/src/cli.js b/projects/js-packages/eslint-changed/src/cli.js index beeb3900eb63..fd0f8bfdd1d5 100755 --- a/projects/js-packages/eslint-changed/src/cli.js +++ b/projects/js-packages/eslint-changed/src/cli.js @@ -220,14 +220,23 @@ async function main( process, argv, program ) { debug( 'Running git diff command:', git, args.join( ' ' ) ); diff = parseDiff( doCmd( git, args ) ); + + let argfiles = program.args.map( p => + path.relative( diffBase, path.resolve( process.cwd(), p ) ) + ); + // Avoid problems on Windows, git wants forward-slashes while path uses backslashes there. + if ( argfiles.length && path.sep !== path.posix.sep ) { + argfiles = argfiles.map( f => f.replaceAll( path.sep, path.posix.sep ) ); + } + if ( ! argv.inDiffOnly && program.args.length ) { - files = program.args.map( p => path.relative( diffBase, path.resolve( process.cwd(), p ) ) ); + files = argfiles; debug( 'Determined files from command line:', files ); } else { files = getFilesFromDiff( diff ); debug( 'Determined files from diff:', files ); - if ( program.args.length ) { - const cmdLineFiles = new Set( program.args ); + if ( argfiles.length ) { + const cmdLineFiles = new Set( argfiles ); files = files.filter( file => cmdLineFiles.has( file ) ); debug( 'Intersected files with those from the command line:', files ); } diff --git a/projects/js-packages/eslint-changed/tests/cli.test.js b/projects/js-packages/eslint-changed/tests/cli.test.js index 455d785451ac..20d301d58b25 100644 --- a/projects/js-packages/eslint-changed/tests/cli.test.js +++ b/projects/js-packages/eslint-changed/tests/cli.test.js @@ -1067,6 +1067,83 @@ describe( 'bin/eslint-changed.js', () => { expect( output ).toEqual( expectOutput ); } ); + test( 'Works with --in-diff-only and filtered files with full paths', async () => { + await mktmpdirgit( + [ + { + files: { + 'eslint.config.mjs': eslintconfig, + '1.js': "var x = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + '2.js': "var x = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + '3.js': "var x = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + }, + }, + ], + { + '2.js': "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + '3.js': "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + } + ); + + const data = await runEslintChanged( + [ + '--format=json', + '--git', + '--in-diff-only', + path.join( tmpdir, '1.js' ), + path.join( tmpdir, '2.js' ), + ], + { + cwd: tmpdir, + } + ); + expect( data.exitCode ).toBe( 1 ); + + expect( data.stdout ).toBeValidJSON(); + const output = JSON.parse( data.stdout ); + expect( output ).toBeInstanceOf( Array ); + const expectOutput = [ + { + filePath: path.join( tmpdir, '2.js' ), + messages: [ + { + ruleId: 'no-unused-vars', + severity: 2, + message: "'y' is assigned a value but never used.", + line: 1, + column: 5, + nodeType: 'Identifier', + messageId: 'unusedVar', + endLine: 1, + endColumn: 6, + suggestions: [ + { + data: { + varName: 'y', + }, + desc: "Remove unused variable 'y'.", + fix: { + range: [ 0, 24 ], + text: '', + }, + messageId: 'removeVar', + }, + ], + }, + ], + errorCount: 1, + fatalErrorCount: 0, + warningCount: 0, + fixableErrorCount: 0, + fixableWarningCount: 0, + source: "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + suppressedMessages: [], + usedDeprecatedRules, + }, + ]; + expect( output ).toEqual( expectOutput ); + } ); + test( 'Works when run from a subdirectory', async () => { await mktmpdirgit( [ @@ -1236,6 +1313,123 @@ describe( 'bin/eslint-changed.js', () => { expect( output ).toEqual( expectOutput ); } ); + test( 'Works with --in-diff-only when run from a subdirectory', async () => { + await mktmpdirgit( + [ + { + files: { + 'eslint.config.mjs': eslintconfig, + 'x/1.js': "var x = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + 'x/2.js': "var x = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + 'x/3.js': "var x = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + 'x/4.js': "var x = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + }, + }, + ], + { + 'x/2.js': "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + 'x/3.js': "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + 'x/4.js': "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + } + ); + + const data = await runEslintChanged( + [ + '--format=json', + '--git', + '--in-diff-only', + '1.js', + '2.js', + path.join( tmpdir, 'x/4.js' ), + ], + { + cwd: path.join( tmpdir, 'x' ), + } + ); + expect( data.exitCode ).toBe( 1 ); + + expect( data.stdout ).toBeValidJSON(); + const output = JSON.parse( data.stdout ); + expect( output ).toBeInstanceOf( Array ); + const expectOutput = [ + { + filePath: path.join( tmpdir, 'x/2.js' ), + messages: [ + { + ruleId: 'no-unused-vars', + severity: 2, + message: "'y' is assigned a value but never used.", + line: 1, + column: 5, + nodeType: 'Identifier', + messageId: 'unusedVar', + endLine: 1, + endColumn: 6, + suggestions: [ + { + data: { + varName: 'y', + }, + desc: "Remove unused variable 'y'.", + fix: { + range: [ 0, 24 ], + text: '', + }, + messageId: 'removeVar', + }, + ], + }, + ], + errorCount: 1, + fatalErrorCount: 0, + warningCount: 0, + fixableErrorCount: 0, + fixableWarningCount: 0, + source: "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + suppressedMessages: [], + usedDeprecatedRules, + }, + { + filePath: path.join( tmpdir, 'x/4.js' ), + messages: [ + { + ruleId: 'no-unused-vars', + severity: 2, + message: "'y' is assigned a value but never used.", + line: 1, + column: 5, + nodeType: 'Identifier', + messageId: 'unusedVar', + endLine: 1, + endColumn: 6, + suggestions: [ + { + data: { + varName: 'y', + }, + desc: "Remove unused variable 'y'.", + fix: { + range: [ 0, 24 ], + text: '', + }, + messageId: 'removeVar', + }, + ], + }, + ], + errorCount: 1, + fatalErrorCount: 0, + warningCount: 0, + fixableErrorCount: 0, + fixableWarningCount: 0, + source: "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n", + suppressedMessages: [], + usedDeprecatedRules, + }, + ]; + expect( output ).toEqual( expectOutput ); + } ); + describe( '--eslint-options works', () => { const eslintOptionsRepo = [ [ From ba65bac80ccb8353efa7b53219bbf4b76add45b0 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 4 Dec 2025 11:21:21 -0500 Subject: [PATCH 31/49] Release eslint-changed 2.1.5 (#46200) --- projects/js-packages/eslint-changed/CHANGELOG.md | 6 ++++++ .../eslint-changed/changelog/renovate-eslint-packages | 5 ----- .../changelog/try-eslint-changed-fix-paths-on-windows | 4 ---- .../changelog/try-eslint-changed-fix-paths-on-windows#2 | 4 ---- projects/js-packages/eslint-changed/package.json | 2 +- projects/js-packages/eslint-changed/src/cli.js | 2 +- projects/packages/changelogger/CHANGELOG.md | 5 +++++ .../changelogger/changelog/fix-audit_json_encode_flags | 4 ---- .../changelog/fix-changelogger-symfony-console-add | 5 ----- projects/packages/changelogger/src/Application.php | 2 +- 10 files changed, 14 insertions(+), 25 deletions(-) delete mode 100644 projects/js-packages/eslint-changed/changelog/renovate-eslint-packages delete mode 100644 projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows delete mode 100644 projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows#2 delete mode 100644 projects/packages/changelogger/changelog/fix-audit_json_encode_flags delete mode 100644 projects/packages/changelogger/changelog/fix-changelogger-symfony-console-add diff --git a/projects/js-packages/eslint-changed/CHANGELOG.md b/projects/js-packages/eslint-changed/CHANGELOG.md index fb193f473ef0..30db3461b466 100644 --- a/projects/js-packages/eslint-changed/CHANGELOG.md +++ b/projects/js-packages/eslint-changed/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.1.5] - 2025-12-04 +### Fixed +- Do the right thing for `--git --diff-only` and input paths not relative to the repo root. [#46180] +- Try accounting for forward-slash vs backslash paths on Windows. [#46180] + ## [2.1.4] - 2025-11-25 ### Changed - Update package dependencies. [#45590] [#45958] @@ -114,6 +119,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Created as a tool within the monorepo. +[2.1.5]: https://github.com/Automattic/eslint-changed/compare/2.1.4...2.1.5 [2.1.4]: https://github.com/Automattic/eslint-changed/compare/2.1.3...2.1.4 [2.1.3]: https://github.com/Automattic/eslint-changed/compare/2.1.2...2.1.3 [2.1.2]: https://github.com/Automattic/eslint-changed/compare/2.1.1...2.1.2 diff --git a/projects/js-packages/eslint-changed/changelog/renovate-eslint-packages b/projects/js-packages/eslint-changed/changelog/renovate-eslint-packages deleted file mode 100644 index f2479b2800fa..000000000000 --- a/projects/js-packages/eslint-changed/changelog/renovate-eslint-packages +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: New eslint sniff wants all peer deps to also be dev deps. Do that, even though we get eslint from the monorepo root. - - diff --git a/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows b/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows deleted file mode 100644 index d5773db42186..000000000000 --- a/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Do the right thing for `--git --diff-only` and input paths not relative to the repo root. diff --git a/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows#2 b/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows#2 deleted file mode 100644 index a97c3c9bd4d1..000000000000 --- a/projects/js-packages/eslint-changed/changelog/try-eslint-changed-fix-paths-on-windows#2 +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Try accounting for forward-slash vs backslash paths on Windows. diff --git a/projects/js-packages/eslint-changed/package.json b/projects/js-packages/eslint-changed/package.json index 6e607c741e56..db9df2c81067 100644 --- a/projects/js-packages/eslint-changed/package.json +++ b/projects/js-packages/eslint-changed/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/eslint-changed", - "version": "2.1.4", + "version": "2.1.5", "description": "Run eslint on files, but only report warnings and errors from lines that were changed.", "keywords": [ "eslint", diff --git a/projects/js-packages/eslint-changed/src/cli.js b/projects/js-packages/eslint-changed/src/cli.js index fd0f8bfdd1d5..110f73e373fd 100755 --- a/projects/js-packages/eslint-changed/src/cli.js +++ b/projects/js-packages/eslint-changed/src/cli.js @@ -7,7 +7,7 @@ import { Command } from 'commander'; import * as ESLintPkg from 'eslint'; import parseDiff from 'parse-diff'; -const APP_VERSION = '2.1.4'; +const APP_VERSION = '2.1.5'; const { ESLint } = ESLintPkg; const loadESLint = ESLintPkg.loadESLint ?? ( () => ESLint ); diff --git a/projects/packages/changelogger/CHANGELOG.md b/projects/packages/changelogger/CHANGELOG.md index 4d91d36e7cd5..82b3f9dfea41 100644 --- a/projects/packages/changelogger/CHANGELOG.md +++ b/projects/packages/changelogger/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [6.0.11] - 2025-12-04 +### Fixed +- Ensure proper flags are used with `json_encode()`. [#46092] + ## [6.0.10] - 2025-12-01 ### Changed - Update tests to use addCommand() instead of deprecated add() method. [#46126] @@ -307,6 +311,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added - Initial version. +[6.0.11]: https://github.com/Automattic/jetpack-changelogger/compare/6.0.10...6.0.11 [6.0.10]: https://github.com/Automattic/jetpack-changelogger/compare/6.0.9...6.0.10 [6.0.9]: https://github.com/Automattic/jetpack-changelogger/compare/6.0.8...6.0.9 [6.0.8]: https://github.com/Automattic/jetpack-changelogger/compare/6.0.7...6.0.8 diff --git a/projects/packages/changelogger/changelog/fix-audit_json_encode_flags b/projects/packages/changelogger/changelog/fix-audit_json_encode_flags deleted file mode 100644 index f140a52a9274..000000000000 --- a/projects/packages/changelogger/changelog/fix-audit_json_encode_flags +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fixed - -Ensure proper flags are used with `json_encode()`. diff --git a/projects/packages/changelogger/changelog/fix-changelogger-symfony-console-add b/projects/packages/changelogger/changelog/fix-changelogger-symfony-console-add deleted file mode 100644 index 2e1ed035081a..000000000000 --- a/projects/packages/changelogger/changelog/fix-changelogger-symfony-console-add +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fixed -Comment: Actually update tests to use addCommand() instead of deprecated add() method - - diff --git a/projects/packages/changelogger/src/Application.php b/projects/packages/changelogger/src/Application.php index f639ec3b8256..278de6f6130d 100644 --- a/projects/packages/changelogger/src/Application.php +++ b/projects/packages/changelogger/src/Application.php @@ -19,7 +19,7 @@ */ class Application extends SymfonyApplication { - const VERSION = '6.0.10'; + const VERSION = '6.0.11'; /** * Constructor. From 389e3851b2b395785e8fbfea20eaa209d1582e96 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Thu, 4 Dec 2025 09:28:31 -0700 Subject: [PATCH 32/49] Plugins: Ensure proper flags are used with json_encode() (#46117) This is a best-effort application of proper flags for `json_encode()` and `wp_json_encode()`. It also includes some cleanup of PHP 5.2 compatibility (`JSON.parse(decodeURIComponent())`), which was a workaround for when the flags we now use did not exist. --- .../fix-audit_json_encode_flags_part_trois | 4 ++ .../class-automattic-for-agencies-client.php | 2 +- projects/plugins/boost/app/lib/class-cli.php | 4 +- .../boost/app/lib/minify/class-utils.php | 12 +++--- .../lib/minify/functions-service-fallback.php | 2 +- .../cloud-css/class-cloud-css.php | 7 +++- .../optimizations/lcp/class-lcp-analyzer.php | 7 +++- .../class-boost-cache-settings.php | 5 ++- .../pre-wordpress/class-filesystem-utils.php | 7 +++- .../page-cache/pre-wordpress/class-logger.php | 3 +- .../fix-audit_json_encode_flags_part_trois | 4 ++ .../e2e/plugins/e2e-mock-speed-score-api.php | 2 +- .../page-cache/Filesystem_Utils_Test.php | 1 - .../fix-audit_json_encode_flags_part_trois | 4 ++ .../src/class-classic-theme-helper-plugin.php | 2 +- .../fix-audit_json_encode_flags_part_trois | 4 ++ .../modules/class-xmlrpc-logger.php | 4 +- projects/plugins/inspect/app/Log.php | 2 +- .../fix-audit_json_encode_flags_part_trois | 4 ++ .../class-jetpack-search-debug-bar.php | 4 +- .../jetpack/_inc/class.jetpack-provision.php | 2 +- .../admin-pages/class.jetpack-react-page.php | 2 +- .../_inc/lib/class-jetpack-ai-helper.php | 6 ++- .../lib/class.core-rest-api-endpoints.php | 17 +++++---- .../class.jetpack-core-api-site-endpoints.php | 2 +- .../lib/debugger/class-jetpack-debug-data.php | 10 ++--- projects/plugins/jetpack/_inc/lib/widgets.php | 2 +- .../fix-audit_json_encode_flags_part_trois | 4 ++ .../plugins/jetpack/class.jetpack-cli.php | 30 ++++++++------- projects/plugins/jetpack/class.jetpack.php | 17 ++++----- .../jetpack/class.json-api-endpoints.php | 2 +- projects/plugins/jetpack/class.json-api.php | 11 ++++-- .../extensions/blocks/ai-chat/ai-chat.php | 2 +- .../extensions/blocks/donations/donations.php | 2 +- .../jetpack/extensions/blocks/map/map.php | 6 +-- .../blocks/podcast-player/podcast-player.php | 2 +- .../_inc/subscription-service/class-jwt.php | 2 +- .../jetpack/extensions/blocks/story/story.php | 2 +- ...ry__story-with-images.server-rendered.html | 4 +- ...ory__story-with-video.server-rendered.html | 4 +- ...story-with-videopress.server-rendered.html | 4 +- .../modules/carousel/jetpack-carousel.php | 35 ++++++++--------- .../jetpack/modules/comments/comments.php | 6 +-- .../current/load-google-fonts.php | 2 +- .../modules/infinite-scroll/infinity.php | 10 ++--- projects/plugins/jetpack/modules/notes.php | 4 +- .../modules/sharedaddy/sharing-service.php | 2 +- .../modules/shortcodes/crowdsignal.php | 11 +++--- .../jetpack/modules/shortcodes/flickr.php | 2 +- .../jetpack/modules/shortcodes/mailchimp.php | 2 +- projects/plugins/jetpack/modules/stats.php | 8 ++-- ...ss-jetpack-newsletter-dashboard-widget.php | 2 +- .../class-videopress-attachment-metadata.php | 2 +- .../videopress/class.videopress-player.php | 22 +++++------ .../jetpack/modules/widgets/follow-button.php | 2 +- ...ss-jetpack-woocommerce-analytics-trait.php | 8 +--- .../jetpack/modules/wordads/class-wordads.php | 2 +- .../php/class-wordads-california-privacy.php | 2 +- .../plugins/jetpack/src/class-deprecate.php | 2 +- .../jetpack/tests/php/Block_Manifest_Test.php | 6 ++- .../lib/Jetpack_REST_API_endpoints_Test.php | 2 +- ...ST_API_V2_Endpoint_External_Media_Test.php | 9 +++-- ..._REST_API_V2_Endpoint_Memberships_Test.php | 38 +++++++++---------- ...N_API_Site_Settings_V1_4_Endpoint_Test.php | 2 +- .../post-by-email/Post_By_Email_API_Test.php | 2 +- .../php/modules/publicize/Publicize_Test.php | 4 +- .../sharedaddy/Jetpack_ReCaptcha_Test.php | 7 ++-- .../Jetpack_Shortcodes_CrowdSignal_Test.php | 6 +-- .../Jetpack_Shortcodes_Flickr_Test.php | 2 +- .../Jetpack_Shortcodes_Gravatar_Test.php | 6 ++- .../Jetpack_Shortcodes_Instagram_Test.php | 4 +- .../Jetpack_Shortcodes_Mixcloud_Test.php | 4 +- .../Jetpack_Display_Posts_Widget_Test.php | 6 ++- .../tests/php/sync/Jetpack_Sync_Full_Test.php | 3 +- .../php/sync/Jetpack_Sync_Functions_Test.php | 2 +- .../tests/php/sync/Jetpack_Sync_Meta_Test.php | 2 +- .../php/sync/Jetpack_Sync_Options_Test.php | 4 +- .../tests/php/sync/Jetpack_Sync_TestBase.php | 14 ++++--- .../fix-audit_json_encode_flags_part_trois | 4 ++ .../protect/src/class-jetpack-protect.php | 2 +- .../plugins/protect/src/class-threats.php | 5 ++- .../fix-audit_json_encode_flags_part_trois | 4 ++ .../src/class-jetpack-starter-plugin.php | 2 +- .../fix-audit_json_encode_flags_part_trois | 4 ++ .../plugins/super-cache/wp-cache-phase2.php | 6 +-- projects/plugins/super-cache/wp-cache.php | 4 +- .../fix-audit_json_encode_flags_part_trois | 4 ++ projects/plugins/vaultpress/vaultpress.php | 4 +- .../fix-audit_json_encode_flags_part_trois | 4 ++ .../wpcomsh/class-wpcomsh-cli-commands.php | 14 +++---- .../plugins/wpcomsh/class-wpcomsh-log.php | 2 +- .../feature-plugins/full-site-editing.php | 3 +- ...ass-atomic-record-jetpack-token-errors.php | 2 +- .../notices/anyone-can-register-notice.php | 4 +- ...class-wp-privacy-participating-plugins.php | 10 ++--- .../access-denied-preview-login-template.php | 4 +- .../tests/FeaturedImageInEmailTest.php | 9 +++-- .../wpcomsh/tests/FrontendNoticesTest.php | 20 +++++----- .../plugins/wpcomsh/tests/PlanNoticesTest.php | 2 +- .../wpcomsh/tests/WpcomFeaturesTest.php | 2 +- .../tests/feature-manager/FeatureHookTest.php | 4 +- .../class-wpcom-widget-reservations.php | 8 ++-- projects/plugins/wpcomsh/wpcomsh.php | 4 +- 103 files changed, 342 insertions(+), 253 deletions(-) create mode 100644 projects/plugins/automattic-for-agencies-client/changelog/fix-audit_json_encode_flags_part_trois create mode 100644 projects/plugins/boost/changelog/fix-audit_json_encode_flags_part_trois create mode 100644 projects/plugins/classic-theme-helper-plugin/changelog/fix-audit_json_encode_flags_part_trois create mode 100644 projects/plugins/debug-helper/changelog/fix-audit_json_encode_flags_part_trois create mode 100644 projects/plugins/inspect/changelog/fix-audit_json_encode_flags_part_trois create mode 100644 projects/plugins/jetpack/changelog/fix-audit_json_encode_flags_part_trois create mode 100644 projects/plugins/protect/changelog/fix-audit_json_encode_flags_part_trois create mode 100644 projects/plugins/starter-plugin/changelog/fix-audit_json_encode_flags_part_trois create mode 100644 projects/plugins/super-cache/changelog/fix-audit_json_encode_flags_part_trois create mode 100644 projects/plugins/vaultpress/changelog/fix-audit_json_encode_flags_part_trois create mode 100644 projects/plugins/wpcomsh/changelog/fix-audit_json_encode_flags_part_trois diff --git a/projects/plugins/automattic-for-agencies-client/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/automattic-for-agencies-client/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/plugins/automattic-for-agencies-client/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/automattic-for-agencies-client/src/class-automattic-for-agencies-client.php b/projects/plugins/automattic-for-agencies-client/src/class-automattic-for-agencies-client.php index 2ce6571b1aa4..718b13a71609 100644 --- a/projects/plugins/automattic-for-agencies-client/src/class-automattic-for-agencies-client.php +++ b/projects/plugins/automattic-for-agencies-client/src/class-automattic-for-agencies-client.php @@ -125,7 +125,7 @@ public static function enqueue_admin_scripts() { * @return string */ private static function render_initial_state() { - return 'var automatticForAgenciesClientInitialState=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( static::initial_state() ) ) . '"));'; + return 'var automatticForAgenciesClientInitialState=' . wp_json_encode( static::initial_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } /** diff --git a/projects/plugins/boost/app/lib/class-cli.php b/projects/plugins/boost/app/lib/class-cli.php index 902e60477828..494018c197ec 100644 --- a/projects/plugins/boost/app/lib/class-cli.php +++ b/projects/plugins/boost/app/lib/class-cli.php @@ -68,13 +68,13 @@ public function module( $args ) { if ( $module_slug === null ) { /* translators: Placeholder is list of available modules. */ - \WP_CLI::error( sprintf( __( 'Please specify a valid module. It should be one of %s', 'jetpack-boost' ), wp_json_encode( self::MAKE_E2E_TESTS_WORK_MODULES ) ) ); + \WP_CLI::error( sprintf( __( 'Please specify a valid module. It should be one of %s', 'jetpack-boost' ), wp_json_encode( self::MAKE_E2E_TESTS_WORK_MODULES, JSON_UNESCAPED_SLASHES ) ) ); } if ( ! in_array( $module_slug, self::MAKE_E2E_TESTS_WORK_MODULES, true ) ) { \WP_CLI::error( /* translators: %1$s refers to the module slug like 'critical-css', %2$s is the list of available modules. */ - sprintf( __( "The '%1\$s' module slug is invalid. It should be one of %2\$s", 'jetpack-boost' ), $module_slug, wp_json_encode( self::MAKE_E2E_TESTS_WORK_MODULES ) ) + sprintf( __( "The '%1\$s' module slug is invalid. It should be one of %2\$s", 'jetpack-boost' ), $module_slug, wp_json_encode( self::MAKE_E2E_TESTS_WORK_MODULES, JSON_UNESCAPED_SLASHES ) ) ); } diff --git a/projects/plugins/boost/app/lib/minify/class-utils.php b/projects/plugins/boost/app/lib/minify/class-utils.php index d6983405a71e..38a30c3aea98 100644 --- a/projects/plugins/boost/app/lib/minify/class-utils.php +++ b/projects/plugins/boost/app/lib/minify/class-utils.php @@ -23,17 +23,19 @@ public function __construct( $use_wp = true ) { /** * Encodes a value to JSON. * - * @param mixed $value The value to encode. + * @param mixed $value The value to encode. + * @param int $flags Options to be passed to json_encode(). Default 0. + * @param int $depth Maximum depth to walk through $value. Must be greater than 0. * - * @return string The JSON-encoded string. + * @return string|false The JSON-encoded string, or false on failure. */ - public function json_encode( $value ) { + public function json_encode( $value, $flags = 0, $depth = 512 ) { if ( $this->use_wp ) { - return wp_json_encode( $value ); + return wp_json_encode( $value, $flags, $depth ); } // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode - return json_encode( $value ); + return json_encode( $value, $flags, $depth ); } /** diff --git a/projects/plugins/boost/app/lib/minify/functions-service-fallback.php b/projects/plugins/boost/app/lib/minify/functions-service-fallback.php index 8e0873a50990..b5b53cb1c428 100644 --- a/projects/plugins/boost/app/lib/minify/functions-service-fallback.php +++ b/projects/plugins/boost/app/lib/minify/functions-service-fallback.php @@ -98,7 +98,7 @@ function jetpack_boost_page_optimize_service_request() { // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents file_put_contents( $cache_file, $content ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents - file_put_contents( $cache_file_meta, wp_json_encode( array( 'headers' => $headers ) ) ); + file_put_contents( $cache_file_meta, wp_json_encode( array( 'headers' => $headers ), JSON_UNESCAPED_SLASHES ) ); } die( 0 ); diff --git a/projects/plugins/boost/app/modules/optimizations/cloud-css/class-cloud-css.php b/projects/plugins/boost/app/modules/optimizations/cloud-css/class-cloud-css.php index 0526e120e749..36576d6194a7 100644 --- a/projects/plugins/boost/app/modules/optimizations/cloud-css/class-cloud-css.php +++ b/projects/plugins/boost/app/modules/optimizations/cloud-css/class-cloud-css.php @@ -172,7 +172,12 @@ public function generate_cloud_css( $reason, $providers = array() ) { 'providers' => $grouped_urls, 'successRatios' => $grouped_ratios, ); - $payload['requestId'] = md5( wp_json_encode( $payload ) . time() ); + $payload['requestId'] = md5( + wp_json_encode( + $payload, + 0 // No `json_encode()` flags because this needs to match whatever is calculating the hash on the other end. + ) . time() + ); $payload['reason'] = $reason; return Boost_API::post( 'cloud-css', $payload ); } diff --git a/projects/plugins/boost/app/modules/optimizations/lcp/class-lcp-analyzer.php b/projects/plugins/boost/app/modules/optimizations/lcp/class-lcp-analyzer.php index 01b6df71326d..88ba0ba0679c 100644 --- a/projects/plugins/boost/app/modules/optimizations/lcp/class-lcp-analyzer.php +++ b/projects/plugins/boost/app/modules/optimizations/lcp/class-lcp-analyzer.php @@ -97,7 +97,12 @@ protected function get_cornerstone_pages() { private function analyze_pages( $pages ) { $payload = array( 'pages' => $pages, - 'requestId' => md5( wp_json_encode( $pages ) ), + 'requestId' => md5( + wp_json_encode( + $pages, + 0 // No `json_encode()` flags because this needs to match whatever is calculating the hash on the other end. + ) + ), ); return Boost_API::post( 'lcp', $payload ); } diff --git a/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-boost-cache-settings.php b/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-boost-cache-settings.php index 7c61e47205a8..0a0dc8fceb25 100644 --- a/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-boost-cache-settings.php +++ b/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-boost-cache-settings.php @@ -182,7 +182,10 @@ public function set( $settings ) { $this->settings = array_merge( $this->settings, $settings ); - $contents = "settings ) . "\n */"; // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode + $contents = "settings, + JSON_HEX_TAG // Need to escape slashes because this is, for some reason, going into a PHP comment and we need to guard against `*/`. + ) . "\n */"; $result = Filesystem_Utils::write_to_file( $this->config_file, $contents ); if ( $result instanceof Boost_Cache_Error ) { Logger::debug( $result->get_error_message() ); diff --git a/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-filesystem-utils.php b/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-filesystem-utils.php index a3b6cf3091a5..d6a427e6e123 100644 --- a/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-filesystem-utils.php +++ b/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-filesystem-utils.php @@ -124,7 +124,12 @@ public static function get_request_filename( $parameters ) { */ $key_components = apply_filters_deprecated( 'boost_cache_key_components', array( $parameters ), '3.8.0', 'jetpack_boost_cache_parameters' ); - return md5( json_encode( $key_components ) ) . '.html'; // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode + return md5( + json_encode( // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode + $key_components, + 0 // No `json_encode()` flags because this needs to match whatever is calculating the hash on the other end. + ) + ) . '.html'; } /** diff --git a/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-logger.php b/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-logger.php index a56698fa8133..e5c92640f20b 100644 --- a/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-logger.php +++ b/projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/class-logger.php @@ -120,7 +120,8 @@ public function log( $message ) { 'uri' => $request_uri, 'msg' => $message, 'uid' => uniqid(), // Uniquely identify this log line. - ) + ), + JSON_UNESCAPED_SLASHES ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log diff --git a/projects/plugins/boost/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/boost/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/plugins/boost/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/boost/tests/e2e/plugins/e2e-mock-speed-score-api.php b/projects/plugins/boost/tests/e2e/plugins/e2e-mock-speed-score-api.php index 874087aaefa6..decebfaab677 100644 --- a/projects/plugins/boost/tests/e2e/plugins/e2e-mock-speed-score-api.php +++ b/projects/plugins/boost/tests/e2e/plugins/e2e-mock-speed-score-api.php @@ -76,7 +76,7 @@ function e2e_mock_speed_score_api_response( $body ) { 'response' => array( 'code' => 200, ), - 'body' => wp_json_encode( $body ), + 'body' => wp_json_encode( $body, JSON_UNESCAPED_SLASHES ), ); } diff --git a/projects/plugins/boost/tests/php/modules/optimizations/page-cache/Filesystem_Utils_Test.php b/projects/plugins/boost/tests/php/modules/optimizations/page-cache/Filesystem_Utils_Test.php index f532cbdddac3..56cd4fc41e5d 100644 --- a/projects/plugins/boost/tests/php/modules/optimizations/page-cache/Filesystem_Utils_Test.php +++ b/projects/plugins/boost/tests/php/modules/optimizations/page-cache/Filesystem_Utils_Test.php @@ -63,7 +63,6 @@ public function test_get_request_filename() { $filename = Filesystem_Utils::get_request_filename( $parameters ); $this->assertIsString( $filename ); - $this->assertEquals( 32, strlen( md5( json_encode( $parameters ) ) ) ); $this->assertStringEndsWith( '.html', $filename ); } diff --git a/projects/plugins/classic-theme-helper-plugin/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/classic-theme-helper-plugin/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/plugins/classic-theme-helper-plugin/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/classic-theme-helper-plugin/src/class-classic-theme-helper-plugin.php b/projects/plugins/classic-theme-helper-plugin/src/class-classic-theme-helper-plugin.php index 21926c4c89c3..c86439413159 100644 --- a/projects/plugins/classic-theme-helper-plugin/src/class-classic-theme-helper-plugin.php +++ b/projects/plugins/classic-theme-helper-plugin/src/class-classic-theme-helper-plugin.php @@ -52,7 +52,7 @@ public function enqueue_admin_scripts() { * @return string */ public function render_initial_state() { - return 'var jetpackClassicThemeHelperPluginInitialState=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( $this->initial_state() ) ) . '"));'; + return 'var jetpackClassicThemeHelperPluginInitialState=' . wp_json_encode( $this->initial_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } /** diff --git a/projects/plugins/debug-helper/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/debug-helper/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/plugins/debug-helper/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/debug-helper/modules/class-xmlrpc-logger.php b/projects/plugins/debug-helper/modules/class-xmlrpc-logger.php index 1c1179f3b7db..d9fbe613cd26 100644 --- a/projects/plugins/debug-helper/modules/class-xmlrpc-logger.php +++ b/projects/plugins/debug-helper/modules/class-xmlrpc-logger.php @@ -235,14 +235,14 @@ public function pretty_print_xml( $xml ) { public function convert_xml_rpc_to_json( $xml ) { // Convert SimpleXML object to an array // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode, WordPress.WP.AlternativeFunctions.json_decode_json_decode - $array = json_decode( json_encode( (array) $xml ), true ); + $array = json_decode( json_encode( (array) $xml, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), true ); // Recursively clean up the array from empty arrays and objects $array = $this->recursive_array_clean( $array ); // Convert the array to a JSON string // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode - return json_encode( $array, JSON_PRETTY_PRINT ); + return json_encode( $array, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ); } /** diff --git a/projects/plugins/inspect/app/Log.php b/projects/plugins/inspect/app/Log.php index a3a28674da6b..765770e8f5b2 100644 --- a/projects/plugins/inspect/app/Log.php +++ b/projects/plugins/inspect/app/Log.php @@ -33,7 +33,7 @@ public static function insert( $url, $data ) { 'post_title' => $url, 'post_name' => uniqid( 'jetpack_inspect_log_', true ), 'post_status' => 'publish', - 'post_content' => base64_encode( wp_json_encode( $data ) ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode + 'post_content' => base64_encode( wp_json_encode( $data, JSON_UNESCAPED_SLASHES ) ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode ); wp_insert_post( $data_post_data ); diff --git a/projects/plugins/inspect/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/inspect/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/plugins/inspect/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/jetpack/3rd-party/debug-bar/class-jetpack-search-debug-bar.php b/projects/plugins/jetpack/3rd-party/debug-bar/class-jetpack-search-debug-bar.php index 939a936e0bd3..c5e1fe05125d 100644 --- a/projects/plugins/jetpack/3rd-party/debug-bar/class-jetpack-search-debug-bar.php +++ b/projects/plugins/jetpack/3rd-party/debug-bar/class-jetpack-search-debug-bar.php @@ -182,9 +182,9 @@ public function render_json_toggle( $value ) { // bar. // Use _wp_specialchars() "manually" to ensure entities are encoded correctly. echo _wp_specialchars( // phpcs:ignore WordPress.Security.EscapeOutput - wp_json_encode( $value ), + wp_json_encode( $value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), ENT_NOQUOTES, // Don't need to encode quotes (output is for a text node). - 'UTF-8', // wp_json_encode() outputs UTF-8 (really just ASCII), not the blog's charset. + 'UTF-8', // wp_json_encode() outputs UTF-8, not the blog's charset. true // Do "double-encode" existing HTML entities. ); ?> diff --git a/projects/plugins/jetpack/_inc/class.jetpack-provision.php b/projects/plugins/jetpack/_inc/class.jetpack-provision.php index 7664c399412a..f47d44f1b05e 100644 --- a/projects/plugins/jetpack/_inc/class.jetpack-provision.php +++ b/projects/plugins/jetpack/_inc/class.jetpack-provision.php @@ -170,7 +170,7 @@ public static function partner_provision( $access_token, $named_args ) { ), 'timeout' => 60, 'method' => 'POST', - 'body' => wp_json_encode( $request_body ), + 'body' => wp_json_encode( $request_body, JSON_UNESCAPED_SLASHES ), ); $blog_id = Jetpack_Options::get_option( 'id' ); diff --git a/projects/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-react-page.php b/projects/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-react-page.php index 15e866d9a334..6ab3668e385f 100644 --- a/projects/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-react-page.php +++ b/projects/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-react-page.php @@ -313,7 +313,7 @@ public function page_admin_scripts() { // Add objects to be passed to the initial state of the app. // Use wp_add_inline_script instead of wp_localize_script, see https://core.trac.wordpress.org/ticket/25280. - wp_add_inline_script( 'react-plugin', 'var Initial_State=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( Jetpack_Redux_State_Helper::get_initial_state() ) ) . '"));', 'before' ); + wp_add_inline_script( 'react-plugin', 'var Initial_State=' . wp_json_encode( Jetpack_Redux_State_Helper::get_initial_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); // This will set the default URL of the jp_redirects lib. wp_add_inline_script( 'react-plugin', 'var jetpack_redirects = { currentSiteRawUrl: "' . $site_suffix . '"' . $blog_id_prop . ' };', 'before' ); diff --git a/projects/plugins/jetpack/_inc/lib/class-jetpack-ai-helper.php b/projects/plugins/jetpack/_inc/lib/class-jetpack-ai-helper.php index d71f3c500741..47ddcca37a1c 100644 --- a/projects/plugins/jetpack/_inc/lib/class-jetpack-ai-helper.php +++ b/projects/plugins/jetpack/_inc/lib/class-jetpack-ai-helper.php @@ -264,7 +264,8 @@ function ( $msg ) { wp_json_encode( array( 'content' => $content, - ) + ), + JSON_UNESCAPED_SLASHES ), 'wpcom' ); @@ -338,7 +339,8 @@ public static function get_dalle_generation( $prompt, $post_id ) { wp_json_encode( array( 'prompt' => $prompt, - ) + ), + JSON_UNESCAPED_SLASHES ), 'wpcom' ); diff --git a/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php b/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php index 9088ca8eee27..207812117ad4 100644 --- a/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php +++ b/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php @@ -824,7 +824,7 @@ public static function get_openai_jwt() { 'method' => 'POST', 'headers' => array( 'Content-Type' => 'application/json; charset=utf-8' ), ), - wp_json_encode( array() ), + wp_json_encode( array(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'wpcom' ); @@ -922,7 +922,7 @@ public static function get_recommendations_product_suggestions() { $user_connected = ( new Connection_Manager( 'jetpack' ) )->is_user_connected( get_current_user_id() ); if ( ! $user_connected ) { - return wp_json_encode( array() ); + return wp_json_encode( array(), JSON_UNESCAPED_SLASHES ); } $request_path = sprintf( '/sites/%s/jetpack-recommendations/product-suggestions?locale=' . get_user_locale(), $blog_id ); @@ -1531,7 +1531,8 @@ public static function view_jetpack_connection_test_check() { 'rest_route' => isset( $_GET['rest_route'] ) ? filter_var( wp_unslash( $_GET['rest_route'] ) ) : null, 'timestamp' => (int) $_GET['timestamp'], 'url' => esc_url_raw( wp_unslash( $_GET['url'] ) ), - ) + ), + 0 // No `json_encode()` flags because this needs to match whatever is calculating the hash on the other end. ); if ( @@ -1596,7 +1597,7 @@ public static function jetpack_connection_test_for_external() { } } - $result = wp_json_encode( $result ); + $result = wp_json_encode( $result, JSON_UNESCAPED_SLASHES ); $encrypted = $cxntests->encrypt_string_for_wpcom( $result ); @@ -1662,7 +1663,7 @@ public static function get_rewind_data() { array( 'code' => 'success', 'message' => esc_html__( 'Backup & Scan data correctly received.', 'jetpack' ), - 'data' => wp_json_encode( $rewind_data ), + 'data' => wp_json_encode( $rewind_data, JSON_UNESCAPED_SLASHES ), ) ); } @@ -1745,7 +1746,7 @@ public static function get_scan_state() { array( 'code' => 'success', 'message' => esc_html__( 'Scan state correctly received.', 'jetpack' ), - 'data' => wp_json_encode( $scan_state ), + 'data' => wp_json_encode( $scan_state, JSON_UNESCAPED_SLASHES ), ) ); } @@ -1918,7 +1919,7 @@ public static function update_user_tracking_settings( $request ) { 'X-Forwarded-For' => ( new Visitor() )->get_ip( true ), ), ), - wp_json_encode( $request->get_params() ) + wp_json_encode( $request->get_params(), JSON_UNESCAPED_SLASHES ) ); if ( ! is_wp_error( $response ) ) { $response = json_decode( wp_remote_retrieve_body( $response ), true ); @@ -1994,7 +1995,7 @@ public static function get_site_data() { array( 'code' => 'success', 'message' => esc_html__( 'Site data correctly received.', 'jetpack' ), - 'data' => wp_json_encode( $site_data ), + 'data' => wp_json_encode( $site_data, JSON_UNESCAPED_SLASHES ), ) ); } diff --git a/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-site-endpoints.php b/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-site-endpoints.php index 344978e66a87..d637c5a6724d 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-site-endpoints.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-site-endpoints.php @@ -296,7 +296,7 @@ function ( $i, $j ) { array( 'code' => 'success', 'message' => esc_html__( 'Site benefits correctly received.', 'jetpack' ), - 'data' => wp_json_encode( $benefits ), + 'data' => wp_json_encode( $benefits, JSON_UNESCAPED_SLASHES ), ) ); } diff --git a/projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php b/projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php index 9cc7da823b5c..8c29927302ff 100644 --- a/projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php +++ b/projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php @@ -285,7 +285,7 @@ public static function debug_data() { $debug_info['protect_header'] = array( 'label' => 'Trusted IP', - 'value' => wp_json_encode( get_site_option( 'trusted_ip_header' ) ), + 'value' => wp_json_encode( get_site_option( 'trusted_ip_header' ), JSON_UNESCAPED_SLASHES ), 'private' => false, ); @@ -302,7 +302,7 @@ public static function debug_data() { } $debug_info['full_sync'] = array( 'label' => 'Full Sync Status', - 'value' => wp_json_encode( $human_readable_sync_status ), + 'value' => wp_json_encode( $human_readable_sync_status, JSON_UNESCAPED_SLASHES ), 'private' => false, ); } @@ -347,12 +347,12 @@ public static function debug_data() { $debug_info['idc_urls'] = array( 'label' => 'IDC URLs', - 'value' => wp_json_encode( $idc_urls ), + 'value' => wp_json_encode( $idc_urls, JSON_UNESCAPED_SLASHES ), 'private' => false, ); $debug_info['idc_error_option'] = array( 'label' => 'IDC Error Option', - 'value' => wp_json_encode( Jetpack_Options::get_option( 'sync_error_idc' ) ), + 'value' => wp_json_encode( Jetpack_Options::get_option( 'sync_error_idc' ), JSON_UNESCAPED_SLASHES ), 'private' => false, ); $debug_info['idc_optin'] = array( @@ -371,7 +371,7 @@ public static function debug_data() { if ( $cxn_tests->pass() ) { $debug_info['cxn_tests']['value'] = 'All Pass.'; } else { - $debug_info['cxn_tests']['value'] = wp_json_encode( $cxn_tests->list_fails() ); + $debug_info['cxn_tests']['value'] = wp_json_encode( $cxn_tests->list_fails(), JSON_UNESCAPED_SLASHES ); } return $debug_info; diff --git a/projects/plugins/jetpack/_inc/lib/widgets.php b/projects/plugins/jetpack/_inc/lib/widgets.php index 790447e95613..663c7e119503 100644 --- a/projects/plugins/jetpack/_inc/lib/widgets.php +++ b/projects/plugins/jetpack/_inc/lib/widgets.php @@ -576,7 +576,7 @@ public static function activate_widget( $id_base, $sidebar, $position, $settings 'wpcom_widgets_activate_widget', array( 'widget' => $id_base, - 'settings' => wp_json_encode( $settings ), + 'settings' => wp_json_encode( $settings, JSON_UNESCAPED_SLASHES ), ) ); } diff --git a/projects/plugins/jetpack/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/jetpack/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..b51962146563 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/jetpack/class.jetpack-cli.php b/projects/plugins/jetpack/class.jetpack-cli.php index 347649fe5eba..26490367b106 100644 --- a/projects/plugins/jetpack/class.jetpack-cli.php +++ b/projects/plugins/jetpack/class.jetpack-cli.php @@ -904,7 +904,7 @@ public function sync( $args, $assoc_args ) { foreach ( $status as $key => $item ) { $collection[] = array( 'option' => $key, - 'value' => is_scalar( $item ) ? $item : wp_json_encode( $item ), + 'value' => is_scalar( $item ) ? $item : wp_json_encode( $item, JSON_UNESCAPED_SLASHES ), ); } WP_CLI::log( __( 'Sync Status:', 'jetpack' ) ); @@ -916,7 +916,7 @@ public function sync( $args, $assoc_args ) { foreach ( Settings::get_settings() as $setting => $item ) { $settings[] = array( 'setting' => $setting, - 'value' => is_scalar( $item ) ? $item : wp_json_encode( $item ), + 'value' => is_scalar( $item ) ? $item : wp_json_encode( $item, JSON_UNESCAPED_SLASHES ), ); } WP_CLI\Utils\format_items( 'table', $settings, array( 'setting', 'value' ) ); @@ -1134,7 +1134,7 @@ public function sync_queue( $args ) { foreach ( $items as $item ) { $collection[] = array( 'action' => $item[0], - 'args' => wp_json_encode( $item[1] ), + 'args' => wp_json_encode( $item[1], JSON_UNESCAPED_SLASHES ), 'current_user_id' => $item[2], 'microtime' => $item[3], 'importing' => (string) $item[4], @@ -1295,13 +1295,14 @@ public function partner_provision( $args, $named_args ) { 'success' => false, 'error_code' => $body_json->get_error_code(), 'error_message' => $body_json->get_error_message(), - ) + ), + JSON_UNESCAPED_SLASHES ) ); exit( 1 ); } - WP_CLI::log( wp_json_encode( $body_json ) ); + WP_CLI::log( wp_json_encode( $body_json, JSON_UNESCAPED_SLASHES ) ); } /** @@ -1418,7 +1419,7 @@ public function authorize_user( $args, $named_args ) { ( new Tokens() )->update_user_token( $current_user_id, sprintf( '%s.%d', $named_args['token'], $current_user_id ), $is_connection_owner ); - WP_CLI::log( wp_json_encode( $named_args ) ); + WP_CLI::log( wp_json_encode( $named_args, JSON_UNESCAPED_SLASHES ) ); if ( $is_connection_owner ) { /** @@ -1533,7 +1534,7 @@ public function call_api( $args, $named_args ) { if ( isset( $named_args['pretty'] ) ) { $decoded_output = json_decode( $output ); if ( $decoded_output ) { - $output = wp_json_encode( $decoded_output, JSON_PRETTY_PRINT ); + $output = wp_json_encode( $decoded_output, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ); } } @@ -1621,7 +1622,7 @@ public function upload_ssh_creds( $args, $named_args ) { 'resource' => '/activity-log/%d/update-credentials', 'method' => 'POST', 'api_version' => '1.1', - 'body' => wp_json_encode( $values ), + 'body' => wp_json_encode( $values, JSON_UNESCAPED_SLASHES ), 'timeout' => 30, ), $named_args @@ -1949,7 +1950,8 @@ private function partner_provision_error( $error ) { 'success' => false, 'error_code' => $error->get_error_code(), 'error_message' => $error->get_error_message(), - ) + ), + JSON_UNESCAPED_SLASHES ) ); exit( 1 ); @@ -2059,12 +2061,12 @@ function ( $keyword ) { 'block-block-json', array( 'slug' => $slug, - 'title' => wp_json_encode( $title, JSON_UNESCAPED_UNICODE ), + 'title' => wp_json_encode( $title, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'description' => isset( $assoc_args['description'] ) - ? wp_json_encode( $assoc_args['description'], JSON_UNESCAPED_UNICODE ) - : wp_json_encode( $title, JSON_UNESCAPED_UNICODE ), + ? wp_json_encode( $assoc_args['description'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) + : wp_json_encode( $title, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), 'nextVersion' => $next_version, - 'keywords' => wp_json_encode( $keywords, JSON_UNESCAPED_UNICODE ), + 'keywords' => wp_json_encode( $keywords, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ), ) ), "$path/$slug.php" => self::render_block_file( @@ -2117,7 +2119,7 @@ function ( $keyword ) { $new_block_list->{ $variation }[] = $slug; // Format the JSON to match our coding standards. - $new_block_list_formatted = wp_json_encode( $new_block_list, JSON_PRETTY_PRINT ) . "\n"; + $new_block_list_formatted = wp_json_encode( $new_block_list, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) . "\n"; $new_block_list_formatted = preg_replace_callback( // Find all occurrences of multiples of 4 spaces a the start of the line. '/^((?: )+)/m', diff --git a/projects/plugins/jetpack/class.jetpack.php b/projects/plugins/jetpack/class.jetpack.php index 879f9cdf04ad..e83dd0c70afc 100644 --- a/projects/plugins/jetpack/class.jetpack.php +++ b/projects/plugins/jetpack/class.jetpack.php @@ -3037,7 +3037,7 @@ public static function get_stat_data( $encode = true, $extended = true ) { } if ( $encode ) { - return wp_json_encode( $data ); + return wp_json_encode( $data, JSON_UNESCAPED_SLASHES ); } return $data; @@ -3318,16 +3318,15 @@ public function remote_request_handlers() { $status_code = 400; } - status_header( $status_code ); - die( wp_json_encode( (object) compact( 'error', 'error_description' ) ) ); + wp_send_json( (object) compact( 'error', 'error_description' ), $status_code, JSON_UNESCAPED_SLASHES ); } - status_header( 200 ); if ( true === $response ) { + status_header( 200 ); exit( 0 ); } - die( wp_json_encode( (object) $response ) ); + wp_send_json( (object) $response, 200, JSON_UNESCAPED_SLASHES ); } /** @@ -3535,7 +3534,7 @@ public function deactivate_dialog( $hook ) { // Add objects to be passed to the initial state of the app. // Use wp_add_inline_script instead of wp_localize_script, see https://core.trac.wordpress.org/ticket/25280. - wp_add_inline_script( 'jetpack-plugins-page-js', 'var Initial_State=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( Jetpack_Redux_State_Helper::get_minimal_state() ) ) . '"));', 'before' ); + wp_add_inline_script( 'jetpack-plugins-page-js', 'var Initial_State=' . wp_json_encode( Jetpack_Redux_State_Helper::get_minimal_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); add_action( 'admin_footer', array( $this, 'jetpack_plugin_portal_containers' ) ); } @@ -4658,16 +4657,16 @@ public function alert_auto_ssl_fail() { jQuery( document ).ready( function( $ ) { $( '#jetpack-recheck-ssl-button' ).click( function( e ) { var $this = $( this ); - $this.html( ); + $this.html( ); $( '#jetpack-recheck-ssl-output' ).html( '' ); e.preventDefault(); - var data = { action: 'jetpack-recheck-ssl', 'ajax-nonce': }; + var data = { action: 'jetpack-recheck-ssl', 'ajax-nonce': }; $.post( ajaxurl, data ) .done( function( response ) { if ( response.enabled ) { $( '#jetpack-ssl-warning' ).hide(); } else { - this.html( ); + this.html( ); $( '#jetpack-recheck-ssl-output' ).html( 'SSL Failed: ' + response.message ); } }.bind( $this ) ); diff --git a/projects/plugins/jetpack/class.json-api-endpoints.php b/projects/plugins/jetpack/class.json-api-endpoints.php index 3febeae084a8..4ae2b54dedef 100644 --- a/projects/plugins/jetpack/class.json-api-endpoints.php +++ b/projects/plugins/jetpack/class.json-api-endpoints.php @@ -2804,7 +2804,7 @@ public function rest_callback( WP_REST_Request $request ) { $response = WPCOM_JSON_API::wrap_http_envelope( $status_code, $response, 'application/json' ); } - $response = wp_json_encode( $response ); + $response = wp_json_encode( $response, JSON_UNESCAPED_SLASHES ); $nonce = wp_generate_password( 10, false ); $hmac = hash_hmac( 'sha1', $nonce . $response, $token->secret ); diff --git a/projects/plugins/jetpack/class.json-api.php b/projects/plugins/jetpack/class.json-api.php index 5b5f67244227..dc8b4047d46b 100644 --- a/projects/plugins/jetpack/class.json-api.php +++ b/projects/plugins/jetpack/class.json-api.php @@ -721,7 +721,7 @@ public function output( $status_code, $response = null, $content_type = 'applica echo "/**/$callback("; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- This is JSONP output, not HTML. } - echo $this->json_encode( $response ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- This is JSON or JSONP output, not HTML. + echo $this->json_encode( $response, JSON_UNESCAPED_SLASHES ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- This is JSON or JSONP output, not HTML. if ( $callback ) { echo ');'; } @@ -914,11 +914,14 @@ public function comment_edit_pre( $comment_content ) { /** * JSON encode. * - * @param mixed $data Data. + * @param mixed $value The value to encode. + * @param int $flags Options to be passed to json_encode(). Default 0. + * @param int $depth Maximum depth to walk through $value. Must be greater than 0. + * * @return string|false */ - public function json_encode( $data ) { - return wp_json_encode( $data ); + public function json_encode( $value, $flags = 0, $depth = 512 ) { + return wp_json_encode( $value, $flags, $depth ); } /** diff --git a/projects/plugins/jetpack/extensions/blocks/ai-chat/ai-chat.php b/projects/plugins/jetpack/extensions/blocks/ai-chat/ai-chat.php index ea7f48a817bd..b8324cc3ddd1 100644 --- a/projects/plugins/jetpack/extensions/blocks/ai-chat/ai-chat.php +++ b/projects/plugins/jetpack/extensions/blocks/ai-chat/ai-chat.php @@ -94,7 +94,7 @@ function add_ai_chat_block_data() { ); wp_add_inline_script( 'jetpack-blocks-editor', - 'var Jetpack_AIChatBlock = ' . wp_json_encode( $initial_state, JSON_HEX_TAG | JSON_HEX_AMP ) . ';', + 'var Jetpack_AIChatBlock = ' . wp_json_encode( $initial_state, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); } diff --git a/projects/plugins/jetpack/extensions/blocks/donations/donations.php b/projects/plugins/jetpack/extensions/blocks/donations/donations.php index 31f14aa1c261..2e509828d413 100644 --- a/projects/plugins/jetpack/extensions/blocks/donations/donations.php +++ b/projects/plugins/jetpack/extensions/blocks/donations/donations.php @@ -270,7 +270,7 @@ function load_editor_scripts() { wp_add_inline_script( 'jetpack-blocks-editor', - 'var Jetpack_DonationsBlock = ' . wp_json_encode( $data, JSON_HEX_TAG | JSON_HEX_AMP ) . ';', + 'var Jetpack_DonationsBlock = ' . wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); } diff --git a/projects/plugins/jetpack/extensions/blocks/map/map.php b/projects/plugins/jetpack/extensions/blocks/map/map.php index 10ec103e2062..c16137cded1c 100644 --- a/projects/plugins/jetpack/extensions/blocks/map/map.php +++ b/projects/plugins/jetpack/extensions/blocks/map/map.php @@ -233,12 +233,12 @@ function ( $point ) { $points ); - $map_block = '' . PHP_EOL; + $map_block = '' . PHP_EOL; $map_block .= sprintf( '
', - esc_html( wp_json_encode( $map_block_data['points'] ) ), + esc_attr( wp_json_encode( $map_block_data['points'], JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ), $map_block_data['zoom'], - esc_html( wp_json_encode( $map_block_data['mapCenter'] ) ) + esc_attr( wp_json_encode( $map_block_data['mapCenter'], JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ) ); $map_block .= '
    ' . implode( "\n", $list_items ) . '
'; $map_block .= '
' . PHP_EOL; diff --git a/projects/plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php b/projects/plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php index 7dbf81d83747..277210ee19fc 100644 --- a/projects/plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php +++ b/projects/plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php @@ -186,7 +186,7 @@ class="jetpack-podcast-player " - +
', esc_attr( Blocks::classes( Blocks::get_block_feature( __DIR__ ), $attributes, array( 'wp-story', 'aligncenter' ) ) ), esc_attr( 'wp-story-' . get_the_ID() . '-' . strval( ++$story_block_counter ) ), - filter_var( wp_json_encode( $settings ), FILTER_SANITIZE_SPECIAL_CHARS ), + filter_var( wp_json_encode( $settings, JSON_UNESCAPED_SLASHES ), FILTER_SANITIZE_SPECIAL_CHARS ), get_permalink() . '?wp-story-load-in-fullscreen=true&wp-story-play-on-load=true', __( 'Play story in new tab', 'jetpack' ), __( 'Site icon', 'jetpack' ), diff --git a/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-images.server-rendered.html b/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-images.server-rendered.html index 4f55f401c32b..906cdbe46478 100644 --- a/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-images.server-rendered.html +++ b/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-images.server-rendered.html @@ -1,4 +1,4 @@ -
+
@@ -59,4 +59,4 @@
-
\ No newline at end of file +
diff --git a/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-video.server-rendered.html b/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-video.server-rendered.html index 02cebcd5b5f1..44b8a56d3d77 100644 --- a/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-video.server-rendered.html +++ b/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-video.server-rendered.html @@ -1,4 +1,4 @@ -
+
@@ -40,4 +40,4 @@
-
\ No newline at end of file +
diff --git a/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-videopress.server-rendered.html b/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-videopress.server-rendered.html index 192fe28ee2b1..9031bc0f51bc 100644 --- a/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-videopress.server-rendered.html +++ b/projects/plugins/jetpack/extensions/blocks/story/test/fixtures/jetpack__story__story-with-videopress.server-rendered.html @@ -1,4 +1,4 @@ -
+
@@ -39,4 +39,4 @@
-
\ No newline at end of file +
diff --git a/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php b/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php index ddbb1765cf16..840689f912bf 100644 --- a/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php +++ b/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php @@ -419,7 +419,7 @@ public function filter_gallery_block_render( $block_content, $block ) { ' ', array_map( function ( $data_key, $data_values ) { - return esc_attr( $data_key ) . "='" . wp_json_encode( $data_values ) . "'"; + return esc_attr( $data_key ) . "='" . esc_attr( wp_json_encode( $data_values, JSON_UNESCAPED_SLASHES | JSON_HEX_AMP ) ) . "'"; }, array_keys( $extra_data ), array_values( $extra_data ) @@ -978,7 +978,7 @@ class_exists( 'Jetpack_AMP_Support' ) unset( $img_meta['keywords'] ); } - $img_meta = wp_json_encode( array_map( 'strval', array_filter( $img_meta, 'is_scalar' ) ) ); + $img_meta = wp_json_encode( array_map( 'strval', array_filter( $img_meta, 'is_scalar' ) ), JSON_UNESCAPED_SLASHES | JSON_HEX_AMP ); $attr['data-attachment-id'] = $attachment_id; $attr['data-permalink'] = esc_attr( get_permalink( $attachment_id ) ); @@ -1032,10 +1032,10 @@ class_exists( 'Jetpack_AMP_Support' ) */ $extra_data = apply_filters( 'jp_carousel_add_data_to_container', $extra_data ); foreach ( (array) $extra_data as $data_key => $data_values ) { - $html = str_replace( '
]*)class="(wp-block-gallery[^"]*?has-nested-images.*?)"/', '
]*)class="(wp-block-gallery[^"]*?has-nested-images.*?)"/', '
__( 'Nonce verification failed.', 'jetpack' ) ) ) ); + die( wp_json_encode( array( 'error' => __( 'Nonce verification failed.', 'jetpack' ) ), JSON_UNESCAPED_SLASHES ) ); } $_blog_id = isset( $_POST['blog_id'] ) ? (int) $_POST['blog_id'] : 0; @@ -1225,15 +1225,15 @@ public function post_attachment_comment() { $comment = isset( $_POST['comment'] ) ? filter_var( wp_unslash( $_POST['comment'] ) ) : null; if ( empty( $_blog_id ) ) { - die( wp_json_encode( array( 'error' => __( 'Missing target blog ID.', 'jetpack' ) ) ) ); + die( wp_json_encode( array( 'error' => __( 'Missing target blog ID.', 'jetpack' ) ), JSON_UNESCAPED_SLASHES ) ); } if ( empty( $_post_id ) ) { - die( wp_json_encode( array( 'error' => __( 'Missing target post ID.', 'jetpack' ) ) ) ); + die( wp_json_encode( array( 'error' => __( 'Missing target post ID.', 'jetpack' ) ), JSON_UNESCAPED_SLASHES ) ); } if ( empty( $comment ) ) { - die( wp_json_encode( array( 'error' => __( 'No comment text was submitted.', 'jetpack' ) ) ) ); + die( wp_json_encode( array( 'error' => __( 'No comment text was submitted.', 'jetpack' ) ), JSON_UNESCAPED_SLASHES ) ); } // Used in context like NewDash. @@ -1250,7 +1250,7 @@ public function post_attachment_comment() { if ( $switched ) { restore_current_blog(); } - die( wp_json_encode( array( 'error' => __( 'Comments on this post are closed.', 'jetpack' ) ) ) ); + die( wp_json_encode( array( 'error' => __( 'Comments on this post are closed.', 'jetpack' ) ), JSON_UNESCAPED_SLASHES ) ); } if ( is_user_logged_in() ) { @@ -1264,7 +1264,7 @@ public function post_attachment_comment() { if ( $switched ) { restore_current_blog(); } - die( wp_json_encode( array( 'error' => __( 'Sorry, but we could not authenticate your request.', 'jetpack' ) ) ) ); + die( wp_json_encode( array( 'error' => __( 'Sorry, but we could not authenticate your request.', 'jetpack' ) ), JSON_UNESCAPED_SLASHES ) ); } } else { $user_id = 0; @@ -1280,21 +1280,21 @@ public function post_attachment_comment() { if ( $switched ) { restore_current_blog(); } - die( wp_json_encode( array( 'error' => __( 'Please provide your name.', 'jetpack' ) ) ) ); + die( wp_json_encode( array( 'error' => __( 'Please provide your name.', 'jetpack' ) ), JSON_UNESCAPED_SLASHES ) ); } if ( empty( $email ) ) { if ( $switched ) { restore_current_blog(); } - die( wp_json_encode( array( 'error' => __( 'Please provide an email address.', 'jetpack' ) ) ) ); + die( wp_json_encode( array( 'error' => __( 'Please provide an email address.', 'jetpack' ) ), JSON_UNESCAPED_SLASHES ) ); } if ( ! is_email( $email ) ) { if ( $switched ) { restore_current_blog(); } - die( wp_json_encode( array( 'error' => __( 'Please provide a valid email address.', 'jetpack' ) ) ) ); + die( wp_json_encode( array( 'error' => __( 'Please provide a valid email address.', 'jetpack' ) ), JSON_UNESCAPED_SLASHES ) ); } } else { $email = $email !== null ? sanitize_email( $email ) : null; @@ -1337,7 +1337,8 @@ public function post_attachment_comment() { array( 'comment_id' => $comment_id, 'comment_status' => $comment_status, - ) + ), + JSON_UNESCAPED_SLASHES ) ); } diff --git a/projects/plugins/jetpack/modules/comments/comments.php b/projects/plugins/jetpack/modules/comments/comments.php index f4ca7a73b48b..f486c6a46ff6 100644 --- a/projects/plugins/jetpack/modules/comments/comments.php +++ b/projects/plugins/jetpack/modules/comments/comments.php @@ -1033,10 +1033,10 @@ public function capture_comment_post_redirect_to_reload_parent_frame( $url ) { ); - extend( window.infiniteScroll.settings.styles, ); + extend( window.infiniteScroll.settings.scripts, ); + extend( window.infiniteScroll.settings.styles, ); })(); ">
diff --git a/projects/plugins/jetpack/modules/notes.php b/projects/plugins/jetpack/modules/notes.php index 3137006a67ff..42d09b917aa8 100644 --- a/projects/plugins/jetpack/modules/notes.php +++ b/projects/plugins/jetpack/modules/notes.php @@ -144,7 +144,7 @@ public function styles_and_scripts() { wp_enqueue_script( 'wpcom-notes-admin-bar', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/admin-bar-v2.js' ), array( 'wpcom-notes-common' ), JETPACK_NOTES__CACHE_BUSTER, true ); $script_handles[] = 'wpcom-notes-admin-bar'; - $wp_notes_args = 'var wpNotesArgs = ' . wp_json_encode( array( 'cacheBuster' => JETPACK_NOTES__CACHE_BUSTER ) ) . ';'; + $wp_notes_args = 'var wpNotesArgs = ' . wp_json_encode( array( 'cacheBuster' => JETPACK_NOTES__CACHE_BUSTER ), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; wp_add_inline_script( 'wpcom-notes-admin-bar', $wp_notes_args, 'before' ); if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) { @@ -237,7 +237,7 @@ public function print_js() { var wpNotesIsJetpackClientV2 = true; JS; if ( $link_accounts_url ) { - $script_contents .= "\nvar wpNotesLinkAccountsURL = " . wp_json_encode( $link_accounts_url, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ';'; + $script_contents .= "\nvar wpNotesLinkAccountsURL = " . wp_json_encode( $link_accounts_url, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } wp_print_inline_script_tag( $script_contents, diff --git a/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php b/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php index d72893ed92eb..2d01363d5fc3 100644 --- a/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php +++ b/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php @@ -874,7 +874,7 @@ class_exists( 'Jetpack_AMP_Support' ) ?> %3$s', esc_url( $survey_url ), - esc_attr( wp_json_encode( $settings ) ), + esc_attr( wp_json_encode( $settings, JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ), esc_html( $settings['title'] ) ); } else { $placeholder = sprintf( '
', - esc_attr( wp_json_encode( $settings ) ), + esc_attr( wp_json_encode( $settings, JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ), $survey_link ); } @@ -281,7 +281,8 @@ public function crowdsignal_shortcode( $atts ) { 'title' => rawurlencode( trim( $attributes['title'] ) ), 'permalink' => esc_url( $attributes['permalink'] ), 'item_id' => $item_id, - ) + ), + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); $item_id = esc_js( $item_id ); @@ -332,7 +333,7 @@ class_exists( 'Jetpack_AMP_Support' ) '
', absint( $rating ), esc_attr( $item_id ), - esc_attr( wp_json_encode( $data ) ) + esc_attr( wp_json_encode( $data, JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ) ); } else { return sprintf( @@ -456,7 +457,7 @@ class_exists( 'Jetpack_AMP_Support' ) return sprintf( '
', absint( $poll ), - esc_attr( wp_json_encode( $data ) ), + esc_attr( wp_json_encode( $data, JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ), $float, $margins, $poll_link diff --git a/projects/plugins/jetpack/modules/shortcodes/flickr.php b/projects/plugins/jetpack/modules/shortcodes/flickr.php index cbdfda52a951..83c0cffd2572 100644 --- a/projects/plugins/jetpack/modules/shortcodes/flickr.php +++ b/projects/plugins/jetpack/modules/shortcodes/flickr.php @@ -310,7 +310,7 @@ function jetpack_flickr_oembed_handler( $matches, $attr, $url ) { */ if ( '/show/' !== substr( $url, -strlen( '/show/' ) ) ) { // These lookups need cached, as they don't use WP_Embed (which caches). - $cache_key = md5( $url . wp_json_encode( $attr ) ); + $cache_key = md5( $url . wp_json_encode( $attr, JSON_UNESCAPED_SLASHES ) ); $cache_group = 'oembed_flickr'; $html = wp_cache_get( $cache_key, $cache_group ); diff --git a/projects/plugins/jetpack/modules/shortcodes/mailchimp.php b/projects/plugins/jetpack/modules/shortcodes/mailchimp.php index b27d7800bbc1..9cbc77a900e1 100644 --- a/projects/plugins/jetpack/modules/shortcodes/mailchimp.php +++ b/projects/plugins/jetpack/modules/shortcodes/mailchimp.php @@ -227,6 +227,6 @@ public static function shortcode( $lcase_attrs ) { $displayed_once = true; - return "\n\n" . '' . "\n\n"; + return "\n\n" . '' . "\n\n"; } } diff --git a/projects/plugins/jetpack/modules/stats.php b/projects/plugins/jetpack/modules/stats.php index d942a53f0c17..3dd0b62efd71 100644 --- a/projects/plugins/jetpack/modules/stats.php +++ b/projects/plugins/jetpack/modules/stats.php @@ -314,8 +314,8 @@ function stats_odyssey_dismiss_nudge() { // Send an AJAX request. // Note we can provide a 'postponed_for' parameter to set the delay. // Without a parameter it defaults to 30 days which is what we want here. - let nonce = ; - let url = ; + let nonce = ; + let url = ; let data = { id: 'opt_in_new_stats', status: 'postponed', @@ -1173,7 +1173,7 @@ function stats_dashboard_widget_content() { function stats_print_wp_remote_error( $get, $url ) { $state_name = 'stats_remote_error_' . substr( md5( $url ), 0, 8 ); $previous_error = Jetpack::state( $state_name ); - $error = md5( wp_json_encode( compact( 'get', 'url' ) ) ); + $error = md5( wp_json_encode( compact( 'get', 'url' ), JSON_UNESCAPED_SLASHES ) ); Jetpack::state( $state_name, $error ); if ( $error !== $previous_error ) { ?> @@ -1388,7 +1388,7 @@ function stats_get_from_restapi( $args = array(), $resource = '' ) { $endpoint = jetpack_stats_api_path( $resource ); $api_version = '1.1'; $args = wp_parse_args( $args, array() ); - $cache_key = md5( implode( '|', array( $endpoint, $api_version, wp_json_encode( $args ) ) ) ); + $cache_key = md5( implode( '|', array( $endpoint, $api_version, wp_json_encode( $args, JSON_UNESCAPED_SLASHES ) ) ) ); $transient_name = "jetpack_restapi_stats_cache_{$cache_key}"; diff --git a/projects/plugins/jetpack/modules/subscriptions/newsletter-widget/class-jetpack-newsletter-dashboard-widget.php b/projects/plugins/jetpack/modules/subscriptions/newsletter-widget/class-jetpack-newsletter-dashboard-widget.php index a25b469a53ac..0208d46df14c 100644 --- a/projects/plugins/jetpack/modules/subscriptions/newsletter-widget/class-jetpack-newsletter-dashboard-widget.php +++ b/projects/plugins/jetpack/modules/subscriptions/newsletter-widget/class-jetpack-newsletter-dashboard-widget.php @@ -228,7 +228,7 @@ public static function load_admin_scripts( $asset_handle, $asset_name, $options if ( ! empty( $options['config_data'] ) ) { wp_add_inline_script( $asset_handle, - "window.{$options['config_variable_name']} = " . wp_json_encode( $options['config_data'] ) . ';', + "window.{$options['config_variable_name']} = " . wp_json_encode( $options['config_data'], JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); } diff --git a/projects/plugins/jetpack/modules/videopress/class-videopress-attachment-metadata.php b/projects/plugins/jetpack/modules/videopress/class-videopress-attachment-metadata.php index ef3c86b0dca1..42b5bc024a8d 100644 --- a/projects/plugins/jetpack/modules/videopress/class-videopress-attachment-metadata.php +++ b/projects/plugins/jetpack/modules/videopress/class-videopress-attachment-metadata.php @@ -48,7 +48,7 @@ public static function persist_metadata( $post_id, $guid, $post_title, $caption, $endpoint = 'videos'; $values['guid'] = $guid; - $result = Client::wpcom_json_api_request_as_blog( $endpoint, '2', $args, wp_json_encode( $values ), 'wpcom' ); + $result = Client::wpcom_json_api_request_as_blog( $endpoint, '2', $args, wp_json_encode( $values, JSON_UNESCAPED_SLASHES ), 'wpcom' ); $validated_result = self::validate_result( $result ); if ( true !== $validated_result ) { diff --git a/projects/plugins/jetpack/modules/videopress/class.videopress-player.php b/projects/plugins/jetpack/modules/videopress/class.videopress-player.php index 2d5c84f5824f..1e7e9ed766a8 100644 --- a/projects/plugins/jetpack/modules/videopress/class.videopress-player.php +++ b/projects/plugins/jetpack/modules/videopress/class.videopress-player.php @@ -520,16 +520,16 @@ private function html5_dynamic() { unset( $locale ); $guid = $this->video->guid; - $guid_js = wp_json_encode( $guid ); + $guid_js = wp_json_encode( $guid, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); $html .= ' + $value ) { - if ( is_array( $value ) ) { - $js_args_string = $js_args_string . "'$key': " . wp_json_encode( $value ) . ','; - } else { - $js_args_string = $js_args_string . "'$key': '" . esc_js( $value ) . "', "; - } + $js_args_string = $js_args_string . "'$key': " . wp_json_encode( $value, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ','; } return $js_args_string; } diff --git a/projects/plugins/jetpack/modules/wordads/class-wordads.php b/projects/plugins/jetpack/modules/wordads/class-wordads.php index 3803d3c761d2..8602ec9a7400 100644 --- a/projects/plugins/jetpack/modules/wordads/class-wordads.php +++ b/projects/plugins/jetpack/modules/wordads/class-wordads.php @@ -868,7 +868,7 @@ public function get_fallback_ad_snippet( $section_id, $form_factor = 'square', $ $relocate_script = ''; if ( ! empty( $relocate ) ) { - $selector = wp_json_encode( $relocate ); + $selector = wp_json_encode( $relocate, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ); $relocate_script = << var adNode = document.getElementById( '{$div_id}' ); diff --git a/projects/plugins/jetpack/modules/wordads/php/class-wordads-california-privacy.php b/projects/plugins/jetpack/modules/wordads/php/class-wordads-california-privacy.php index 3674f5ae459a..f78bdf6fea61 100644 --- a/projects/plugins/jetpack/modules/wordads/php/class-wordads-california-privacy.php +++ b/projects/plugins/jetpack/modules/wordads/php/class-wordads-california-privacy.php @@ -56,7 +56,7 @@ public static function enqueue_scripts() { 'ccpaCssUrl' => esc_url( Assets::get_file_url_for_environment( '/css/wordads-ccpa.min.css', '/css/wordads-ccpa.css' ) . '?ver=' . JETPACK__VERSION ), 'ajaxUrl' => esc_url( admin_url( 'admin-ajax.php' ) ), 'ajaxNonce' => wp_create_nonce( 'ccpa_optout' ), - 'forceApplies' => wp_json_encode( is_user_logged_in() && current_user_can( 'manage_options' ) ), + 'forceApplies' => is_user_logged_in() && current_user_can( 'manage_options' ) ? 'true' : 'false', 'strings' => array( 'pleaseWait' => esc_html__( 'Please Wait', 'jetpack' ), ), diff --git a/projects/plugins/jetpack/src/class-deprecate.php b/projects/plugins/jetpack/src/class-deprecate.php index d6c85632a446..b9c677023307 100644 --- a/projects/plugins/jetpack/src/class-deprecate.php +++ b/projects/plugins/jetpack/src/class-deprecate.php @@ -99,7 +99,7 @@ public function enqueue_admin_scripts() { wp_enqueue_script( 'jetpack-deprecate' ); wp_add_inline_script( 'jetpack-deprecate', - 'window.noticeInfo = ' . wp_json_encode( $this->notices ) . ';', + 'window.noticeInfo = ' . wp_json_encode( $this->notices, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); } diff --git a/projects/plugins/jetpack/tests/php/Block_Manifest_Test.php b/projects/plugins/jetpack/tests/php/Block_Manifest_Test.php index 1ed394b3864a..3664af4b7a2a 100644 --- a/projects/plugins/jetpack/tests/php/Block_Manifest_Test.php +++ b/projects/plugins/jetpack/tests/php/Block_Manifest_Test.php @@ -118,7 +118,8 @@ public function test_successful_manifest_generation() { array( 'name' => 'test/block1', 'title' => 'Test Block 1', - ) + ), + JSON_UNESCAPED_SLASHES ) ); $this->cleanup_paths[] = $block1_json; @@ -134,7 +135,8 @@ public function test_successful_manifest_generation() { array( 'name' => 'test/block2', 'title' => 'Test Block 2', - ) + ), + JSON_UNESCAPED_SLASHES ) ); $this->cleanup_paths[] = $block2_json; diff --git a/projects/plugins/jetpack/tests/php/_inc/lib/Jetpack_REST_API_endpoints_Test.php b/projects/plugins/jetpack/tests/php/_inc/lib/Jetpack_REST_API_endpoints_Test.php index 2b2f0021d6d9..674a40f4e5cf 100644 --- a/projects/plugins/jetpack/tests/php/_inc/lib/Jetpack_REST_API_endpoints_Test.php +++ b/projects/plugins/jetpack/tests/php/_inc/lib/Jetpack_REST_API_endpoints_Test.php @@ -112,7 +112,7 @@ protected function create_and_get_request( $route = '', $json_params = array(), $request->set_header( 'content-type', 'application/json' ); } if ( ! empty( $json_params ) ) { - $request->set_body( json_encode( $json_params ) ); + $request->set_body( json_encode( $json_params, JSON_UNESCAPED_SLASHES ) ); } if ( ! empty( $params ) && is_array( $params ) ) { foreach ( $params as $key => $value ) { diff --git a/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_External_Media_Test.php b/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_External_Media_Test.php index 131c6b3d32cb..0f182c7b9c8a 100644 --- a/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_External_Media_Test.php +++ b/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_External_Media_Test.php @@ -128,7 +128,8 @@ public function test_copy_image() { array( 'url' => static::$image_path, 'name' => $this->image_name, - ) + ), + JSON_UNESCAPED_SLASHES ), ), ), @@ -174,7 +175,8 @@ public function test_copy_image_meta() { array( 'url' => static::$image_path, 'name' => $this->image_name, - ) + ), + JSON_UNESCAPED_SLASHES ), 'meta' => array( 'vertical_id' => 'v1234', @@ -237,7 +239,8 @@ public function test_copy_image_meta_invalid_meta_key() { array( 'url' => static::$image_path, 'name' => $this->image_name, - ) + ), + JSON_UNESCAPED_SLASHES ), 'meta' => array( 'vertical_id' => 'v1234', diff --git a/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Memberships_Test.php b/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Memberships_Test.php index 04182b86daa5..70696aa36e26 100644 --- a/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Memberships_Test.php +++ b/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Memberships_Test.php @@ -151,7 +151,7 @@ public function test_create_products_no_auth() { 'type' => 'donation', 'currency' => 'USD', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'rest_forbidden', $response, 401 ); @@ -169,7 +169,7 @@ public function test_create_products_with_insufficient_permissions() { 'type' => 'donation', 'currency' => 'USD', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'rest_forbidden', $response, 403 ); @@ -199,7 +199,7 @@ public function test_create_products_with_remote_error() { 'type' => 'donation', 'currency' => 'USD', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'dummy_error', $response, 500 ); @@ -304,7 +304,7 @@ public function test_create_product_no_auth() { 'currency' => 'USD', 'interval' => 'week', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'rest_forbidden', $response, 401 ); @@ -324,7 +324,7 @@ public function test_create_product_with_insufficient_permissions() { 'currency' => 'USD', 'interval' => 'week', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'rest_unauthorized', $response, 403 ); @@ -356,7 +356,7 @@ public function test_create_product_with_remote_error() { 'currency' => 'USD', 'interval' => 'week', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'dummy_error', $response, 500 ); @@ -376,7 +376,7 @@ public function test_create_product_with_invalid_tier_for_monthly_plan() { 'type' => 'tier', 'tier' => 123, // Monthly plans should not have tier ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'invalid_tier_usage', $response, 400 ); @@ -396,7 +396,7 @@ public function test_create_product_with_invalid_tier_value() { 'type' => 'tier', 'tier' => -1, // Invalid tier value ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'invalid_tier_id', $response, 400 ); @@ -416,7 +416,7 @@ public function test_create_donation_product_with_tier() { 'type' => 'donation', 'tier' => 123, // Donation products can have tier ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); // This should not fail because donation products are not subject to tier validation @@ -439,7 +439,7 @@ public function test_create_product_with_nonexistent_tier() { 'type' => 'tier', 'tier' => 99999, // Non-existent tier ID ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'tier_not_found', $response, 400 ); @@ -461,7 +461,7 @@ public function test_create_product_with_tier_pointing_to_non_monthly_plan() { 'type' => 'tier', 'tier' => 456, // Tier ID pointing to a non-monthly plan ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'invalid_tier_interval', $response, 400 ); @@ -483,7 +483,7 @@ public function test_create_product_with_duplicate_tier_reference() { 'type' => 'tier', 'tier' => 789, // Tier ID already referenced by another yearly plan ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'duplicate_tier_reference', $response, 400 ); @@ -503,7 +503,7 @@ public function test_update_product_no_auth() { 'currency' => 'USD', 'interval' => 'week', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'rest_forbidden', $response, 401 ); @@ -523,7 +523,7 @@ public function test_update_product_with_insufficient_permissions() { 'currency' => 'USD', 'interval' => 'week', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'rest_forbidden', $response, 403 ); @@ -555,7 +555,7 @@ public function test_update_product_with_remote_error() { 'currency' => 'USD', 'interval' => 'week', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'dummy_error', $response, 500 ); @@ -578,7 +578,7 @@ public function test_update_product_with_invalid_tier_for_monthly_plan() { 'interval' => '1 month', 'type' => 'tier', ); - $create_request->set_body( wp_json_encode( $create_body ) ); + $create_request->set_body( wp_json_encode( $create_body, JSON_UNESCAPED_SLASHES ) ); $create_response = $this->server->dispatch( $create_request ); $product_data = $create_response->get_data(); $product_id = $product_data['id']; @@ -598,7 +598,7 @@ public function test_update_product_with_invalid_tier_for_monthly_plan() { 'type' => 'tier', 'tier' => 123, // Monthly plans should not have tier ); - $update_request->set_body( wp_json_encode( $update_body ) ); + $update_request->set_body( wp_json_encode( $update_body, JSON_UNESCAPED_SLASHES ) ); $update_response = $this->server->dispatch( $update_request ); $this->assertErrorResponse( 'invalid_tier_usage', $update_response, 400 ); @@ -637,7 +637,7 @@ public function test_delete_product_with_invalid_args() { $body = array( 'cancel_subscriptions' => 'Not a bool', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); @@ -655,7 +655,7 @@ public function test_delete_product_with_remote_error() { $body = array( 'cancel_subscriptions' => 'true', ); - $request->set_body( wp_json_encode( $body ) ); + $request->set_body( wp_json_encode( $body, JSON_UNESCAPED_SLASHES ) ); $response = $this->server->dispatch( $request ); $this->assertErrorResponse( 'dummy_error', $response, 500 ); diff --git a/projects/plugins/jetpack/tests/php/json-api/WPCOM_JSON_API_Site_Settings_V1_4_Endpoint_Test.php b/projects/plugins/jetpack/tests/php/json-api/WPCOM_JSON_API_Site_Settings_V1_4_Endpoint_Test.php index f80dace20e60..75317080769b 100644 --- a/projects/plugins/jetpack/tests/php/json-api/WPCOM_JSON_API_Site_Settings_V1_4_Endpoint_Test.php +++ b/projects/plugins/jetpack/tests/php/json-api/WPCOM_JSON_API_Site_Settings_V1_4_Endpoint_Test.php @@ -160,7 +160,7 @@ public function test_get_settings_contains_keys_values( $option_name, $setting_n */ #[DataProvider( 'setting_value_pairs_post_request' )] public function test_post_settings_sets_key_values( $setting_name, $setting_value, $expected_value ) { - $setting = wp_json_encode( array( $setting_name => $setting_value ) ); + $setting = wp_json_encode( array( $setting_name => $setting_value ), JSON_UNESCAPED_SLASHES ); $response = $this->make_post_request( $setting ); $updated = $response['updated']; $this->assertSame( $expected_value, $updated[ $setting_name ] ); diff --git a/projects/plugins/jetpack/tests/php/modules/post-by-email/Post_By_Email_API_Test.php b/projects/plugins/jetpack/tests/php/modules/post-by-email/Post_By_Email_API_Test.php index bcdec7737a5a..857ce6a26170 100644 --- a/projects/plugins/jetpack/tests/php/modules/post-by-email/Post_By_Email_API_Test.php +++ b/projects/plugins/jetpack/tests/php/modules/post-by-email/Post_By_Email_API_Test.php @@ -302,7 +302,7 @@ public function mock_jetpack_api_response_delete( $response, $args, $url ) { * @return WP_REST_Response */ private function rest_dispatch( $action ) { - $body = wp_json_encode( array( 'post_by_email_address' => $action ) ); + $body = wp_json_encode( array( 'post_by_email_address' => $action ), JSON_UNESCAPED_SLASHES ); $this->request->set_body( $body ); $_GET['body-hash'] = Jetpack::connection()->sha1_base64( $body ); diff --git a/projects/plugins/jetpack/tests/php/modules/publicize/Publicize_Test.php b/projects/plugins/jetpack/tests/php/modules/publicize/Publicize_Test.php index 4402906940d7..3cab81b47b56 100644 --- a/projects/plugins/jetpack/tests/php/modules/publicize/Publicize_Test.php +++ b/projects/plugins/jetpack/tests/php/modules/publicize/Publicize_Test.php @@ -498,7 +498,7 @@ public function test_filter_publicize_checkbox_global_default_for_normal_connect 'Normal connection checkbox should not be disabled.' ); - $before = json_encode( $normal_connection ); + $before = json_encode( $normal_connection, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); add_filter( 'publicize_checkbox_global_default', array( $this, 'publicize_connection_filter_no_normal' ), 10, 4 ); @@ -506,7 +506,7 @@ public function test_filter_publicize_checkbox_global_default_for_normal_connect $connection_list = $this->publicize->get_filtered_connection_data( $this->post->ID ); $normal_connection = $connection_list[ self::NORMAL_CONNECTION_INDEX ]; - $this->assertSame( $before, json_encode( $normal_connection ), 'Normal connection should be unaffected by filter to uncheck global connection' ); + $this->assertSame( $before, json_encode( $normal_connection | JSON_UNESCAPED_UNICODE ), 'Normal connection should be unaffected by filter to uncheck global connection' ); } /** diff --git a/projects/plugins/jetpack/tests/php/modules/sharedaddy/Jetpack_ReCaptcha_Test.php b/projects/plugins/jetpack/tests/php/modules/sharedaddy/Jetpack_ReCaptcha_Test.php index 025cd8f3f78e..99afbc4313ba 100644 --- a/projects/plugins/jetpack/tests/php/modules/sharedaddy/Jetpack_ReCaptcha_Test.php +++ b/projects/plugins/jetpack/tests/php/modules/sharedaddy/Jetpack_ReCaptcha_Test.php @@ -130,11 +130,11 @@ public function test_get_recaptcha_html_lazy() { } public function pre_http_request_response_success() { - return array( 'body' => json_encode( array( 'success' => true ) ) ); + return array( 'body' => json_encode( array( 'success' => true ), JSON_UNESCAPED_SLASHES ) ); } public function pre_http_request_response_unexpected() { - return array( 'body' => json_encode( array( 'success' => false ) ) ); + return array( 'body' => json_encode( array( 'success' => false ), JSON_UNESCAPED_SLASHES ) ); } public function pre_http_request_response_malformed_json() { @@ -163,7 +163,8 @@ protected function http_response_with_error_code( $first_error_code ) { array( 'success' => false, 'error-codes' => array( $first_error_code ), - ) + ), + JSON_UNESCAPED_SLASHES ), ); } diff --git a/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_CrowdSignal_Test.php b/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_CrowdSignal_Test.php index af8b7d437af1..43566afa0598 100644 --- a/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_CrowdSignal_Test.php +++ b/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_CrowdSignal_Test.php @@ -70,7 +70,7 @@ public function test_shortcodes_polldaddy_poll() { $this->assertEquals( sprintf( - '
', + '
', $id ), $shortcode_content @@ -91,7 +91,7 @@ public function test_shortcodes_crowdsignal_poll() { $this->assertEquals( sprintf( - '
', + '
', $id ), $shortcode_content @@ -204,7 +204,7 @@ public function test_shortcodes_crowdsignal_survey_iframe_customdomain() { $this->assertEquals( sprintf( - '
', + '
', $id, $domain, $name, diff --git a/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Flickr_Test.php b/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Flickr_Test.php index aff475254745..65bf88a45227 100644 --- a/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Flickr_Test.php +++ b/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Flickr_Test.php @@ -45,7 +45,7 @@ public function set_up() { ); return array( - 'body' => wp_json_encode( $body ), + 'body' => wp_json_encode( $body, JSON_UNESCAPED_SLASHES ), ); } diff --git a/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Gravatar_Test.php b/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Gravatar_Test.php index 2b6f2edcfa33..62a4fd23856c 100644 --- a/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Gravatar_Test.php +++ b/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Gravatar_Test.php @@ -72,7 +72,8 @@ public function test_shortcodes_gravatar_profile() { 'aboutMe' => 'Gravatar is a free service for providing globally-unique avatars.', ), ), - ) + ), + JSON_UNESCAPED_SLASHES ), ); }; @@ -104,7 +105,8 @@ public function test_shortcodes_gravatar_user_id() { 'body' => wp_json_encode( array( 'entry' => array( array( 'displayName' => 'Gravatar' ) ), - ) + ), + JSON_UNESCAPED_SLASHES ), ); }; diff --git a/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Instagram_Test.php b/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Instagram_Test.php index 6346966b233e..0923a5ac8c7a 100644 --- a/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Instagram_Test.php +++ b/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Instagram_Test.php @@ -86,7 +86,7 @@ public function pre_http_request( $response, $args, $url ) { 'type' => 'OAuthException', ); - $response['body'] = wp_json_encode( compact( 'error' ) ); + $response['body'] = wp_json_encode( compact( 'error' ), JSON_UNESCAPED_SLASHES ); return $response; } @@ -113,7 +113,7 @@ public function pre_http_request( $response, $args, $url ) { 'type' => 'OAuthException', ); - $response['body'] = wp_json_encode( compact( 'error' ) ); + $response['body'] = wp_json_encode( compact( 'error' ), JSON_UNESCAPED_SLASHES ); return $response; } diff --git a/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Mixcloud_Test.php b/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Mixcloud_Test.php index 22fbf47fbe0d..084d9acf72a4 100644 --- a/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Mixcloud_Test.php +++ b/projects/plugins/jetpack/tests/php/modules/shortcodes/Jetpack_Shortcodes_Mixcloud_Test.php @@ -107,7 +107,7 @@ public function test_shortcodes_mixcloud_no_sandbox() { 'response' => array( 'code' => 200, ), - 'body' => wp_json_encode( $body_object ), + 'body' => wp_json_encode( $body_object, JSON_UNESCAPED_SLASHES ), ); }; @@ -140,7 +140,7 @@ public function test_shortcodes_mixcloud_sandbox_have_allow_popups() { 'response' => array( 'code' => 200, ), - 'body' => wp_json_encode( $body_object ), + 'body' => wp_json_encode( $body_object, JSON_UNESCAPED_SLASHES ), ); }; diff --git a/projects/plugins/jetpack/tests/php/modules/widgets/Jetpack_Display_Posts_Widget_Test.php b/projects/plugins/jetpack/tests/php/modules/widgets/Jetpack_Display_Posts_Widget_Test.php index 79689499c73c..c7470d78f867 100644 --- a/projects/plugins/jetpack/tests/php/modules/widgets/Jetpack_Display_Posts_Widget_Test.php +++ b/projects/plugins/jetpack/tests/php/modules/widgets/Jetpack_Display_Posts_Widget_Test.php @@ -147,7 +147,8 @@ public function test_parse_service_response_body_has_error() { 'code' => 200, ), 'body' => json_encode( - array( 'error' => 'test error' ) + array( 'error' => 'test error' ), + JSON_UNESCAPED_SLASHES ), ); @@ -170,7 +171,8 @@ public function test_parse_service_response_valid_body() { 'code' => 200, ), 'body' => json_encode( - array( 'mydata' => 'your data' ) + array( 'mydata' => 'your data' ), + JSON_UNESCAPED_SLASHES ), ); diff --git a/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Full_Test.php b/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Full_Test.php index 0e7272511d6c..02608fbceea3 100644 --- a/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Full_Test.php +++ b/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Full_Test.php @@ -1042,7 +1042,8 @@ function ( $preempt, $parsed_args, $url ) { ), ), 'translations' => array(), - ) + ), + JSON_UNESCAPED_SLASHES ), ); }, diff --git a/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Functions_Test.php b/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Functions_Test.php index bf79096b88dc..0fd4c5d01c14 100644 --- a/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Functions_Test.php +++ b/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Functions_Test.php @@ -191,7 +191,7 @@ public function add_test_block() { } public function assertCallableIsSynced( $name, $value ) { - $this->assertEqualsObject( $value, $this->server_replica_storage->get_callable( $name ), 'Function ' . $name . ' didn\'t have the expected value of ' . json_encode( $value ) ); + $this->assertEqualsObject( $value, $this->server_replica_storage->get_callable( $name ), 'Function ' . $name . ' didn\'t have the expected value of ' . json_encode( $value, JSON_UNESCAPED_SLASHES ) ); } public function test_white_listed_callables_doesnt_get_synced_twice() { diff --git a/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Meta_Test.php b/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Meta_Test.php index 102894b731f2..75c35e8d5d71 100644 --- a/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Meta_Test.php +++ b/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Meta_Test.php @@ -206,7 +206,7 @@ public function test_sync_whitelisted_post_meta() { if ( $meta_key === 'footnotes' ) { // WordPress would filter non-array into an empty string, and fail the test // See sanitize_post_meta_footnotes filter - add_post_meta( $this->post_id, $meta_key, wp_json_encode( array() ) ); + add_post_meta( $this->post_id, $meta_key, wp_json_encode( array(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE ) ); continue; } add_post_meta( $this->post_id, $meta_key, 'foo' ); diff --git a/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Options_Test.php b/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Options_Test.php index ab95c853ccf0..fb1517f868b6 100644 --- a/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Options_Test.php +++ b/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Options_Test.php @@ -232,7 +232,7 @@ public function test_sync_default_options() { 'wordads_ccpa_enabled' => false, 'wordads_ccpa_privacy_policy_url' => 'pineapple', 'woocommerce_custom_orders_table_enabled' => false, - 'site_user_type' => wp_json_encode( array( 1 => 'pineapple' ) ), + 'site_user_type' => wp_json_encode( array( 1 => 'pineapple' ), JSON_UNESCAPED_SLASHES ), 'site_segment' => 'pineapple', 'site_vertical' => 'pineapple', 'jetpack_excluded_extensions' => 'pineapple', @@ -344,7 +344,7 @@ public function test_sync_default_contentless_options() { } public function assertOptionIsSynced( $option_name, $value ) { - $this->assertEqualsObject( $value, $this->server_replica_storage->get_option( $option_name ), 'Option ' . $option_name . ' didn\'t have the expected value of ' . wp_json_encode( $value ) ); + $this->assertEqualsObject( $value, $this->server_replica_storage->get_option( $option_name ), 'Option ' . $option_name . ' didn\'t have the expected value of ' . wp_json_encode( $value, JSON_UNESCAPED_SLASHES ) ); } public function add_jetpack_options_whitelist_filter( $options ) { diff --git a/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_TestBase.php b/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_TestBase.php index 39bebe06491c..72653f723887 100644 --- a/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_TestBase.php +++ b/projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_TestBase.php @@ -207,7 +207,7 @@ public function serverReceive( $data, $codec, $sent_timestamp, $queue_id ) { } public function pre_http_request_success() { - return array( 'body' => json_encode( array( 'success' => true ) ) ); + return array( 'body' => json_encode( array( 'success' => true ), JSON_UNESCAPED_SLASHES ) ); } /** @@ -245,7 +245,8 @@ public static function pre_http_request_wordpress_org_updates( $preempt, $args, ), ), 'translations' => array(), - ) + ), + JSON_UNESCAPED_SLASHES ), ); } @@ -266,7 +267,8 @@ public static function pre_http_request_wordpress_org_updates( $preempt, $args, ), 'translations' => array(), 'no_update' => array(), - ) + ), + JSON_UNESCAPED_SLASHES ), ); } @@ -288,7 +290,8 @@ public static function pre_http_request_wordpress_org_updates( $preempt, $args, 'no_update' => array( 'jetpack/jetpack.php' => true, ), - ) + ), + JSON_UNESCAPED_SLASHES ), ); } @@ -319,7 +322,8 @@ public static function pre_http_request_bruteprotect_api( $preempt, $args, $url 'msg' => 'API Key Required', 'seconds_remaining' => 60, 'error' => 'API Key Required', - ) + ), + JSON_UNESCAPED_SLASHES ), ); } diff --git a/projects/plugins/protect/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/protect/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/plugins/protect/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/protect/src/class-jetpack-protect.php b/projects/plugins/protect/src/class-jetpack-protect.php index 4295d2d8dd53..bb53b67593e6 100644 --- a/projects/plugins/protect/src/class-jetpack-protect.php +++ b/projects/plugins/protect/src/class-jetpack-protect.php @@ -202,7 +202,7 @@ public function enqueue_admin_scripts() { * @return string */ public function render_initial_state() { - return 'var jetpackProtectInitialState=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( $this->initial_state() ) ) . '"));'; + return 'var jetpackProtectInitialState=' . wp_json_encode( $this->initial_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } /** diff --git a/projects/plugins/protect/src/class-threats.php b/projects/plugins/protect/src/class-threats.php index 11030a4c29ef..0210c76a685f 100644 --- a/projects/plugins/protect/src/class-threats.php +++ b/projects/plugins/protect/src/class-threats.php @@ -53,7 +53,7 @@ public static function update_threat( $threat_id, $updates ) { "$api_base/$threat_id", '2', array( 'method' => 'POST' ), - wp_json_encode( $updates ), + wp_json_encode( $updates, JSON_UNESCAPED_SLASHES ), 'wpcom' ); @@ -112,7 +112,8 @@ public static function fix_threats( $threat_ids ) { wp_json_encode( array( 'threat_ids' => $threat_ids, - ) + ), + JSON_UNESCAPED_SLASHES ), 'wpcom' ); diff --git a/projects/plugins/starter-plugin/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/starter-plugin/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/plugins/starter-plugin/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/starter-plugin/src/class-jetpack-starter-plugin.php b/projects/plugins/starter-plugin/src/class-jetpack-starter-plugin.php index ef1afe8be4bf..d51d3f4a0a86 100644 --- a/projects/plugins/starter-plugin/src/class-jetpack-starter-plugin.php +++ b/projects/plugins/starter-plugin/src/class-jetpack-starter-plugin.php @@ -99,7 +99,7 @@ public function enqueue_admin_scripts() { * @return string */ public function render_initial_state() { - return 'var jetpackStarterPluginInitialState=JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( $this->initial_state() ) ) . '"));'; + return 'var jetpackStarterPluginInitialState=' . wp_json_encode( $this->initial_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';'; } /** diff --git a/projects/plugins/super-cache/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/super-cache/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/plugins/super-cache/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/super-cache/wp-cache-phase2.php b/projects/plugins/super-cache/wp-cache-phase2.php index 45c99579c59c..0cb613de1d41 100644 --- a/projects/plugins/super-cache/wp-cache-phase2.php +++ b/projects/plugins/super-cache/wp-cache-phase2.php @@ -778,9 +778,9 @@ function wpsc_dump_get_request() { } if ( function_exists( 'wp_json_encode' ) ) { - $string = wp_json_encode( $_GET ); + $string = wp_json_encode( $_GET, JSON_UNESCAPED_SLASHES ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended } else { - $string = json_encode( $_GET ); + $string = json_encode( $_GET, JSON_UNESCAPED_SLASHES ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.WP.AlternativeFunctions.json_encode_json_encode } return $string; @@ -2947,7 +2947,7 @@ function wp_cache_shutdown_callback() { } } - $serial = '' . json_encode( $wp_cache_meta ); + $serial = '' . wp_json_encode( $wp_cache_meta, JSON_UNESCAPED_SLASHES ); $dir = get_current_url_supercache_dir(); if ( @is_dir( $dir ) == false ) { @wp_mkdir_p( $dir ); diff --git a/projects/plugins/super-cache/wp-cache.php b/projects/plugins/super-cache/wp-cache.php index 44f990e2d8a9..d035ad75465c 100644 --- a/projects/plugins/super-cache/wp-cache.php +++ b/projects/plugins/super-cache/wp-cache.php @@ -3383,7 +3383,7 @@ function wpsc_update_active_preload( $group = null, $progress = null, $url = nul $filename = wpsc_get_preload_status_file_path(); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents - if ( false === file_put_contents( $filename, wp_json_encode( $preload_status ) ) ) { + if ( false === file_put_contents( $filename, wp_json_encode( $preload_status, JSON_UNESCAPED_SLASHES ) ) ) { wp_cache_debug( "wpsc_update_active_preload: failed to write to $filename" ); } } @@ -3403,7 +3403,7 @@ function wpsc_update_idle_preload( $finish_time = null ) { $filename = wpsc_get_preload_status_file_path(); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents - if ( false === file_put_contents( $filename, wp_json_encode( $preload_status ) ) ) { + if ( false === file_put_contents( $filename, wp_json_encode( $preload_status, JSON_UNESCAPED_SLASHES ) ) ) { wp_cache_debug( "wpsc_update_idle_preload: failed to write to $filename" ); } } diff --git a/projects/plugins/vaultpress/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/vaultpress/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/plugins/vaultpress/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/vaultpress/vaultpress.php b/projects/plugins/vaultpress/vaultpress.php index 52ee02b67a8e..d793c341653c 100644 --- a/projects/plugins/vaultpress/vaultpress.php +++ b/projects/plugins/vaultpress/vaultpress.php @@ -2836,7 +2836,7 @@ function updated_auto_register_option( $old_value, $value ) { if ( $this->check_connection( true ) ) { $registration['action'] = 'response'; $registration['error'] = 'VaultPress is already registered on this site.'; - update_option( $this->auto_register_option, json_encode( $registration ) ); + update_option( $this->auto_register_option, wp_json_encode( $registration, JSON_UNESCAPED_SLASHES ) ); return; } @@ -2857,7 +2857,7 @@ function updated_auto_register_option( $old_value, $value ) { $registration['error'] = false; } - update_option( $this->auto_register_option, json_encode( $registration ) ); + update_option( $this->auto_register_option, wp_json_encode( $registration, JSON_UNESCAPED_SLASHES ) ); } function add_global_actions_and_filters() { diff --git a/projects/plugins/wpcomsh/changelog/fix-audit_json_encode_flags_part_trois b/projects/plugins/wpcomsh/changelog/fix-audit_json_encode_flags_part_trois new file mode 100644 index 000000000000..f140a52a9274 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/fix-audit_json_encode_flags_part_trois @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure proper flags are used with `json_encode()`. diff --git a/projects/plugins/wpcomsh/class-wpcomsh-cli-commands.php b/projects/plugins/wpcomsh/class-wpcomsh-cli-commands.php index 188f56ce542c..e89b2f079565 100644 --- a/projects/plugins/wpcomsh/class-wpcomsh-cli-commands.php +++ b/projects/plugins/wpcomsh/class-wpcomsh-cli-commands.php @@ -531,7 +531,7 @@ public function persistent_data( $args, $assoc_args ) { } if ( 'json' === $assoc_args['format'] ) { - $output = wp_json_encode( $output, JSON_PRETTY_PRINT ); + $output = wp_json_encode( $output, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ); } WP_CLI::log( print_r( $output, true ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r @@ -569,7 +569,7 @@ public function purchases( $args, $assoc_args ) { // phpcs:ignore Generic.CodeAn public function headstart_terms( $args, $assoc_args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter, VariableAnalysis.CodeAnalysis.VariableAnalysis $results = wpcomsh_apply_headstart_terms(); $missing_taxonomies = $results['missing_taxonomies']; - $output = wp_json_encode( array( 'missing_taxonomies' => $missing_taxonomies ), JSON_PRETTY_PRINT ); + $output = wp_json_encode( array( 'missing_taxonomies' => $missing_taxonomies ), JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ); WP_CLI::log( $output ); } @@ -687,7 +687,7 @@ public function global_styles( $args, $assoc_args ) { if ( $action === 'list' ) { $global_styles = $response->get_data(); $global_styles = ! empty( $field_path ) ? _wp_array_get( $global_styles, $field_path ) : $global_styles; - WP_CLI::log( wp_json_encode( $global_styles, JSON_PRETTY_PRINT ) ); + WP_CLI::log( wp_json_encode( $global_styles, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) ); return; } @@ -710,7 +710,7 @@ public function global_styles( $args, $assoc_args ) { _wp_array_set( $global_styles, $field_path, $value ); if ( $dry_run ) { - WP_CLI::log( wp_json_encode( $global_styles, JSON_PRETTY_PRINT ) ); + WP_CLI::log( wp_json_encode( $global_styles, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) ); } else { $request = new \WP_REST_Request( 'POST', "/wp/v2/global-styles/$active_global_styles_id" ); $request->set_query_params( $global_styles ); @@ -719,7 +719,7 @@ public function global_styles( $args, $assoc_args ) { WP_CLI::error( $response->as_error() ); } - WP_CLI::log( wp_json_encode( $response->get_data(), JSON_PRETTY_PRINT ) ); + WP_CLI::log( wp_json_encode( $response->get_data(), JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) ); } WP_CLI::success( "Update the data field `$field` successfully" ); @@ -744,7 +744,7 @@ public function global_styles( $args, $assoc_args ) { unset( $current[ $field_path[ $i ] ] ); if ( $dry_run ) { - WP_CLI::log( wp_json_encode( $global_styles, JSON_PRETTY_PRINT ) ); + WP_CLI::log( wp_json_encode( $global_styles, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) ); } else { $request = new \WP_REST_Request( 'POST', "/wp/v2/global-styles/$active_global_styles_id" ); $request->set_query_params( $global_styles ); @@ -753,7 +753,7 @@ public function global_styles( $args, $assoc_args ) { WP_CLI::error( $response->as_error() ); } - WP_CLI::log( wp_json_encode( $response->get_data(), JSON_PRETTY_PRINT ) ); + WP_CLI::log( wp_json_encode( $response->get_data(), JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) ); } WP_CLI::success( "Removing the data field `$field` successfully" ); diff --git a/projects/plugins/wpcomsh/class-wpcomsh-log.php b/projects/plugins/wpcomsh/class-wpcomsh-log.php index 9df400b5da36..d3dba5278680 100644 --- a/projects/plugins/wpcomsh/class-wpcomsh-log.php +++ b/projects/plugins/wpcomsh/class-wpcomsh-log.php @@ -132,7 +132,7 @@ public function send_to_api() { 'messages' => $this->log_queue, ); - wp_remote_post( self::$log_endpoint, array( 'body' => array( 'error' => wp_json_encode( $payload ) ) ) ); + wp_remote_post( self::$log_endpoint, array( 'body' => array( 'error' => wp_json_encode( $payload, JSON_UNESCAPED_SLASHES ) ) ) ); } } } diff --git a/projects/plugins/wpcomsh/feature-plugins/full-site-editing.php b/projects/plugins/wpcomsh/feature-plugins/full-site-editing.php index e33c531e66bd..9e1bd4745761 100644 --- a/projects/plugins/wpcomsh/feature-plugins/full-site-editing.php +++ b/projects/plugins/wpcomsh/feature-plugins/full-site-editing.php @@ -201,7 +201,8 @@ function logstash_log_global_styles( $message ) { 'trace' => ( new Exception() )->getTraceAsString(), 'atomic_site_id' => wpcomsh_get_atomic_site_id(), ), - ) + ), + JSON_UNESCAPED_SLASHES ); // We FAF the call to the logging endpoint. diff --git a/projects/plugins/wpcomsh/jetpack-token-error-header/class-atomic-record-jetpack-token-errors.php b/projects/plugins/wpcomsh/jetpack-token-error-header/class-atomic-record-jetpack-token-errors.php index a2071e18f770..209510d9c40d 100644 --- a/projects/plugins/wpcomsh/jetpack-token-error-header/class-atomic-record-jetpack-token-errors.php +++ b/projects/plugins/wpcomsh/jetpack-token-error-header/class-atomic-record-jetpack-token-errors.php @@ -53,7 +53,7 @@ public static function signature_error_header( $error ) { header( sprintf( 'X-Jetpack-Signature-Error-Details: %s', - base64_encode( wp_json_encode( $error_data['signature_details'] ) ) // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode + base64_encode( wp_json_encode( $error_data['signature_details'], JSON_UNESCAPED_SLASHES ) ) // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode ) ); } diff --git a/projects/plugins/wpcomsh/notices/anyone-can-register-notice.php b/projects/plugins/wpcomsh/notices/anyone-can-register-notice.php index 91453707c3ca..00acfb823622 100644 --- a/projects/plugins/wpcomsh/notices/anyone-can-register-notice.php +++ b/projects/plugins/wpcomsh/notices/anyone-can-register-notice.php @@ -144,11 +144,11 @@ function wpcomsh_anyone_register_warning() { $( document ).ready( function() { $( ".anyone-can-register-notice .notice-dismiss" ).on( "click", function() { $.ajax( { - url: ' . wp_json_encode( esc_url_raw( admin_url( 'admin-ajax.php' ) ) ) . ', + url: ' . wp_json_encode( esc_url_raw( admin_url( 'admin-ajax.php' ) ), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ', type: "POST", data: { action: "anyone_can_register_dismiss_notice", - _ajax_nonce: ' . wp_json_encode( $nonce ) . ' + _ajax_nonce: ' . wp_json_encode( $nonce, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ' }, error: function( xhr, status, error ) { alert( error ); diff --git a/projects/plugins/wpcomsh/privacy/class-wp-privacy-participating-plugins.php b/projects/plugins/wpcomsh/privacy/class-wp-privacy-participating-plugins.php index f741d8abc04c..24970431234e 100644 --- a/projects/plugins/wpcomsh/privacy/class-wp-privacy-participating-plugins.php +++ b/projects/plugins/wpcomsh/privacy/class-wp-privacy-participating-plugins.php @@ -84,8 +84,8 @@ public function maybe_add_erasers_info() { ?> diff --git a/projects/plugins/wpcomsh/tests/FeaturedImageInEmailTest.php b/projects/plugins/wpcomsh/tests/FeaturedImageInEmailTest.php index dfa915b6ad7b..1cf57b79b949 100644 --- a/projects/plugins/wpcomsh/tests/FeaturedImageInEmailTest.php +++ b/projects/plugins/wpcomsh/tests/FeaturedImageInEmailTest.php @@ -45,7 +45,8 @@ public function test_sites_before_may_2_2025_return_false() { 'options' => array( 'created_at' => '2025-03-15T10:30:00Z', // March 15, 2025 ), - ) + ), + JSON_UNESCAPED_SLASHES ), ); @@ -69,7 +70,8 @@ public function test_sites_after_may_2_2025_return_true() { 'options' => array( 'created_at' => '2025-07-15T10:30:00Z', // July 15, 2025 ), - ) + ), + JSON_UNESCAPED_SLASHES ), ); @@ -140,7 +142,8 @@ public function test_malformed_api_responses_return_false() { 'options' => array( // No created_at field ), - ) + ), + JSON_UNESCAPED_SLASHES ), ); diff --git a/projects/plugins/wpcomsh/tests/FrontendNoticesTest.php b/projects/plugins/wpcomsh/tests/FrontendNoticesTest.php index a2c20293a9b2..8b7d92264181 100644 --- a/projects/plugins/wpcomsh/tests/FrontendNoticesTest.php +++ b/projects/plugins/wpcomsh/tests/FrontendNoticesTest.php @@ -20,7 +20,7 @@ public function test_should_display_gift_notice_when_plan_expired() { 'expiry_date' => ( new DateTime() )->sub( new DateInterval( 'P1D' ) )->format( 'c' ), 'auto_renew' => false, ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ), JSON_UNESCAPED_SLASHES ) ); $gifting_banner = new Gifting_Banner(); $this->assertTrue( $gifting_banner->should_display_expiring_plan_notice() ); } @@ -34,7 +34,7 @@ public function test_should_display_gift_notice_when_monthly_plan_expiring_under 'expiry_date' => ( new DateTime() )->add( new DateInterval( 'P4D' ) )->format( 'c' ), 'auto_renew' => false, ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ), JSON_UNESCAPED_SLASHES ) ); $gifting_banner = new Gifting_Banner(); $this->assertTrue( $gifting_banner->should_display_expiring_plan_notice() ); } @@ -48,7 +48,7 @@ public function test_should_not_display_gift_notice_when_monthly_plan_expiring_m 'expiry_date' => ( new DateTime() )->add( new DateInterval( 'P6D' ) )->format( 'c' ), 'auto_renew' => false, ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ), JSON_UNESCAPED_SLASHES ) ); $gifting_banner = new Gifting_Banner(); $this->assertFalse( $gifting_banner->should_display_expiring_plan_notice() ); } @@ -62,7 +62,7 @@ public function test_should_display_gift_notice_when_annual_plan_expiring_under_ 'expiry_date' => ( new DateTime() )->add( new DateInterval( 'P53D' ) )->format( 'c' ), 'auto_renew' => false, ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ), JSON_UNESCAPED_SLASHES ) ); $gifting_banner = new Gifting_Banner(); $this->assertTrue( $gifting_banner->should_display_expiring_plan_notice() ); } @@ -76,7 +76,7 @@ public function test_should_not_display_gift_notice_when_annual_plan_expiring_mo 'expiry_date' => ( new DateTime() )->add( new DateInterval( 'P55D' ) )->format( 'c' ), 'auto_renew' => false, ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ), JSON_UNESCAPED_SLASHES ) ); $gifting_banner = new Gifting_Banner(); $this->assertFalse( $gifting_banner->should_display_expiring_plan_notice() ); } @@ -89,7 +89,7 @@ public function test_should_not_display_gift_notice_when_plan_unknown() { 'product_slug' => 'unknown', 'expiry_date' => ( new DateTime() )->sub( new DateInterval( 'P1D' ) )->format( 'c' ), ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ), JSON_UNESCAPED_SLASHES ) ); $gifting_banner = new Gifting_Banner(); $this->assertFalse( $gifting_banner->should_display_expiring_plan_notice() ); } @@ -103,7 +103,7 @@ public function test_should_not_display_gift_notice_when_plan_auto_renew_on() { 'expiry_date' => ( new DateTime() )->sub( new DateInterval( 'P1D' ) )->format( 'c' ), 'auto_renew' => true, ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ), JSON_UNESCAPED_SLASHES ) ); $gifting_banner = new Gifting_Banner(); $this->assertFalse( $gifting_banner->should_display_expiring_plan_notice() ); } @@ -117,7 +117,7 @@ public function test_should_display_gift_notice_when_option_true() { 'expiry_date' => ( new DateTime() )->sub( new DateInterval( 'P1D' ) )->format( 'c' ), 'auto_renew' => true, ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ), JSON_UNESCAPED_SLASHES ) ); $gifting_banner = new Gifting_Banner(); add_option( 'wpcom_gifting_subscription', true ); $this->assertTrue( $gifting_banner->should_display_expiring_plan_notice() ); @@ -133,7 +133,7 @@ public function test_should_not_display_gift_notice_when_gifting_option_disabled 'expiry_date' => ( new DateTime() )->sub( new DateInterval( 'P1D' ) )->format( 'c' ), 'auto_renew' => false, ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ), JSON_UNESCAPED_SLASHES ) ); $gifting_banner = new Gifting_Banner(); $this->assertTrue( $gifting_banner->should_display_expiring_plan_notice() ); @@ -146,7 +146,7 @@ public function test_should_not_display_gift_notice_when_gifting_option_disabled * Test should not display gift notice when no purchases. */ public function test_should_not_display_gift_notice_when_no_purchases() { - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array() ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array(), JSON_UNESCAPED_SLASHES ) ); $gifting_banner = new Gifting_Banner(); $this->assertFalse( $gifting_banner->should_display_expiring_plan_notice() ); } diff --git a/projects/plugins/wpcomsh/tests/PlanNoticesTest.php b/projects/plugins/wpcomsh/tests/PlanNoticesTest.php index b0b7b35eedb7..ca6dd9ac4041 100644 --- a/projects/plugins/wpcomsh/tests/PlanNoticesTest.php +++ b/projects/plugins/wpcomsh/tests/PlanNoticesTest.php @@ -43,7 +43,7 @@ public function test_plan_notices() { 'product_slug' => 'business-bundle', 'expiry_date' => ( new DateTime() )->add( new DateInterval( 'P7D' ) )->format( 'c' ), ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $business_plan_purchase ), JSON_UNESCAPED_SLASHES ) ); $plan_date = gmdate( 'F j, Y', time() + WEEK_IN_SECONDS ); diff --git a/projects/plugins/wpcomsh/tests/WpcomFeaturesTest.php b/projects/plugins/wpcomsh/tests/WpcomFeaturesTest.php index c6411fb8cd1e..b7b4d2640619 100644 --- a/projects/plugins/wpcomsh/tests/WpcomFeaturesTest.php +++ b/projects/plugins/wpcomsh/tests/WpcomFeaturesTest.php @@ -29,7 +29,7 @@ public function test_no_fatal_errors() { */ public function test_works_with_persistent_data() { $purchase = array( 'product_slug' => 'business-bundle' ); - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $purchase ), JSON_UNESCAPED_SLASHES ) ); $this->assertTrue( wpcom_site_has_feature( WPCOM_Features::CONCIERGE_BUSINESS ) ); $this->assertFalse( wpcom_site_has_feature( WPCOM_Features::ECOMMERCE_MANAGED_PLUGINS ) ); diff --git a/projects/plugins/wpcomsh/tests/feature-manager/FeatureHookTest.php b/projects/plugins/wpcomsh/tests/feature-manager/FeatureHookTest.php index 77a310214058..60bd045510ee 100644 --- a/projects/plugins/wpcomsh/tests/feature-manager/FeatureHookTest.php +++ b/projects/plugins/wpcomsh/tests/feature-manager/FeatureHookTest.php @@ -25,7 +25,7 @@ public function test_wpcomsh_map_feature_cap_with_atomic_supported_plan() { ); // Give the site an atomic supported plan. - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $purchase ), JSON_UNESCAPED_SLASHES ) ); $input_caps = array( 'edit_themes' ); $theme_caps = wpcomsh_map_feature_cap( $input_caps, 'edit_themes' ); @@ -50,7 +50,7 @@ public function test_wpcomsh_map_feature_cap_without_the_required_features() { ); // Give the site no purchases. - Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $purchase ) ) ); + Atomic_Persistent_Data::set( 'WPCOM_PURCHASES', wp_json_encode( array( $purchase ), JSON_UNESCAPED_SLASHES ) ); $input_caps = array( 'edit_themes' ); $theme_caps = wpcomsh_map_feature_cap( $input_caps, 'edit_themes' ); diff --git a/projects/plugins/wpcomsh/widgets/class-wpcom-widget-reservations.php b/projects/plugins/wpcomsh/widgets/class-wpcom-widget-reservations.php index a4bf322a7edb..18ee06d1035b 100644 --- a/projects/plugins/wpcomsh/widgets/class-wpcom-widget-reservations.php +++ b/projects/plugins/wpcomsh/widgets/class-wpcom-widget-reservations.php @@ -122,16 +122,16 @@ public function widget( $args, $instance ) { $contact_form_shortcode .= "[contact-field label='" . esc_attr( $this->fields['phone'] ) . "' type='text'/]"; } if ( in_array( 'adults', $instance['show'], true ) ) { - $contact_form_shortcode .= "[contact-field label='" . esc_attr( $this->fields['adults'] ) . "' type='text' data='" . esc_attr( wp_json_encode( array( 'field-size' => 'small' ) ) ) . "'/]"; + $contact_form_shortcode .= "[contact-field label='" . esc_attr( $this->fields['adults'] ) . "' type='text' data='" . esc_attr( wp_json_encode( array( 'field-size' => 'small' ), JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ) . "'/]"; } if ( in_array( 'children', $instance['show'], true ) ) { - $contact_form_shortcode .= "[contact-field label='" . esc_attr( $this->fields['children'] ) . "' type='text' data='" . esc_attr( wp_json_encode( array( 'field-size' => 'small' ) ) ) . "'/]"; + $contact_form_shortcode .= "[contact-field label='" . esc_attr( $this->fields['children'] ) . "' type='text' data='" . esc_attr( wp_json_encode( array( 'field-size' => 'small' ), JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ) . "'/]"; } if ( in_array( 'arrival', $instance['show'], true ) ) { - $contact_form_shortcode .= "[contact-field label='" . esc_attr( $this->fields['arrival'] ) . "' type='date' data='" . esc_attr( wp_json_encode( array( 'field-size' => 'small' ) ) ) . "'/]"; + $contact_form_shortcode .= "[contact-field label='" . esc_attr( $this->fields['arrival'] ) . "' type='date' data='" . esc_attr( wp_json_encode( array( 'field-size' => 'small' ), JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ) . "'/]"; } if ( in_array( 'departure', $instance['show'], true ) ) { - $contact_form_shortcode .= "[contact-field label='" . esc_attr( $this->fields['departure'] ) . "' type='date' data='" . esc_attr( wp_json_encode( array( 'field-size' => 'small' ) ) ) . "'/]"; + $contact_form_shortcode .= "[contact-field label='" . esc_attr( $this->fields['departure'] ) . "' type='date' data='" . esc_attr( wp_json_encode( array( 'field-size' => 'small' ), JSON_HEX_AMP | JSON_UNESCAPED_SLASHES ) ) . "'/]"; } if ( in_array( 'message', $instance['show'], true ) ) { $contact_form_shortcode .= "[contact-field label='" . esc_attr( $this->fields['message'] ) . "' type='textarea' /]"; diff --git a/projects/plugins/wpcomsh/wpcomsh.php b/projects/plugins/wpcomsh/wpcomsh.php index b997f2ad4260..2051246386a5 100644 --- a/projects/plugins/wpcomsh/wpcomsh.php +++ b/projects/plugins/wpcomsh/wpcomsh.php @@ -533,7 +533,7 @@ function wpcom_hide_scan_threats_from_api( $response ) { } $json_body['threats'] = array(); - $response_data['data'] = wp_json_encode( $json_body ); + $response_data['data'] = wp_json_encode( $json_body, JSON_UNESCAPED_SLASHES ); $response->set_data( $response_data ); return $response; @@ -613,7 +613,7 @@ function wpcomsh_footer_rum_js() { $rum_kv['wptheme_is_block'] = wp_is_block_theme() ? '1' : '0'; if ( count( $rum_kv ) > 0 ) { - $rum_kv = wp_json_encode( $rum_kv, JSON_FORCE_OBJECT ); + $rum_kv = wp_json_encode( $rum_kv, JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES | JSON_HEX_AMP ); if ( is_string( $rum_kv ) ) { $rum_kv = 'data-customproperties="' . esc_attr( $rum_kv ) . '"'; } else { From 73322435339db1c58d832a16ad32e29d685da03b Mon Sep 17 00:00:00 2001 From: Erick Danzer Date: Thu, 4 Dec 2025 13:43:51 -0700 Subject: [PATCH 33/49] Forms: allow integration icon customization (#46188) --- .../assets/images/integrations/akismet.svg | 14 +++++++ .../images/integrations/google-drive.svg | 6 +++ .../images/integrations/hostinger-reach.svg | 4 ++ .../assets/images/integrations/mailpoet.svg | 5 +++ .../assets/images/integrations/salesforce.svg | 13 ++++++ .../images/integrations/zero-bs-crm.svg | 4 ++ .../forms/changelog/add-forms-icons-filter | 4 ++ .../jetpack-integration-controls.js | 14 ++++--- .../active-integrations/index.js | 32 ++++++++------- .../integration-card/index.tsx | 3 -- .../integration-card-header.tsx | 41 ++++++++++++++----- .../integration-card/style.scss | 1 - .../integrations-list.tsx | 1 - .../forms/src/class-jetpack-forms.php | 21 ++++++++++ .../class-contact-form-endpoint.php | 11 +++++ projects/packages/forms/src/types/index.ts | 6 +++ .../jetpack/changelog/add-forms-icons-filter | 4 ++ 17 files changed, 148 insertions(+), 36 deletions(-) create mode 100644 projects/packages/forms/assets/images/integrations/akismet.svg create mode 100644 projects/packages/forms/assets/images/integrations/google-drive.svg create mode 100644 projects/packages/forms/assets/images/integrations/hostinger-reach.svg create mode 100644 projects/packages/forms/assets/images/integrations/mailpoet.svg create mode 100644 projects/packages/forms/assets/images/integrations/salesforce.svg create mode 100644 projects/packages/forms/assets/images/integrations/zero-bs-crm.svg create mode 100644 projects/packages/forms/changelog/add-forms-icons-filter create mode 100644 projects/plugins/jetpack/changelog/add-forms-icons-filter diff --git a/projects/packages/forms/assets/images/integrations/akismet.svg b/projects/packages/forms/assets/images/integrations/akismet.svg new file mode 100644 index 000000000000..b1adce8fd9d0 --- /dev/null +++ b/projects/packages/forms/assets/images/integrations/akismet.svg @@ -0,0 +1,14 @@ + + diff --git a/projects/packages/forms/assets/images/integrations/google-drive.svg b/projects/packages/forms/assets/images/integrations/google-drive.svg new file mode 100644 index 000000000000..8c20c8f59e32 --- /dev/null +++ b/projects/packages/forms/assets/images/integrations/google-drive.svg @@ -0,0 +1,6 @@ + + diff --git a/projects/packages/forms/assets/images/integrations/hostinger-reach.svg b/projects/packages/forms/assets/images/integrations/hostinger-reach.svg new file mode 100644 index 000000000000..e230ec9a5fa5 --- /dev/null +++ b/projects/packages/forms/assets/images/integrations/hostinger-reach.svg @@ -0,0 +1,4 @@ + + diff --git a/projects/packages/forms/assets/images/integrations/mailpoet.svg b/projects/packages/forms/assets/images/integrations/mailpoet.svg new file mode 100644 index 000000000000..70fffd2b03a7 --- /dev/null +++ b/projects/packages/forms/assets/images/integrations/mailpoet.svg @@ -0,0 +1,5 @@ + + diff --git a/projects/packages/forms/assets/images/integrations/salesforce.svg b/projects/packages/forms/assets/images/integrations/salesforce.svg new file mode 100644 index 000000000000..d0a764069d50 --- /dev/null +++ b/projects/packages/forms/assets/images/integrations/salesforce.svg @@ -0,0 +1,13 @@ + + diff --git a/projects/packages/forms/assets/images/integrations/zero-bs-crm.svg b/projects/packages/forms/assets/images/integrations/zero-bs-crm.svg new file mode 100644 index 000000000000..10038e5aea70 --- /dev/null +++ b/projects/packages/forms/assets/images/integrations/zero-bs-crm.svg @@ -0,0 +1,4 @@ + + diff --git a/projects/packages/forms/changelog/add-forms-icons-filter b/projects/packages/forms/changelog/add-forms-icons-filter new file mode 100644 index 000000000000..4ca230e6ad2e --- /dev/null +++ b/projects/packages/forms/changelog/add-forms-icons-filter @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Forms: add filter to hide integration icons. diff --git a/projects/packages/forms/src/blocks/contact-form/components/jetpack-integration-controls.js b/projects/packages/forms/src/blocks/contact-form/components/jetpack-integration-controls.js index 6656b1ce7f7b..7acdb996b202 100644 --- a/projects/packages/forms/src/blocks/contact-form/components/jetpack-integration-controls.js +++ b/projects/packages/forms/src/blocks/contact-form/components/jetpack-integration-controls.js @@ -5,6 +5,7 @@ import { useSelect, useDispatch } from '@wordpress/data'; import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { plugins } from '@wordpress/icons'; +import useConfigValue from '../../../hooks/use-config-value.ts'; import { INTEGRATIONS_STORE } from '../../../store/integrations/index.ts'; import ActiveIntegrations from './jetpack-integrations-modal/active-integrations/index.js'; import IntegrationsModal from './jetpack-integrations-modal/index.tsx'; @@ -26,6 +27,7 @@ export default function IntegrationControls( { attributes, setAttributes } ) { const isLoading = useSelect( select => select( INTEGRATIONS_STORE ).isIntegrationsLoading(), [] ); const { refreshIntegrations } = useDispatch( INTEGRATIONS_STORE ); const { tracks } = useAnalytics(); + const showIntegrationIcons = useConfigValue( 'showIntegrationIcons' ); const handleOpenModal = entry_point => { tracks.recordEvent( 'jetpack_forms_block_modal_view', { entry_point } ); @@ -39,11 +41,13 @@ export default function IntegrationControls( { attributes, setAttributes } ) { className="jetpack-contact-form__panel jetpack-contact-form__integrations-panel" initialOpen={ false } > - + { showIntegrationIcons !== false && ( + + ) }