Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #63403


Ignore:
Timestamp:
05/07/2025 04:18:09 AM (12 months ago)
Author:
sabernhardt
Comment:

#57580 already reported the notices that result from a null value in add_submenu_page().

I tried 63403.patch with Easy Username Updater. If wp_normalize_path() returns a null $path, then plugin_basename() would still throw a deprecation notice when trying to run that through preg_replace().

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #63403

    • Property Status changed from new to closed
    • Property Version changed from trunk to
    • Property Resolution changed from to duplicate
    • Property Milestone changed from Awaiting Review to
  • Ticket #63403 – Description

    initial v1  
    11
    22
    3 Without this modification, some plugins like username-updater (Easy Username Updater) may try to do something like call add_submenu_page(null, ...) which can result in an error like this filling up logs:
     3Without this modification, some plugins like username-updater (Easy Username Updater) may try to do something like call `add_submenu_page(null, ...)` which can result in an error like this filling up logs:
    44
    5 str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
     5`str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated`
    66
    7 It stands to reason that a normalized null/false/empty path is still null/false/empty (or maybe an empty string) and we should just guard whiny functions like str_replace against unexpected input.
     7It stands to reason that a normalized null/false/empty path is still null/false/empty (or maybe an empty string) and we should just guard whiny functions like `str_replace` against unexpected input.
    88
    99Github PR: https://github.com/WordPress/WordPress/pull/749
     
    1111Patch:
    1212
    13 From 7ed4124a7fc69fe1edcda31b764f2e776f6fdd4c Mon Sep 17 00:00:00 2001
    14 From: zyphlar <zyphlar@users.noreply.github.com>
    15 Date: Tue, 6 May 2025 15:25:49 -0700
    16 Subject: [PATCH] Handle null/falsy paths in wp_normalize_path without warnings
    17 
    18 Without this modification, some plugins like username-updater (Easy Username Updater) may try to do something like call `add_submenu_page(null, ...)` which can result in an error like this filling up logs:
    19 
    20 `str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated`
    21 
    22 It stands to reason that a normalized null/false/empty path is still null/false/empty (or maybe an empty string) and we should just guard whiny functions like str_replace against unexpected input.
    23 ---
    24  wp-includes/functions.php | 4 ++++
    25  1 file changed, 4 insertions(+)
    26 
     13{{{
    2714diff --git a/wp-includes/functions.php b/wp-includes/functions.php
    2815index 33b775e7182..5ffcaf432e5 100644
     
    4532 
    4633        if ( wp_is_stream( $path ) ) {
     34}}}