Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #65953


Ignore:
Timestamp:
08/24/2026 05:24:43 PM (3 months ago)
Author:
sabernhardt
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #65953 – Description

    initial v1  
    22I am a WordPress plugin developer. I was working on a plugin when, following a PHP update from version 7.4 to 8.2 (or higher), I encountered a strange error:
    33
    4 
    5 Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in /home/zgamesi1/domains/zgames.ir/public_html/wp-includes/rest-api/class-wp-rest-server.php:1166
     4{{{
     5Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in /.../wp-includes/rest-api/class-wp-rest-server.php:1166
    66Stack trace:
    7 #0 /home/zgamesi1/domains/zgames.ir/public_html/wp-includes/rest-api/class-wp-rest-server.php(1166): array_merge(NULL)
     7#0 /.../wp-includes/rest-api/class-wp-rest-server.php(1166): array_merge(NULL)
     8}}}
    89
    910In fact, line 1166 of the `class-wp-rest-server.php` file attempts to perform an `array_merge` without considering the variable's value or applying any specific validation; I resolved the error quite simply with a minor change:
    1011
    11 Orginal: $routes = array_merge( ...$with_namespace );
     12Original: `$routes = array_merge( ...$with_namespace );`
    1213Edited (Fixed):
     14{{{
    1315                        //Fixed by MDesign
    1416                        foreach ( $with_namespace as $namespace_routes ) {
    … …  
    1820                        }
    1921                        /**/
     22}}}