felipe                                   Thu, 18 Mar 2010 22:07:51 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=296361

Log:
Revert 290786: Fixed bug #49521 (PDO fetchObject sets values before calling 
constructor)

Bug: http://bugs.php.net/49521 (Re-Opened) PDO fetchObject sets values before 
calling constructor
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c
    U   php/php-src/branches/PHP_5_2/ext/pdo_sqlite/tests/bug49521.phpt

Modified: php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c     2010-03-18 21:53:50 UTC 
(rev 296360)
+++ php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c     2010-03-18 22:07:51 UTC 
(rev 296361)
@@ -1103,32 +1103,6 @@
                        }
                }

-               switch (how) {
-                       case PDO_FETCH_CLASS:
-                               if (ce->constructor && !(flags & 
PDO_FETCH_PROPS_LATE)) {
-                                       stmt->fetch.cls.fci.object_pp = 
&return_value;
-                                       stmt->fetch.cls.fcc.object_pp = 
&return_value;
-                                       if 
(zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == 
FAILURE) {
-                                               pdo_raise_impl_error(stmt->dbh, 
stmt, "HY000", "could not call class constructor" TSRMLS_CC);
-                                               return 0;
-                                       } else {
-                                               if (stmt->fetch.cls.retval_ptr) 
{
-                                                       
zval_ptr_dtor(&stmt->fetch.cls.retval_ptr);
-                                               }
-                                       }
-                               }
-                               if (flags & PDO_FETCH_CLASSTYPE) {
-                                       do_fetch_opt_finish(stmt, 0 TSRMLS_CC);
-                                       stmt->fetch.cls.ce = old_ce;
-                                       stmt->fetch.cls.ctor_args = 
old_ctor_args;
-                                       stmt->fetch.cls.fci.param_count = 
old_arg_count;
-                               }
-                               break;
-
-                       default:
-                               break;
-               }
-
                for (idx = 0; i < stmt->column_count; i++, idx++) {
                        zval *val;
                        MAKE_STD_ZVAL(val);
@@ -1262,6 +1236,27 @@
                }

                switch (how) {
+                       case PDO_FETCH_CLASS:
+                               if (ce->constructor && !(flags & 
PDO_FETCH_PROPS_LATE)) {
+                                       stmt->fetch.cls.fci.object_pp = 
&return_value;
+                                       stmt->fetch.cls.fcc.object_pp = 
&return_value;
+                                       if 
(zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == 
FAILURE) {
+                                               pdo_raise_impl_error(stmt->dbh, 
stmt, "HY000", "could not call class constructor" TSRMLS_CC);
+                                               return 0;
+                                       } else {
+                                               if (stmt->fetch.cls.retval_ptr) 
{
+                                                       
zval_ptr_dtor(&stmt->fetch.cls.retval_ptr);
+                                               }
+                                       }
+                               }
+                               if (flags & PDO_FETCH_CLASSTYPE) {
+                                       do_fetch_opt_finish(stmt, 0 TSRMLS_CC);
+                                       stmt->fetch.cls.ce = old_ce;
+                                       stmt->fetch.cls.ctor_args = 
old_ctor_args;
+                                       stmt->fetch.cls.fci.param_count = 
old_arg_count;
+                               }
+                               break;
+
                        case PDO_FETCH_FUNC:
                                stmt->fetch.func.fci.param_count = idx;
                                stmt->fetch.func.fci.retval_ptr_ptr = &retval;

Modified: php/php-src/branches/PHP_5_2/ext/pdo_sqlite/tests/bug49521.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pdo_sqlite/tests/bug49521.phpt     
2010-03-18 21:53:50 UTC (rev 296360)
+++ php/php-src/branches/PHP_5_2/ext/pdo_sqlite/tests/bug49521.phpt     
2010-03-18 22:07:51 UTC (rev 296361)
@@ -33,7 +33,7 @@
 Book::__construct
 object(Book)#%d (2) {
   [%u|b%"title"]=>
-  string(3) "PHP"
+  string(0) ""
   [%u|b%"author"]=>
   string(6) "Rasmus"
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to