diff --git a/.github/actions/tool-setup/action.yml b/.github/actions/tool-setup/action.yml index e2d0d453f6887..21436e1f4616b 100644 --- a/.github/actions/tool-setup/action.yml +++ b/.github/actions/tool-setup/action.yml @@ -21,11 +21,6 @@ runs: # Read tool versions . .github/versions.sh - if [[ "${INPUT_PHP:-$PHP_VERSION}" == 7.[01] ]]; then - printf "Downgrading composer for PHP %s\n\n" "${INPUT_PHP:-$PHP_VERSION}" - COMPOSER_VERSION=2.2.24 - fi - printf "\n\e[1mSelected tool versions\e[0m\n" echo " PHP: ${INPUT_PHP:-$PHP_VERSION}" echo "php-version=${INPUT_PHP:-$PHP_VERSION}" >> "$GITHUB_OUTPUT" diff --git a/projects/packages/assets/changelog/remove-pre_wp6.6_and_php7.2_code b/projects/packages/assets/changelog/remove-pre_wp6.6_and_php7.2_code new file mode 100644 index 0000000000000..ffe1f50b0df7d --- /dev/null +++ b/projects/packages/assets/changelog/remove-pre_wp6.6_and_php7.2_code @@ -0,0 +1,4 @@ +Significance: major +Type: removed + +Remove JSX runtime polyfill, now that we've dropped support for WordPress < 6.6. diff --git a/projects/packages/assets/src/class-assets.php b/projects/packages/assets/src/class-assets.php index 3177ab69573b6..71725eec465af 100644 --- a/projects/packages/assets/src/class-assets.php +++ b/projects/packages/assets/src/class-assets.php @@ -537,12 +537,6 @@ public static function wp_default_scripts_hook( $wp_scripts ) { $wp_scripts->add( 'wp-jp-i18n-state', false, array( 'wp-deprecated', $handle ) ); $wp_scripts->add_inline_script( 'wp-jp-i18n-state', 'wp.deprecated( "wp-jp-i18n-state", { alternative: "wp-jp-i18n-loader" } );' ); $wp_scripts->add_inline_script( 'wp-jp-i18n-state', 'wp.jpI18nState = wp.jpI18nLoader.state;' ); - - // Register the React JSX runtime script - used as a polyfill until we can update JSX transforms. See https://github.com/Automattic/jetpack/issues/38424. - // @todo Remove this when we drop support for WordPress 6.5, as well as the script inclusion in test_wp_default_scripts_hook. - $jsx_url = self::normalize_path( plugins_url( '../build/react-jsx-runtime.js', __FILE__ ) ); - $wp_scripts->add( 'react-jsx-runtime', $jsx_url, array( 'react' ), '18.3.1', true ); - $wp_scripts->add_data( 'react-jsx-runtime', 'group', 1 ); } // endregion . diff --git a/projects/packages/assets/tests/php/test-assets.php b/projects/packages/assets/tests/php/test-assets.php index a05ef64ad4b2a..a0a396272c85c 100644 --- a/projects/packages/assets/tests/php/test-assets.php +++ b/projects/packages/assets/tests/php/test-assets.php @@ -755,8 +755,7 @@ function ( $value ) use ( $value_sets, $i ) { return $funcs; }; - // @todo: Remove `react-jsx-runtime` from the list of dependencies once we drop support for WordPress 6.5 and remove the dependency from wp_default_scripts_hook. - $mock->expects( $this->exactly( 3 ) )->method( 'add' ) + $mock->expects( $this->exactly( 2 ) )->method( 'add' ) ->with( ...$with_consecutive( array( @@ -767,12 +766,7 @@ function ( $value ) use ( $value_sets, $i ) { ), array( 'wp-i18n' ), ), - array( 'wp-jp-i18n-state', false, array( 'wp-deprecated', 'wp-jp-i18n-loader' ) ), - array( - 'react-jsx-runtime', - 'http://www.example.com/wp-content/plugins/jetpack/packages/assets/build/react-jsx-runtime.js', - array( 'react' ), - ) + array( 'wp-jp-i18n-state', false, array( 'wp-deprecated', 'wp-jp-i18n-loader' ) ) ) ); $mock->expects( $this->exactly( 3 ) )->method( 'add_inline_script' ) @@ -783,11 +777,10 @@ function ( $value ) use ( $value_sets, $i ) { array( 'wp-jp-i18n-state', 'wp.jpI18nState = wp.jpI18nLoader.state;' ) ) ); - $mock->expects( $this->exactly( 2 ) )->method( 'add_data' ) + $mock->expects( $this->once() )->method( 'add_data' ) ->with( ...$with_consecutive( - array( 'wp-jp-i18n-loader', 'group', 1 ), - array( 'react-jsx-runtime', 'group', 1 ) + array( 'wp-jp-i18n-loader', 'group', 1 ) ) ); diff --git a/projects/packages/assets/webpack.config.js b/projects/packages/assets/webpack.config.js index 8a40e14b66367..8c2e9cb4d37e6 100644 --- a/projects/packages/assets/webpack.config.js +++ b/projects/packages/assets/webpack.config.js @@ -61,23 +61,4 @@ module.exports = [ } ), ], }, - { - entry: { - 'react-jsx-runtime': { - import: 'react/jsx-runtime', - }, - }, - output: { - ...jetpackWebpackConfig.output, - path: path.resolve( './build' ), - filename: 'react-jsx-runtime.js', - library: { - name: 'ReactJSXRuntime', - type: 'window', - }, - }, - externals: { - react: 'React', - }, - }, ]; diff --git a/projects/packages/autoloader/changelog/remove-pre_wp6.6_and_php7.2_code b/projects/packages/autoloader/changelog/remove-pre_wp6.6_and_php7.2_code new file mode 100644 index 0000000000000..a6f20a2b673a7 --- /dev/null +++ b/projects/packages/autoloader/changelog/remove-pre_wp6.6_and_php7.2_code @@ -0,0 +1,4 @@ +Significance: major +Type: removed + +Remove support for WordPress 6.5 and earlier. diff --git a/projects/packages/autoloader/src/class-latest-autoloader-guard.php b/projects/packages/autoloader/src/class-latest-autoloader-guard.php index 3b2a96693eca2..285fe739a40a3 100644 --- a/projects/packages/autoloader/src/class-latest-autoloader-guard.php +++ b/projects/packages/autoloader/src/class-latest-autoloader-guard.php @@ -131,13 +131,7 @@ public function check_for_conflicting_autoloaders() { foreach ( $composer_autoloader->getClassMap() as $classname => $path ) { if ( $jetpack_autoloader_loader->find_class_file( $classname ) ) { $msg = "A Composer autoloader is registered with a higher priority than the Jetpack Autoloader and would also handle some of the classes we handle (e.g. $classname => $path). This may cause strange and confusing problems."; - // @todo Remove the is_callable check once we drop support for WP 6.5. - if ( is_callable( 'wp_trigger_error' ) ) { - wp_trigger_error( '', $msg ); - } else { - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error - trigger_error( $msg ); - } + wp_trigger_error( '', $msg ); continue 2; } } @@ -145,13 +139,7 @@ public function check_for_conflicting_autoloaders() { if ( isset( $prefixes[ $prefix ] ) ) { $path = array_pop( $paths ); $msg = "A Composer autoloader is registered with a higher priority than the Jetpack Autoloader and would also handle some of the namespaces we handle (e.g. $prefix => $path). This may cause strange and confusing problems."; - // @todo Remove the is_callable check once we drop support for WP 6.5. - if ( is_callable( 'wp_trigger_error' ) ) { - wp_trigger_error( '', $msg ); - } else { - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error - trigger_error( $msg ); - } + wp_trigger_error( '', $msg ); continue 2; } } @@ -159,13 +147,7 @@ public function check_for_conflicting_autoloaders() { if ( isset( $prefixes[ $prefix ] ) ) { $path = array_pop( $paths ); $msg = "A Composer autoloader is registered with a higher priority than the Jetpack Autoloader and would also handle some of the namespaces we handle (e.g. $prefix => $path). This may cause strange and confusing problems."; - // @todo Remove the is_callable check once we drop support for WP 6.5. - if ( is_callable( 'wp_trigger_error' ) ) { - wp_trigger_error( '', $msg ); - } else { - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error - trigger_error( $msg ); - } + wp_trigger_error( '', $msg ); continue 2; } } diff --git a/projects/packages/autoloader/src/class-php-autoloader.php b/projects/packages/autoloader/src/class-php-autoloader.php index 519e8a1f4c808..f8765a4425f42 100644 --- a/projects/packages/autoloader/src/class-php-autoloader.php +++ b/projects/packages/autoloader/src/class-php-autoloader.php @@ -88,13 +88,7 @@ public static function load_class( $class_name ) { ) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_wp_debug_backtrace_summary -- This is a debug log message. $msg = "Jetpack Autoloader: Autoloading `$class_name` before the plugins_loaded hook may cause strange and confusing problems. " . wp_debug_backtrace_summary( '', 1 ); - // @todo Remove the is_callable check once we drop support for WP 6.5. - if ( is_callable( 'wp_trigger_error' ) ) { - wp_trigger_error( '', $msg ); - } else { - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error - trigger_error( $msg ); - } + wp_trigger_error( '', $msg ); } require $file; diff --git a/projects/packages/changelogger/changelog/remove-pre_wp6.6_and_php7.2_code b/projects/packages/changelogger/changelog/remove-pre_wp6.6_and_php7.2_code new file mode 100644 index 0000000000000..8bc7df4543fb6 --- /dev/null +++ b/projects/packages/changelogger/changelog/remove-pre_wp6.6_and_php7.2_code @@ -0,0 +1,5 @@ +Significance: patch +Type: removed +Comment: Additional cleanup of old PHP + WP version support. + + diff --git a/projects/packages/changelogger/changelog/upgrade_deprecation_to_exception b/projects/packages/changelogger/changelog/upgrade_deprecation_to_exception new file mode 100644 index 0000000000000..9e179fff05725 --- /dev/null +++ b/projects/packages/changelogger/changelog/upgrade_deprecation_to_exception @@ -0,0 +1,4 @@ +Significance: minor +Type: deprecated + +Using getChangesBySubheading() with a param now throws an exception. diff --git a/projects/packages/changelogger/lib/ChangelogEntry.php b/projects/packages/changelogger/lib/ChangelogEntry.php index 04e0fbe69d16e..a6f7b544595f6 100644 --- a/projects/packages/changelogger/lib/ChangelogEntry.php +++ b/projects/packages/changelogger/lib/ChangelogEntry.php @@ -268,15 +268,14 @@ public function appendChange( ChangeEntry $change ) { /** * Get the changes grouped by subheading. * - * @param string|null $subheading Subheading to retrieve. @deprecated since 4.2.0. Do `->getChangesBySubheading()[ $subheading ]` instead. + * @param string|null $subheading Subheading to retrieve. @deprecated since 4.2.0; now throws error. Do `->getChangesBySubheading()[ $subheading ]` instead. * @return array Change entries by subheading. - * Returns just the `ChangeEntry[]` if the deprecated `$subheading` parameter is used. + * @throws \InvalidArgumentException If the deprecated `$subheading` parameter is used. */ public function getChangesBySubheading( $subheading = null ) { if ( $subheading !== null ) { - // @todo Sometime for a major version bump, have this throw instead. Then remove it for a major bump after that. - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error - trigger_error( 'Passing a value for $subheading is deprecated. Do `->getChangesBySubheading()[ $subheading ]` instead.', E_USER_DEPRECATED ); + // @todo Remove this next major version bump. + throw new \InvalidArgumentException( 'Passing a value for $subheading is deprecated. Do `->getChangesBySubheading()[ $subheading ]` instead.' ); } $ret = array(); @@ -284,15 +283,15 @@ public function getChangesBySubheading( $subheading = null ) { $ret[ $entry->getSubheading() ][] = $entry; } - return null === $subheading - ? $ret - : ( $ret[ $subheading ] ?? array() ); + return $ret; } /** * Return data for serializing to JSON. * * @return array + * + * @todo Once we drop support for PHP <7.4, we should remove the attribute and add a `mixed` return type to match JsonSerializable. */ #[\ReturnTypeWillChange] public function jsonSerialize() { diff --git a/projects/packages/changelogger/tests/php/tests/lib/ChangelogEntryTest.php b/projects/packages/changelogger/tests/php/tests/lib/ChangelogEntryTest.php index be148d4ff27d2..7715158b5c297 100644 --- a/projects/packages/changelogger/tests/php/tests/lib/ChangelogEntryTest.php +++ b/projects/packages/changelogger/tests/php/tests/lib/ChangelogEntryTest.php @@ -98,12 +98,15 @@ public function testChanges() { $this->assertSame( array(), $entry->getChanges() ); $this->assertSame( array(), $entry->getChangesBySubheading() ); - error_clear_last(); - $this->assertSame( array(), @$entry->getChangesBySubheading( 'B' ) ); - $err = error_get_last(); - $this->assertNotNull( $err ); - $this->assertSame( E_USER_DEPRECATED, $err['type'] ); - $this->assertSame( 'Passing a value for $subheading is deprecated. Do `->getChangesBySubheading()[ $subheading ]` instead.', $err['message'] ); + + try { + $entry->getChangesBySubheading( 'B' ); + } catch ( \InvalidArgumentException $e ) { + $this->assertSame( + 'Passing a value for $subheading is deprecated. Do `->getChangesBySubheading()[ $subheading ]` instead.', + $e->getMessage() + ); + } $this->assertSame( $entry, $entry->setChanges( $changes ) ); $this->assertSame( $changes, $entry->getChanges() ); @@ -116,13 +119,6 @@ public function testChanges() { $entry->getChangesBySubheading() ); - error_clear_last(); - $this->assertSame( array( $changes[1], $changes[2] ), @$entry->getChangesBySubheading( 'B' ) ); - $err = error_get_last(); - $this->assertNotNull( $err ); - $this->assertSame( E_USER_DEPRECATED, $err['type'] ); - $this->assertSame( 'Passing a value for $subheading is deprecated. Do `->getChangesBySubheading()[ $subheading ]` instead.', $err['message'] ); - $c1 = new ChangeEntry( array( 'subheading' => 'B', @@ -155,13 +151,6 @@ public function testChanges() { $entry->getChangesBySubheading() ); - error_clear_last(); - $this->assertSame( array( $c2, $changes[1], $c1, $changes[2] ), @$entry->getChangesBySubheading( 'B' ) ); - $err = error_get_last(); - $this->assertNotNull( $err ); - $this->assertSame( E_USER_DEPRECATED, $err['type'] ); - $this->assertSame( 'Passing a value for $subheading is deprecated. Do `->getChangesBySubheading()[ $subheading ]` instead.', $err['message'] ); - $entry = new ChangelogEntry( '1.0' ); $this->assertSame( $entry, $entry->appendChange( $c1 )->appendChange( $c2 )->appendChange( $c3 ) ); $this->assertSame( array( $c1, $c2, $c3 ), $entry->getChanges() ); diff --git a/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php b/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php index 7616757f29a6a..956c2e5a22c6b 100644 --- a/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php +++ b/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php @@ -65,7 +65,7 @@ public function testRunCommand( $cmd, $options, $expectExitCode, $expectStdout, * Data provider for testRunCommand. */ public function provideRunCommand() { - $tmp = sys_get_temp_dir(); + $tmp = realpath( sys_get_temp_dir() ); return array( 'true' => array( diff --git a/projects/packages/jetpack-mu-wpcom/changelog/remove-pre_wp6.6_and_php7.2_code b/projects/packages/jetpack-mu-wpcom/changelog/remove-pre_wp6.6_and_php7.2_code new file mode 100644 index 0000000000000..8bc7df4543fb6 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/remove-pre_wp6.6_and_php7.2_code @@ -0,0 +1,5 @@ +Significance: patch +Type: removed +Comment: Additional cleanup of old PHP + WP version support. + + diff --git a/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css.php b/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css.php index eda09f550b0e1..425a55b548b6e 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css.php @@ -987,8 +987,7 @@ public static function update_custom_css_data( $args ) { public static function editor_max_image_size( $dims, $size = 'medium', $context = null ) { list( $width, $height ) = $dims; - // @phan-suppress-next-line PhanUndeclaredClassInCallable - if ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::get_content_width' ) && 'large' === $size && 'edit' === $context ) { + if ( class_exists( 'Jetpack' ) && 'large' === $size && 'edit' === $context ) { // @phan-suppress-next-line PhanUndeclaredClassMethod $width = Jetpack::get_content_width(); } @@ -1029,8 +1028,7 @@ public static function set_content_width() { return; } - // @phan-suppress-next-line PhanUndeclaredClassInCallable - if ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::get_content_width' ) ) { + if ( class_exists( 'Jetpack' ) ) { // @phan-suppress-next-line PhanUndeclaredClassMethod $GLOBALS['content_width'] = Jetpack::get_content_width(); } @@ -1078,8 +1076,7 @@ public static function load_revision_php() { * Enable CSS module. */ public static function custom_css_loaded() { - // @phan-suppress-next-line PhanUndeclaredClassInCallable - if ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::enable_module_configurable' ) ) { + if ( class_exists( 'Jetpack' ) ) { // @phan-suppress-next-line PhanUndeclaredClassMethod Jetpack::enable_module_configurable( __FILE__ ); } @@ -1252,4 +1249,4 @@ public function subvalue() { // phpcs:ignore MediaWiki.Usage.NestedFunctions.Nes } } } -endif; \ No newline at end of file +endif; 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 60fb6a1255fb9..51f060d585c12 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 @@ -11,8 +11,8 @@ * @return bool */ function is_jetpack_connected() { - // @phan-suppress-next-line PhanUndeclaredClassMethod, PhanUndeclaredClassInCallable - return class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_connection_ready' ) && Jetpack::is_connection_ready(); + // @phan-suppress-next-line PhanUndeclaredClassMethod + return class_exists( 'Jetpack' ) && Jetpack::is_connection_ready(); } /** diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/editor.scss b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/editor.scss index d5ba3e54a9a62..67d9cee322ff9 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/editor.scss +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/editor.scss @@ -22,10 +22,3 @@ width: 100%; } } - -// Fix so datetime picker doesn't have horizontal scrollbar. -// This is a global fix, unscoped, and not very nice. -// @todo: It won't be necessary once https://github.com/WordPress/gutenberg/pull/18235/files gets merged. -.components-datetime { - padding: 8px; -} diff --git a/projects/packages/masterbar/changelog/remove-pre_wp6.6_and_php7.2_code b/projects/packages/masterbar/changelog/remove-pre_wp6.6_and_php7.2_code new file mode 100644 index 0000000000000..8bc7df4543fb6 --- /dev/null +++ b/projects/packages/masterbar/changelog/remove-pre_wp6.6_and_php7.2_code @@ -0,0 +1,5 @@ +Significance: patch +Type: removed +Comment: Additional cleanup of old PHP + WP version support. + + diff --git a/projects/packages/masterbar/tests/php/test-class-atomic-additional-css-manager.php b/projects/packages/masterbar/tests/php/test-class-atomic-additional-css-manager.php index 649cf18ca6d26..942f870af979d 100644 --- a/projects/packages/masterbar/tests/php/test-class-atomic-additional-css-manager.php +++ b/projects/packages/masterbar/tests/php/test-class-atomic-additional-css-manager.php @@ -49,10 +49,9 @@ public function tear_down() { * Check if the nudge contains the proper url and message copy. */ public function test_it_generates_proper_url_and_nudge() { - // @phan-suppress-next-line PhanDeprecatedFunction -- Keep using setMethods until we drop PHP 7.0 support. $manager = $this->getMockBuilder( Atomic_Additional_CSS_Manager::class ) ->setConstructorArgs( array( 'foo.com' ) ) - ->setMethods( array( 'get_plan_name' ) ) + ->onlyMethods( array( 'get_plan_name' ) ) ->getMock(); $manager->method( 'get_plan_name' )->willReturn( 'Business' ); diff --git a/projects/packages/masterbar/tests/php/test-class-wpcom-additional-css-manager.php b/projects/packages/masterbar/tests/php/test-class-wpcom-additional-css-manager.php index 1ab2d052aa939..aed46f5d28b06 100644 --- a/projects/packages/masterbar/tests/php/test-class-wpcom-additional-css-manager.php +++ b/projects/packages/masterbar/tests/php/test-class-wpcom-additional-css-manager.php @@ -40,10 +40,9 @@ public function set_up() { * Check if the manager constructs the proper url and copy message. */ public function test_it_generates_proper_url_and_nudge() { - // @phan-suppress-next-line PhanDeprecatedFunction -- Keep using setMethods until we drop PHP 7.0 support. $manager = $this->getMockBuilder( WPCOM_Additional_CSS_Manager::class ) ->setConstructorArgs( array( 'foo.com' ) ) - ->setMethods( array( 'get_plan' ) ) + ->onlyMethods( array( 'get_plan' ) ) ->getMock(); $manager->method( 'get_plan' )->willReturn( diff --git a/projects/packages/status/changelog/remove-pre_wp6.6_and_php7.2_code b/projects/packages/status/changelog/remove-pre_wp6.6_and_php7.2_code new file mode 100644 index 0000000000000..8bc7df4543fb6 --- /dev/null +++ b/projects/packages/status/changelog/remove-pre_wp6.6_and_php7.2_code @@ -0,0 +1,5 @@ +Significance: patch +Type: removed +Comment: Additional cleanup of old PHP + WP version support. + + diff --git a/projects/packages/status/src/class-status.php b/projects/packages/status/src/class-status.php index 472157f2407c9..83c5c22f1fc7d 100644 --- a/projects/packages/status/src/class-status.php +++ b/projects/packages/status/src/class-status.php @@ -45,8 +45,7 @@ public function is_offline_mode() { /** * Filters Jetpack's offline mode. * - * @see https://jetpack.com/support/development-mode/ - * @todo Update documentation ^^. + * @see https://jetpack.com/support/offline-mode/ * * @since 1.3.0 * diff --git a/projects/plugins/beta/changelog/remove-pre_wp6.6_and_php7.2_code b/projects/plugins/beta/changelog/remove-pre_wp6.6_and_php7.2_code new file mode 100644 index 0000000000000..8bc7df4543fb6 --- /dev/null +++ b/projects/plugins/beta/changelog/remove-pre_wp6.6_and_php7.2_code @@ -0,0 +1,5 @@ +Significance: patch +Type: removed +Comment: Additional cleanup of old PHP + WP version support. + + diff --git a/projects/plugins/beta/src/class-plugin.php b/projects/plugins/beta/src/class-plugin.php index 94e72e7ff06bc..86eeaf7fd821a 100644 --- a/projects/plugins/beta/src/class-plugin.php +++ b/projects/plugins/beta/src/class-plugin.php @@ -21,10 +21,9 @@ class Plugin { /** * Regex for the loader added to a mu-plugin loader. * - * @todo When we drop support for PHP <7.1.0, make this a private const. * @var string */ - private static $mu_loader_regex = '#^<\?php\s+/\* Load Jetpack Beta dev version: \*/\s+return require\s*(?:\(\s*)?__DIR__\s*.\s*(?:\x27[^\x27]*\x27|"[^"]*")(?:\s*\))?\s*;#'; + private const MU_LOADER_REGEX = '#^<\?php\s+/\* Load Jetpack Beta dev version: \*/\s+return require\s*(?:\(\s*)?__DIR__\s*.\s*(?:\x27[^\x27]*\x27|"[^"]*")(?:\s*\))?\s*;#'; /** * Class instances. @@ -483,7 +482,7 @@ public function is_active( $which ) { // If the loader snippet is present, dev is active. If not, assume stable is active (or there wouldn't be a loader). // That assumption ignores things like how the usual wpcomsh-loader.php checks for IS_ATOMIC, but there's not much we can do about that and it's unlikely to matter anyway. // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Not a remote URL. - return ( (bool) preg_match( self::$mu_loader_regex, (string) file_get_contents( $file ) ) ) === ( $which === 'dev' ); + return ( (bool) preg_match( self::MU_LOADER_REGEX, (string) file_get_contents( $file ) ) ) === ( $which === 'dev' ); } /** @@ -592,7 +591,7 @@ private function update_mu_plugin_loader( $which ) { } // Strip our loader snippet, then re-add it if necessary. - $new_contents = preg_replace( self::$mu_loader_regex, 'dev_plugin_path() ) ) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export -- Used for escaping, not output. $new_contents = 'dev_plugin_file()}", true ) . ';' . substr( $new_contents, 5 ); diff --git a/projects/plugins/crm/changelog/remove-pre_wp6.6_and_php7.2_code b/projects/plugins/crm/changelog/remove-pre_wp6.6_and_php7.2_code new file mode 100644 index 0000000000000..8bc7df4543fb6 --- /dev/null +++ b/projects/plugins/crm/changelog/remove-pre_wp6.6_and_php7.2_code @@ -0,0 +1,5 @@ +Significance: patch +Type: removed +Comment: Additional cleanup of old PHP + WP version support. + + diff --git a/projects/plugins/crm/includes/class-oauth-handler.php b/projects/plugins/crm/includes/class-oauth-handler.php index ecaded4030f61..50282373b9005 100644 --- a/projects/plugins/crm/includes/class-oauth-handler.php +++ b/projects/plugins/crm/includes/class-oauth-handler.php @@ -3,7 +3,7 @@ * Jetpack CRM * https://jetpackcrm.com * - * OAuth connection handler. Requires PHP 7.3+ + * OAuth connection handler. * */ namespace Automattic\JetpackCRM; @@ -18,7 +18,7 @@ class Oauth_Handler { /* - * Enabled (we disable oauth here if less than PHP <7.3 (req version)) + * Enabled. */ private $enabled = true; @@ -60,24 +60,11 @@ class Oauth_Handler { * Init */ public function __construct() { + // Add our action to the stack + add_filter( 'jpcrm_listener_actions', array( $this, 'add_listener_action' ), 1 ); - global $zbs; - - // require PHP 7.3 - if ( $zbs->has_min_php_version( '7.3' ) ) { - - // Add our action to the stack - add_filter( 'jpcrm_listener_actions', array( $this, 'add_listener_action' ), 1 ); - - // set action for endpoint listener to fire, so we can catch oauth requests (if any) - add_action( 'jpcrm_listener_oauth', array( $this, 'catch_oauth_request'), 10 ); - - } else { - - $this->enabled = false; - - } - + // set action for endpoint listener to fire, so we can catch oauth requests (if any) + add_action( 'jpcrm_listener_oauth', array( $this, 'catch_oauth_request' ), 10 ); } diff --git a/projects/plugins/crm/src/js/components/automations-admin/view.tsx b/projects/plugins/crm/src/js/components/automations-admin/view.tsx index 6866ba5995fdf..11eabb7390ce0 100644 --- a/projects/plugins/crm/src/js/components/automations-admin/view.tsx +++ b/projects/plugins/crm/src/js/components/automations-admin/view.tsx @@ -16,7 +16,6 @@ const render = () => { return; } - // @todo: Remove fallback when we drop support for WP 6.1 const component = ( @@ -27,11 +26,7 @@ const render = () => { ); - if ( WPElement.createRoot ) { - WPElement.createRoot( container ).render( component ); - } else { - WPElement.render( component, container ); - } + WPElement.createRoot( container ).render( component ); }; render(); diff --git a/projects/plugins/crm/src/js/components/onboarding-wizard/view.jsx b/projects/plugins/crm/src/js/components/onboarding-wizard/view.jsx index 574873f9d8b12..2e26ae56229ec 100644 --- a/projects/plugins/crm/src/js/components/onboarding-wizard/view.jsx +++ b/projects/plugins/crm/src/js/components/onboarding-wizard/view.jsx @@ -12,18 +12,13 @@ function render() { return; } - // @todo: Remove fallback when we drop support for WP 6.1 const component = ( ); - if ( WPElement.createRoot ) { - WPElement.createRoot( container ).render( component ); - } else { - WPElement.render( component, container ); - } + WPElement.createRoot( container ).render( component ); } render(); diff --git a/projects/plugins/jetpack/_inc/lib/class.media-summary.php b/projects/plugins/jetpack/_inc/lib/class.media-summary.php index 9ac367694e22b..b9e3ccc5515c8 100644 --- a/projects/plugins/jetpack/_inc/lib/class.media-summary.php +++ b/projects/plugins/jetpack/_inc/lib/class.media-summary.php @@ -24,7 +24,7 @@ class Jetpack_Media_Summary { /** * Get media summary for a post. * - * @param int $post_id Post ID. + * @param ?int $post_id Post ID. * @param int $blog_id Blog ID, if applicable. * @param array $args { * Optional. An array of arguments. @@ -34,8 +34,7 @@ class Jetpack_Media_Summary { * * @return array|mixed|void */ - public static function get( $post_id, $blog_id = 0, $args = array() ) { - // @todo: Use type hinting in the line above when at PHP 7.0+. + public static function get( ?int $post_id, int $blog_id = 0, array $args = array() ) { $post_id = (int) $post_id; $blog_id = (int) $blog_id; diff --git a/projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-cxn-test-base.php b/projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-cxn-test-base.php index c75a33c6d36c0..b9482033635fd 100644 --- a/projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-cxn-test-base.php +++ b/projects/plugins/jetpack/_inc/lib/debugger/class-jetpack-cxn-test-base.php @@ -511,8 +511,6 @@ public function output_fails_as_wp_error( $type = 'all', $group = 'all' ) { /** * Encrypt data for sending to WordPress.com. * - * @todo When PHP minimum is 5.3+, add cipher detection to use an agreed better cipher than RC4. RC4 should be the last resort. - * * @param string $data Data to encrypt with the WP.com Public Key. * * @return false|array False if functionality not available. Array of encrypted data, encryption key. diff --git a/projects/plugins/jetpack/changelog/remove-pre_wp6.6_and_php7.2_code b/projects/plugins/jetpack/changelog/remove-pre_wp6.6_and_php7.2_code new file mode 100644 index 0000000000000..1d53d8cb4c941 --- /dev/null +++ b/projects/plugins/jetpack/changelog/remove-pre_wp6.6_and_php7.2_code @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Additional cleanup of old PHP + WP version support. + + diff --git a/projects/plugins/super-cache/changelog/remove-pre_wp6.6_and_php7.2_code b/projects/plugins/super-cache/changelog/remove-pre_wp6.6_and_php7.2_code new file mode 100644 index 0000000000000..3652253bc0e2f --- /dev/null +++ b/projects/plugins/super-cache/changelog/remove-pre_wp6.6_and_php7.2_code @@ -0,0 +1,4 @@ +Significance: patch +Type: removed + +Cleaned up legacy code. diff --git a/projects/plugins/super-cache/wp-cache.php b/projects/plugins/super-cache/wp-cache.php index 41bfc5ff46f0b..97347ef8bd543 100644 --- a/projects/plugins/super-cache/wp-cache.php +++ b/projects/plugins/super-cache/wp-cache.php @@ -276,13 +276,7 @@ function wpsupercache_activate() { register_activation_hook( __FILE__, 'wpsupercache_activate' ); function wpsupercache_site_admin() { - global $wp_version; - - if ( version_compare( $wp_version, '4.8', '>=' ) ) { - return current_user_can( 'setup_network' ); - } - - return is_super_admin(); + return current_user_can( 'setup_network' ); } function wp_cache_add_pages() { @@ -2011,7 +2005,7 @@ function wp_cache_remove_index() { } function wp_cache_index_notice() { - global $wp_version, $cache_path; + global $cache_path; if ( false == wpsupercache_site_admin() ) return false; @@ -2036,16 +2030,10 @@ function wp_cache_index_notice() { echo "

"; _e( 'If you just installed WP Super Cache for the first time, you can dismiss this message. Otherwise, you should probably refresh the login cookies of all logged in WordPress users here by clicking the logout link below.', 'wp-super-cache' ); echo "

"; - if ( -1 == version_compare( $wp_version, '4.0' ) ) { - echo '

' . __( 'Your site is using a very old version of WordPress. When you update to the latest version everyone will be logged out and cookie information updated.', 'wp-super-cache' ) . '

'; - } else { - echo '

' . __( 'The logout link will log out all WordPress users on this site except you. Your authentication cookie will be updated, but you will not be logged out.', 'wp-super-cache' ) . '

'; - } - echo "" . __( 'Dismiss', 'wp-super-cache' ) . ""; - if ( 1 == version_compare( $wp_version, '4.0' ) ) { - echo " | " . __( 'Logout', 'wp-super-cache' ) . ""; - } - echo ""; + echo '

' . esc_html__( 'The logout link will log out all WordPress users on this site except you. Your authentication cookie will be updated, but you will not be logged out.', 'wp-super-cache' ) . '

'; + echo '' . esc_html__( 'Dismiss', 'wp-super-cache' ) . ''; + echo ' | ' . esc_html__( 'Logout', 'wp-super-cache' ) . ''; + echo ''; ?>