[wp-trac] [WordPress Trac] #59832: Deprecation warnings for resulting from a call to plugin_dir_url

WordPress Trac noreply at wordpress.org
Wed Nov 8 08:33:56 UTC 2023


#59832: Deprecation warnings for resulting from a call to plugin_dir_url
----------------------------+-----------------------------
 Reporter:  geistesblitzer  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Plugins         |    Version:  6.4
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 The function plugin_dir_url( $file ) calls plugins_url with an empty
 string as the $path parameter. This in turn leads to two PHP 8.1
 deprecation warnings:

 Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type
 array|string is deprecated in <path>/wp-includes/functions.php on line
 2187

 Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type
 string is deprecated in <path>/wp-includes/functions.php on line 7241

 Both warnings can, e.g., be seen when using the ACF Pro plugin and making
 a call to get_field(). While these warnings result from a function call
 from the plugin, the problem lies within WordPress core, as these core
 functions cannot be used without producing deprecation warnings.

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


More information about the wp-trac mailing list