WordPress.org

Make WordPress Core

Changeset 27377


Ignore:
Timestamp:
03/03/2014 05:35:12 PM (7 years ago)
Author:
nacin
Message:

Make OBJECT a case sensitive constant, for HHVM compatibility and general sanity.

Support object explicitly, and other forms using a fallback in wpdb.

fixes #27231.

File:
1 edited

Legend:

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

    r27369 r27377  
    1818 * @since 0.71
    1919 */
    20 define( 'OBJECT', 'OBJECT', true );
     20define( 'OBJECT', 'OBJECT' );
     21define( 'object', 'OBJECT' ); // Back compat.
    2122
    2223/**
     
    18221823        } elseif ( $output == ARRAY_N ) {
    18231824            return $this->last_result[$y] ? array_values( get_object_vars( $this->last_result[$y] ) ) : null;
     1825        } elseif ( strtoupper( $output ) === OBJECT ) {
     1826            // Back compat for OBJECT being previously case insensitive.
     1827            return $this->last_result[$y] ? $this->last_result[$y] : null;
    18241828        } else {
    18251829            $this->print_error( " \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N" );
     
    19011905            }
    19021906            return $new_array;
     1907        } elseif ( strtoupper( $output ) === OBJECT ) {
     1908            // Back compat for OBJECT being previously case insensitive.
     1909            return $this->last_result;
    19031910        }
    19041911        return null;
Note: See TracChangeset for help on using the changeset viewer.