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
This commit is contained in:
Andrew Nacin 2014-03-03 17:35:12 +00:00
parent 8b532c17d2
commit 79143bfed1
1 changed files with 8 additions and 1 deletions

View File

@ -17,7 +17,8 @@ define( 'EZSQL_VERSION', 'WP1.25' );
/** /**
* @since 0.71 * @since 0.71
*/ */
define( 'OBJECT', 'OBJECT', true ); define( 'OBJECT', 'OBJECT' );
define( 'object', 'OBJECT' ); // Back compat.
/** /**
* @since 2.5.0 * @since 2.5.0
@ -1821,6 +1822,9 @@ class wpdb {
return $this->last_result[$y] ? get_object_vars( $this->last_result[$y] ) : null; return $this->last_result[$y] ? get_object_vars( $this->last_result[$y] ) : null;
} elseif ( $output == ARRAY_N ) { } elseif ( $output == ARRAY_N ) {
return $this->last_result[$y] ? array_values( get_object_vars( $this->last_result[$y] ) ) : null; 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 { } else {
$this->print_error( " \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N" ); $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; return $new_array;
} elseif ( strtoupper( $output ) === OBJECT ) {
// Back compat for OBJECT being previously case insensitive.
return $this->last_result;
} }
return null; return null;
} }