johannes                                 Thu, 11 Feb 2010 21:42:48 +0000

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

Log:
revert 293939 Fixed bug #50636 (MySQLi_Result sets values before calling
constructor)

Bug: http://bugs.php.net/50636 (Closed) MySQLi_Result sets values before 
calling constructor
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c
    D   php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug50636.phpt
    U   php/php-src/trunk/ext/mysqli/mysqli.c
    D   php/php-src/trunk/ext/mysqli/tests/bug50636.phpt

Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c    2010-02-11 21:17:13 UTC 
(rev 294900)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c    2010-02-11 21:42:48 UTC 
(rev 294901)
@@ -1204,6 +1204,7 @@
                zval *retval_ptr;

                object_and_properties_init(return_value, ce, NULL);
+               zend_merge_properties(return_value, Z_ARRVAL(dataset), 1 
TSRMLS_CC);

                if (ce->constructor) {
                        fci.size = sizeof(fci);
@@ -1259,8 +1260,6 @@
                } else if (ctor_params) {
                        
zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, 
"Class %s does not have a constructor hence you cannot use ctor_params", 
ce->name);
                }
-
-               zend_merge_properties(return_value, Z_ARRVAL(dataset), 1 
TSRMLS_CC);
        }
 }
 /* }}} */

Deleted: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug50636.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug50636.phpt 2010-02-11 
21:17:13 UTC (rev 294900)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug50636.phpt 2010-02-11 
21:42:48 UTC (rev 294901)
@@ -1,35 +0,0 @@
---TEST--
-Bug #50636 (MySQLi_Result sets values before calling constructor)
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once('skipifconnectfailure.inc');
-?>
---FILE--
-<?php
-       include ("connect.inc");
-
-    class Book {
-        private $title = 0;
-
-        function __construct() {
-            $this->title = 'foobar';
-        }
-
-        function __set($name, $value) {
-            $this->{$name}   = $value;
-        }
-    }
-
-    $link = new mysqli($host, $user, $passwd);
-    var_dump($link->query('SELECT "PHP" AS title, "Rasmus" AS 
author')->fetch_object('Book'));
-    echo "done!";
-?>
---EXPECTF--
-object(Book)#%d (2) {
-  ["title":"Book":private]=>
-  string(3) "PHP"
-  ["author"]=>
-  string(6) "Rasmus"
-}
-done!

Modified: php/php-src/trunk/ext/mysqli/mysqli.c
===================================================================
--- php/php-src/trunk/ext/mysqli/mysqli.c       2010-02-11 21:17:13 UTC (rev 
294900)
+++ php/php-src/trunk/ext/mysqli/mysqli.c       2010-02-11 21:42:48 UTC (rev 
294901)
@@ -1236,6 +1236,7 @@
                zval *retval_ptr;

                object_and_properties_init(return_value, ce, NULL);
+               zend_merge_properties(return_value, Z_ARRVAL(dataset), 1 
TSRMLS_CC);

                if (ce->constructor) {
                        fci.size = sizeof(fci);
@@ -1291,8 +1292,6 @@
                } else if (ctor_params) {
                        
zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, 
"Class %v does not have a constructor hence you cannot use ctor_params", 
ce->name);
                }
-
-               zend_merge_properties(return_value, Z_ARRVAL(dataset), 1 
TSRMLS_CC);
        }
 }
 /* }}} */

Deleted: php/php-src/trunk/ext/mysqli/tests/bug50636.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/bug50636.phpt    2010-02-11 21:17:13 UTC 
(rev 294900)
+++ php/php-src/trunk/ext/mysqli/tests/bug50636.phpt    2010-02-11 21:42:48 UTC 
(rev 294901)
@@ -1,35 +0,0 @@
---TEST--
-Bug #50636 (MySQLi_Result sets values before calling constructor)
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once('skipifconnectfailure.inc');
-?>
---FILE--
-<?php
-       include ("connect.inc");
-
-    class Book {
-        private $title = 0;
-
-        function __construct() {
-            $this->title = 'foobar';
-        }
-
-        function __set($name, $value) {
-            $this->{$name}   = $value;
-        }
-    }
-
-    $link = new mysqli($host, $user, $passwd);
-    var_dump($link->query('SELECT "PHP" AS title, "Rasmus" AS 
author')->fetch_object('Book'));
-    echo "done!";
-?>
---EXPECTF--
-object(Book)#%d (2) {
-  [%u|b%"title":%u|b%"Book":private]=>
-  %unicode|string%(3) "PHP"
-  [%u|b%"author"]=>
-  %unicode|string%(6) "Rasmus"
-}
-done!

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

Reply via email to