]> granicus.if.org Git - php/commitdiff
revert 293939 Fixed bug #50636 (MySQLi_Result sets values before calling
authorJohannes Schlüter <johannes@php.net>
Thu, 11 Feb 2010 21:42:48 +0000 (21:42 +0000)
committerJohannes Schlüter <johannes@php.net>
Thu, 11 Feb 2010 21:42:48 +0000 (21:42 +0000)
constructor)

ext/mysqli/mysqli.c
ext/mysqli/tests/bug50636.phpt [deleted file]

index 266329e32ded8794e7c18e08bbf4f2beb13d1379..0f5bc71c63282b8e6cd68e918fa2fb0d917caae8 100644 (file)
@@ -1204,6 +1204,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
                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 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
                } 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);
        }
 }
 /* }}} */
diff --git a/ext/mysqli/tests/bug50636.phpt b/ext/mysqli/tests/bug50636.phpt
deleted file mode 100644 (file)
index 47f2772..0000000
+++ /dev/null
@@ -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!