[wp-trac] [WordPress Trac] #60047: Passing null to parameter #3 ($subject) of type array|string is deprecated in wp-includes\functions.php on line 2187
WordPress Trac
noreply at wordpress.org
Mon Dec 11 10:09:16 UTC 2023
#60047: Passing null to parameter #3 ($subject) of type array|string is deprecated
in wp-includes\functions.php on line 2187
----------------------------+-----------------------------
Reporter: Sander Falise | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Filesystem API | Version:
Severity: minor | Keywords: has-patch
Focuses: |
----------------------------+-----------------------------
Passing non string values to wp_normalize_path() causes a deprecated
warning, this can easily be fixed by adding some type checking:
{{{
function wp_normalize_path( $path = '' ) {
if ( !$path || !is_string( $path ))
{
$path = '';
}
$wrapper = '';
if ( wp_is_stream( $path ) ) {
list( $wrapper, $path ) = explode( '://', $path, 2 );
$wrapper .= '://';
}
// Standardize all paths to use '/'.
$path = str_replace( '\\', '/', $path );
// Replace multiple slashes down to a singular, allowing for network
shares having two slashes.
$path = preg_replace( '|(?<=.)/+|', '/', $path );
// Windows paths should uppercase the drive letter.
if ( ':' === substr( $path, 1, 1 ) ) {
$path = ucfirst( $path );
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60047>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list