functions.php has $haystack and errors
-
Not sure if it was an update or what changed this. It worked one day, the next it loads to this error page. I was told by hosting support to rebuild core files but I have never done that before and sounds daunting. If you visit the site you see these errors (copy and pasted here):
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/mslandscape/public_html/wp-includes/functions.php on line 7288
Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in?/home/mslandscape/public_html/wp-includes/functions.php?on line?2187
I have no clue but here’s the sections of code each refers to, respectively:
/**
- Tests if a given path is a stream URL
* - @since 3.5.0
* - @param string $path The resource path or URL.
- @return bool True if the path is a stream URL.
*/
function wp_is_stream( $path ) {
$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 );
}
line 7288 is bolded ($scheme_separator = strpos( $path, ‘://’ );)
/**
- Normalizes a filesystem path.
* - On windows systems, replaces backslashes with forward slashes
- and forces upper-case drive letters.
- Allows for two leading slashes for Windows network shares, but
- ensures that all other duplicate slashes are reduced to a single.
* - @since 3.9.0
- @since 4.4.0 Ensures upper-case drive letters on Windows systems.
- @since 4.5.0 Allows for Windows network shares.
- @since 4.9.7 Allows for PHP file wrappers.
* - @param string $path Path to normalize.
- @return string Normalized path.
*/
function wp_normalize_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 );
} return $wrapper . $path;
}
2187 is bolded. ($path = str_replace( ‘\’, ‘/’, $path );)
The page I need help with: [log in to see the link]
- Tests if a given path is a stream URL
- The topic ‘functions.php has $haystack and errors’ is closed to new replies.