From b8b96e7f0c89ebf453435fa666986e5cdc3c5ab2 Mon Sep 17 00:00:00 2001 From: Jonathan Wheat Date: Wed, 4 Mar 2015 13:58:25 -0500 Subject: [PATCH 1/2] added is_object check to prevent PHP 4.5+ error regarding creating default object from empty value --- oracle8_9/ez_sql_oracle8_9.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/oracle8_9/ez_sql_oracle8_9.php b/oracle8_9/ez_sql_oracle8_9.php index 356153a1..74331180 100755 --- a/oracle8_9/ez_sql_oracle8_9.php +++ b/oracle8_9/ez_sql_oracle8_9.php @@ -234,7 +234,13 @@ function query($query) { // Fetch the column meta data for ( $i = 1; $i <= $num_cols; $i++ ) - { + { + # Check is_object to rid the following PHP 4.5+ error + # PHP Warning: Creating default object from empty value in ez_sql_oracle8_9.php on line xxx + if ( !is_object($this->col_info) ) { + $this->col_info[] = new stdClass; + } + $this->col_info[($i-1)]->name = @OCIColumnName($stmt,$i); $this->col_info[($i-1)]->type = @OCIColumnType($stmt,$i); $this->col_info[($i-1)]->size = @OCIColumnSize($stmt,$i); @@ -252,6 +258,12 @@ function query($query) // then - loop through rows foreach ( $col_contents as $col_content ) { + # Check is_object to rid the following PHP 4.5+ error + # PHP Warning: Creating default object from empty value in ez_sql_oracle8_9.php on line xxx + if (!is_object($this->last_result)) { + $this->last_result[] = new stdClass; + } + $this->last_result[$row_num]->{$col_title} = $col_content; $row_num++; } From 857157f1362bcda2e3eaf01b5f469067a15ef90d Mon Sep 17 00:00:00 2001 From: Jonathan Wheat Date: Wed, 4 Mar 2015 14:00:07 -0500 Subject: [PATCH 2/2] removed extra tabs for better code alignment --- oracle8_9/ez_sql_oracle8_9.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/oracle8_9/ez_sql_oracle8_9.php b/oracle8_9/ez_sql_oracle8_9.php index 74331180..91352fa1 100755 --- a/oracle8_9/ez_sql_oracle8_9.php +++ b/oracle8_9/ez_sql_oracle8_9.php @@ -235,11 +235,11 @@ function query($query) // Fetch the column meta data for ( $i = 1; $i <= $num_cols; $i++ ) { - # Check is_object to rid the following PHP 4.5+ error - # PHP Warning: Creating default object from empty value in ez_sql_oracle8_9.php on line xxx - if ( !is_object($this->col_info) ) { - $this->col_info[] = new stdClass; - } + # Check is_object to rid the following PHP 4.5+ error + # PHP Warning: Creating default object from empty value in ez_sql_oracle8_9.php on line xxx + if ( !is_object($this->col_info) ) { + $this->col_info[] = new stdClass; + } $this->col_info[($i-1)]->name = @OCIColumnName($stmt,$i); $this->col_info[($i-1)]->type = @OCIColumnType($stmt,$i);