From 79143bfed1200597bc5773c60c28b4ee31064be6 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 3 Mar 2014 17:35:12 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@27377 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/wp-db.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index 3c18b2fd0e..b57d572fdd 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -17,7 +17,8 @@ define( 'EZSQL_VERSION', 'WP1.25' ); /** * @since 0.71 */ -define( 'OBJECT', 'OBJECT', true ); +define( 'OBJECT', 'OBJECT' ); +define( 'object', 'OBJECT' ); // Back compat. /** * @since 2.5.0 @@ -1821,6 +1822,9 @@ class wpdb { return $this->last_result[$y] ? get_object_vars( $this->last_result[$y] ) : null; } elseif ( $output == ARRAY_N ) { return $this->last_result[$y] ? array_values( get_object_vars( $this->last_result[$y] ) ) : null; + } elseif ( strtoupper( $output ) === OBJECT ) { + // Back compat for OBJECT being previously case insensitive. + return $this->last_result[$y] ? $this->last_result[$y] : null; } else { $this->print_error( " \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N" ); } @@ -1900,6 +1904,9 @@ class wpdb { } } return $new_array; + } elseif ( strtoupper( $output ) === OBJECT ) { + // Back compat for OBJECT being previously case insensitive. + return $this->last_result; } return null; }