[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:54:29 UTC 2023
#59832: Deprecation warnings for resulting from a call to plugin_dir_url
----------------------------+----------------------
Reporter: geistesblitzer | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Plugins | Version: 6.4
Severity: normal | Resolution: invalid
Keywords: | Focuses:
----------------------------+----------------------
Changes (by hellofromTonya):
* status: new => closed
* resolution: => invalid
* milestone: Awaiting Review =>
Comment:
Hello @geistesblitzer,
Welcome to WordPress Core's Trac :) Thanks for the report.
>The function plugin_dir_url( $file ) calls plugins_url with an empty
string as the $path parameter.
To test what happens when passing an empty string to the `$path`, I set up
a [https://gist.github.com/hellofromtonya/9486c6c7039919aee88f7d9059499175
must-use plugin] that invokes the functions in question. Results:
* Passing an empty string does not raise the deprecations.
* Passing `null` does raise both deprecations.
Something is passing `null` when it should be passing a `string`. The
functions do require a `string` for the `$path`, i.e. `null` is not valid
input for these functions.
Looking more closely at the deprecations, both are indicating that `null`
was passed instead of a `string`:
{{{
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type
string is deprecated in <path>/wp-includes/functions.php on line 7241
}}}
Indicates the value passed `$path` when `wp_is_stream()` is invoked is
`null`.
{{{
Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type
array|string is deprecated in <path>/wp-includes/functions.php on line
2187
}}}
Indicates the value passed to `$path` when invoking `wp_normalize_path()`
is also `null`.
Likely a plugin, theme, and/or must-use script is invoking
`wp_normalize_path()` or a function that invokes it and passing a `null`
rather than with a string.
>ACF Pro plugin and making a call to get_field()
You identify the deprecation gets raised when ACF's `get_field()` is
invoked. Next step would be to reach out to ACF on their support forum
https://wordpress.org/support/plugin/advanced-custom-fields/.
Other ways to troubleshoot:
* Do a full backtrace to determine the call stack.
* Use tracking tools such as Xdebug to step through the code to find what
could be passing `null` to one of these functions.
I'll close this ticket as the issue appears to be code outside of Core
that passing `null` instead of `string`. If after further investigation
the root cause appears to be within Core itself, please reopen this ticket
and provide the information gathered to help contributors continue their
investigation. Thank you :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59832#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list