[wp-trac] [WordPress Trac] #57580: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in functions.php

WordPress Trac noreply at wordpress.org
Sun Jan 29 19:10:31 UTC 2023


#57580: strpos(): Passing null to parameter #1 ($haystack) of type string is
deprecated  in functions.php
--------------------------+-----------------------------
 Reporter:  ipajen        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:  PHP81
  Focuses:                |
--------------------------+-----------------------------
 6.2-alpha-55159, PHP 8.1

 When using two different plugins (WP Review Slider Pro (Premium) or Ninja
 Forms following are thrown as PHP warning (If any of them are enabled same
 warnings are shown, if disabling both plugins no warning exist).

 {{{
 wp-includes/functions.php:7045
 strpos()
 wp-includes/functions.php:7045
 wp_is_stream()
 wp-includes/functions.php:2153
 wp_normalize_path()
 wp-includes/plugin.php:768
 plugin_basename()
 wp-admin/includes/plugin.php:1405
 add_submenu_page()
 wp-content/plugins/wp-review-slider-pro/admin/class-wp-review-slider-pro-
 admin.php:990
 WP_Review_Pro_Admin->add_menu_pages()
 wp-includes/class-wp-hook.php:308
 do_action('admin_menu')
 wp-admin/includes/menu.php:155
 }}}

 Is there something Core can do to improve the experience here? Or both
 plugin authors need to change?

 {{{
 wp-includes/functions.php:7045
 /**
  * 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 );
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57580>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list