Opened 5 weeks ago
Last modified 5 weeks ago
#63107 new defect (bug)
two deprecated warnings in /wp-includes/functions.php
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
two deprecated warnings in /wp-includes/functions.php:
1) Backtrace from warning strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /wp-includes/functions.php 7329
:
this is the code causing the error: $scheme_separator = strpos( $path, '://' );
this is the adjusted code to fix it: $scheme_separator = strpos($path ?? '', '://');
2) Backtrace from warning str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated at /wp-includes/functions.php 2189
:
here is the code causing the error: $path = str_replace( '\\', '/', $path );
this the adjusted code to fix it: $path = str_replace('\\', '/', $path ?? '');
Change History (4)
This ticket was mentioned in PR #8511 on WordPress/wordpress-develop by RobertP3469.
5 weeks ago
#2
- Keywords has-patch added
https://core.trac.wordpress.org/ticket/63107
Fixed two pieces of code that were generating deprecated warnings: -- Backtrace from warning 'strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated' at /wp-includes/functions.php 7329: this was the code causing the error: $scheme_separator = strpos( $path, ':' );
-- Backtrace from warning 'str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated' at /wp-includes/functions.php 2189:
this was the code causing the error: $path = str_replace( '
', '/', $path );
Trac ticket:
@rpayne7264 commented on PR #8511:
5 weeks ago
#3
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the
props-bot
label.
Core Committers: Use this line as a base for the props when committing in SVN:
Props rpayne7264.To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.
#4
@
5 weeks ago
- Description modified (diff)
- Keywords changes-requested removed
- Version 6.7.2 deleted
Hi! Please look further back in the backtrace to discover which function sends a null
value through wp_normalize_path()
. Both wp_normalize_path()
and wp_is_stream()
require a string, and anything else could cause issues that are bigger than a deprecation notice.
According to #57580, a number of plugins have added null
as the first parameter in add_submenu_page()
.
@mod please remove the sensitive file path segment from item #2 in the OP.