Skip to content

Commit 3d5d0ec

Browse files
authored
Update functions.php to fix deprecated warnings
Fixed two pieces of code that were generating deprecated warnings: -- Backtrace from warning 'strpos(): Passing null to parameter WordPress#1 ($haystack) of type string is deprecated' at /wp-includes/functions.php 7329: this was the code causing the error: $scheme_separator = strpos( $path, '://' ); -- Backtrace from warning 'str_replace(): Passing null to parameter WordPress#3 ($subject) of type array|string is deprecated' at /wp-includes/functions.php 2189: this was the code causing the error: $path = str_replace( '\\', '/', $path );
1 parent 59f3fef commit 3d5d0ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/wp-includes/functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,7 @@ function wp_normalize_path( $path ) {
21922192
}
21932193

21942194
// Standardize all paths to use '/'.
2195-
$path = str_replace( '\\', '/', $path );
2195+
$path = str_replace('\\', '/', $path ?? '');
21962196

21972197
// Replace multiple slashes down to a singular, allowing for network shares having two slashes.
21982198
$path = preg_replace( '|(?<=.)/+|', '/', $path );
@@ -7357,7 +7357,7 @@ function _device_can_upload() {
73577357
* @return bool True if the path is a stream URL.
73587358
*/
73597359
function wp_is_stream( $path ) {
7360-
$scheme_separator = strpos( $path, '://' );
7360+
$scheme_separator = strpos($path ?? '', '://');
73617361

73627362
if ( false === $scheme_separator ) {
73637363
// $path isn't a stream.

0 commit comments

Comments
 (0)