Title: functions.php has $haystack and errors
Last modified: July 17, 2024

---

# functions.php has $haystack and errors

 *  [Brett](https://wordpress.org/support/users/techbrett/)
 * (@techbrett)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/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](https://wordpress.org/support/users/since/) 3.5.0
      *
    - [@param](https://wordpress.org/support/users/param/) string $path The resource
      path or URL.
    - [@return](https://wordpress.org/support/users/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](https://wordpress.org/support/users/since/) 3.9.0
    - [@since](https://wordpress.org/support/users/since/) 4.4.0 Ensures upper-case
      drive letters on Windows systems.
    - [@since](https://wordpress.org/support/users/since/) 4.5.0 Allows for Windows
      network shares.
    - [@since](https://wordpress.org/support/users/since/) 4.9.7 Allows for PHP 
      file wrappers.
      *
    - [@param](https://wordpress.org/support/users/param/) string $path Path to 
      normalize.
    - [@return](https://wordpress.org/support/users/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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffunctions-php-has-haystack-and-errors%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [Dion Hulse](https://wordpress.org/support/users/dd32/)
 * (@dd32)
 * Meta Developer
 * [1 year, 10 months ago](https://wordpress.org/support/topic/functions-php-has-haystack-and-errors/#post-17894423)
 * Hi [@techbrett](https://wordpress.org/support/users/techbrett/),
 * This is likely caused by a plugin or theme you’ve got installed, and not specifically
   WordPress or a WordPress update.
 * It’s highly likely that this is being triggered because of using PHP 8.1, with
   something that isn’t supporting it 100%. You may be able to switch to PHP 7.4
   in your hosting control panel – or by asking their support team.
 * Additionally, PHP Deprecated notices shouldn’t be visible normally, but it’s 
   likely that your `WP_DEBUG` settings are incorrectly set. You can set that to`
   false` (See [https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/](https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/))
 * Your website is currently not showing anything, other than the deprecated errors,
   I expect this is because it’s also running into a Fatal error which isn’t being
   shown. You’d be able to get those details from your hosting panel as well.
 *  Thread Starter [Brett](https://wordpress.org/support/users/techbrett/)
 * (@techbrett)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/functions-php-has-haystack-and-errors/#post-17896010)
 * Hi Dion,
 * I set to false, it loads a blank white page now. I set PHP to 7.4 but no change.
   I’ve opened a support ticket with the host sometimes they can look in the files
   and see the issue. But last time when I had them help me migrate it they said
   the core files needed to be rebuilt and they installed a clean new wordpress 
   for me to use. I’ll keep you posted and thank you for your help!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘functions.php has $haystack and errors’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Brett](https://wordpress.org/support/users/techbrett/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/functions-php-has-haystack-and-errors/#post-17896010)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
