Cast to array when using foreach(). Props santosj (and thanks for your perseverance!). fixes #2784

git-svn-id: https://develop.svn.wordpress.org/trunk@8572 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2008-08-06 20:31:54 +00:00
parent 3937bd9530
commit 3cab99fbd2
22 changed files with 125 additions and 124 deletions

View File

@@ -378,7 +378,7 @@ class wpdb {
$old_prefix = $this->prefix;
$this->prefix = $prefix;
foreach ( $this->tables as $table )
foreach ( (array) $this->tables as $table )
$this->$table = $this->prefix . $table;
if ( defined('CUSTOM_USER_TABLE') )
@@ -677,7 +677,7 @@ class wpdb {
function update($table, $data, $where){
$data = add_magic_quotes($data);
$bits = $wheres = array();
foreach ( array_keys($data) as $k )
foreach ( (array) array_keys($data) as $k )
$bits[] = "`$k` = '$data[$k]'";
if ( is_array( $where ) )
@@ -805,7 +805,7 @@ class wpdb {
// Return an integer-keyed array of...
if ( $this->last_result ) {
$i = 0;
foreach( $this->last_result as $row ) {
foreach( (array) $this->last_result as $row ) {
if ( $output == ARRAY_N ) {
// ...integer-keyed row arrays
$new_array[$i] = array_values( get_object_vars( $row ) );
@@ -833,7 +833,7 @@ class wpdb {
if ( $this->col_info ) {
if ( $col_offset == -1 ) {
$i = 0;
foreach($this->col_info as $col ) {
foreach( (array) $this->col_info as $col ) {
$new_array[$i] = $col->{$info_type};
$i++;
}
@@ -941,7 +941,7 @@ class wpdb {
$bt = debug_backtrace();
$caller = '';
foreach ( $bt as $trace ) {
foreach ( (array) $bt as $trace ) {
if ( @$trace['class'] == __CLASS__ )
continue;
elseif ( strtolower(@$trace['function']) == 'call_user_func_array' )