WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/15/2019 06:24:08 AM (19 months ago)
Author:
pento
Message:

Code Modernisation: Fix known instances of array access on data types that can't be accessed as arrays.

PHP 7.4 addes a warning when trying access a null/bool/int/float/resource (everything but array, string and object) as if it were an array.

This change fixes all of these warnings visible in unit tests.

Props jrf.
See #47704.

File:
1 edited

Legend:

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

    r45635 r45639  
    31143114                if ( ! empty( $value['db'] ) ) {
    31153115                    // We're going to need to truncate by characters or bytes, depending on the length value we have.
    3116                     if ( 'byte' === $value['length']['type'] ) {
     3116                    if ( isset( $value['length']['type'] ) && 'byte' === $value['length']['type'] ) {
    31173117                        // Using binary causes LEFT() to truncate by bytes.
    31183118                        $charset = 'binary';
Note: See TracChangeset for help on using the changeset viewer.