[wp-trac] [WordPress Trac] #59832: Deprecation warnings for resulting from a call to plugin_dir_url
WordPress Trac
noreply at wordpress.org
Thu Nov 30 19:35:06 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 | Resolution:
Keywords: | Focuses:
----------------------------+------------------------------
Comment (by hellofromTonya):
== Reproduction Report
This report validates if the issue can be reproduced.
=== Environment
- OS: macOS 14.1.1
- Web Server: Nginx
- PHP: 8.2.10
- WordPress: 6.4.1
- Theme: Twenty Twenty-Four
- Active Plugins: None
- Must-use:
[https://gist.github.com/hellofromtonya/9486c6c7039919aee88f7d9059499175
Install this file into `wp-content/mu-plugins/`], as it'll output
different combinations to test empty strings and `null`.
=== Actual Results
* ✅ Passing `__FILE__` to `plugin_dir_url()` returns `http://wpdev.local
/wp-content/mu-plugins/` with no deprecation raised.
* ✅ Passing an empty string to `plugin_dir_url()` returns
`http://wpdev.local/wp-content/mu-plugins/` with no deprecation raised.
* ✅ Passing 2 empty strings to `plugins_url()` returns
`http://wpdev.local/wp-content/mu-plugins/` with no deprecation raised.
* ✅ Passing an empty string to `wp_normalize_path()` returns an empty
string with no deprecation raised.
* ❌ Passing`null` to `plugin_dir_url()` returns `http://wpdev.local/wp-
content/mu-plugins/` but also raises both deprecation notices:
{{{
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type
string is deprecated in ../wp-includes/functions.php on line 7241
Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type
array|string is deprecated in ..c/wp-includes/functions.php on line 2187
}}}
* ❌ Passing`null` to `wp_normalize_path()` returns an empty string and
also both deprecation notices:
{{{
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type
string is deprecated in ../wp-includes/functions.php on line 7241
Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type
array|string is deprecated in ..c/wp-includes/functions.php on line 2187
}}}
=== Additional Notes
Cannot reproduce the reported issue when passing empty strings. Though
`null` does raise the deprecations, both functions require a `string` and
are not nullable.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59832#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list