#60046 closed defect (bug) (duplicate)
Passing null to parameter #1 ($haystack) of type string is deprecated in\wp-includes\functions.php on line 7244
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | minor | Version: | 6.4.2 |
| Component: | Media | Keywords: | has-patch |
| Focuses: | Cc: |
Description
When null is passed to wp_is_stream() it causes a deprecated warning, this is easily fixed with some type checking like so:
function wp_is_stream( $path = '' ) {
if ( !$path || !is_string( $path ) )
{
// $path cannot be a stream if it's not a string
return false;
}
$scheme_separator = strpos( $path, '://' );
if ( false === $scheme_separator ) {
// $path isn't a stream.
return false;
}
$stream = substr( $path, 0, $scheme_separator );
return in_array( $stream, stream_get_wrappers(), true );
}
Change History (2)
#1
@
2 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
#2
@
2 years ago
I would like to know which function is used incorrectly, especially if the mistake is within Core or if all similar reports consistently point to plugins using a wrong type in the same add_submenu_page() function.
If you could determine which function or which plugin causes the error, please share the information on #57580. (I am not yet sure about reopening that ticket, but you can comment while it is still closed.)
Note: See
TracTickets for help on using
tickets.
Hi and welcome to WordPress Core Trac!
The deprecation warnings for
wp_is_stream()andwp_normalize_path()were already reported on #57580 and #57581 (plus #58104 and #59756). Both functions have required a string since they were created, so plugin authors need some message to know when and how their plugin is doing it wrong. The decision on #57580 and #57581 was to keep those deprecated warnings.