diff --git a/projects/plugins/jetpack/changelog/fix-atomic-php-warnings b/projects/plugins/jetpack/changelog/fix-atomic-php-warnings new file mode 100644 index 0000000000000..f7140c8de270b --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-atomic-php-warnings @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Compat: wp_startswith should only pass to strpos if string is passed. diff --git a/projects/plugins/jetpack/functions.compat.php b/projects/plugins/jetpack/functions.compat.php index 40715d2598e66..ebaf7903e0fef 100644 --- a/projects/plugins/jetpack/functions.compat.php +++ b/projects/plugins/jetpack/functions.compat.php @@ -86,11 +86,14 @@ function youtube_sanitize_url( $url ) { /** * Check whether a string starts with a specific substring. * - * @param var $haystack String we are filtering. + * @param string $haystack String we are filtering. * @param string $needle The substring we are looking for. * @return bool */ function wp_startswith( $haystack, $needle ) { + if ( ! $haystack || ! is_string( $haystack ) ) { + return false; + } return 0 === strpos( $haystack, $needle ); } endif;