Opened 10 months ago
Closed 10 months ago
#62011 closed defect (bug) (duplicate)
Deprecated: strpos(): Passing null to parameter
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 6.6.1 |
Component: | Administration | Keywords: | has-patch |
Focuses: | php-compatibility | Cc: |
Description
There is a warning in the admin panel:
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in A:\OSPanel\home\homewp.ru\wp-includes\functions.php on line 7303
With these changes there will be no error:
function wp_is_stream( $path ) {
/*new code start*/
if($path===null){
return false;
}
/*new code end*/
$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)
This ticket was mentioned in PR #7310 on WordPress/wordpress-develop by @deepakrohilla.
10 months ago
#1
- Keywords has-patch added
#2
@
10 months ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
Hi there and welcome to WordPress Trac!
This has been reported a few times in the past and we're trying to keep all the discussions in one place. Hence I am closing this as a duplicate of #57580.
Also worth noting that we generally do not want to paper over deprecation warnings like this by adding sanity checks in low-level functions. These kinds of issues should ideally be addressed at the root.
https://core.trac.wordpress.org/ticket/62011