Make WordPress Core


Ignore:
Timestamp:
11/10/2025 08:26:46 PM (9 months ago)
Author:
westonruter
Message:

Code Modernization: Fix instances of using null as an array offset.

This avoids using multisite-specific tables and columns in WP_Date_Query::validate_column() when on a non-multisite install. Attempting to use $wpdb->blogs as an array index when null on a non-multisite install causes a deprecation notice in PHP 8.5. This also updates the multisite table alias in wpdb to make it clear they could be null.

Developed in https://github.com/WordPress/wordpress-develop/pull/10498

Follow-up to [60904], [60809], [37477].

Props westonruter, desrosj.
See #63061.
Fixes #63957.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wpdb.php

    r61102 r61191  
    468468         * @since 3.0.0
    469469         *
    470          * @var string
     470         * @var string|null
    471471         */
    472472        public $blogs;
     
    477477         * @since 5.1.0
    478478         *
    479          * @var string
     479         * @var string|null
    480480         */
    481481        public $blogmeta;
     
    486486         * @since 3.0.0
    487487         *
    488          * @var string
     488         * @var string|null
    489489         */
    490490        public $registration_log;
     
    495495         * @since 3.0.0
    496496         *
    497          * @var string
     497         * @var string|null
    498498         */
    499499        public $signups;
     
    504504         * @since 3.0.0
    505505         *
    506          * @var string
     506         * @var string|null
    507507         */
    508508        public $site;
     
    513513         * @since 3.0.0
    514514         *
    515          * @var string
     515         * @var string|null
    516516         */
    517517        public $sitecategories;
     
    522522         * @since 3.0.0
    523523         *
    524          * @var string
     524         * @var string|null
    525525         */
    526526        public $sitemeta;
Note: See TracChangeset for help on using the changeset viewer.