]> granicus.if.org Git - php/commitdiff
fix for bug 31141
authorGeorg Richter <georg@php.net>
Sat, 25 Dec 2004 16:42:53 +0000 (16:42 +0000)
committerGeorg Richter <georg@php.net>
Sat, 25 Dec 2004 16:42:53 +0000 (16:42 +0000)
ext/mysqli/mysqli.c
ext/mysqli/tests/bug31141.phpt [new file with mode: 0644]

index d9a8e1137baf0037155cf588541d8b41412f6f9d..28f9e97729b699b48d9a2565eeec051e1b658620 100644 (file)
@@ -218,7 +218,6 @@ zval *mysqli_read_property(zval *object, zval *member, int type TSRMLS_DC)
        } else {
                std_hnd = zend_get_std_object_handlers();
                retval = std_hnd->read_property(object, member, type TSRMLS_CC);
-               retval->refcount = 1;
        }
 
        if (member == &tmp_member) {
@@ -398,6 +397,8 @@ static void php_mysqli_init_globals(zend_mysqli_globals *mysqli_globals)
 PHP_MINIT_FUNCTION(mysqli)
 {
        zend_class_entry *ce;
+       zend_object_handlers *std_hnd = zend_get_std_object_handlers();
+
        
        ZEND_INIT_MODULE_GLOBALS(mysqli, php_mysqli_init_globals, NULL);
        REGISTER_INI_ENTRIES();
@@ -406,7 +407,7 @@ PHP_MINIT_FUNCTION(mysqli)
        mysqli_object_handlers.clone_obj = NULL;
        mysqli_object_handlers.read_property = mysqli_read_property;
        mysqli_object_handlers.write_property = mysqli_write_property;
-       mysqli_object_handlers.get_property_ptr_ptr = NULL;
+       mysqli_object_handlers.get_property_ptr_ptr = std_hnd->get_property_ptr_ptr;
        mysqli_object_handlers.get_constructor = php_mysqli_constructor_get;
 
        zend_hash_init(&classes, 0, NULL, NULL, 1);
diff --git a/ext/mysqli/tests/bug31141.phpt b/ext/mysqli/tests/bug31141.phpt
new file mode 100644 (file)
index 0000000..acad79f
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+Bug #31141 testcase (properties)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class Test extends mysqli
+{
+       public $test = array();
+
+       function foo()
+       {
+               $ar_test = array("foo", "bar");
+               $this->test = &$ar_test;
+       }
+}
+
+$my_test = new Test;
+$my_test->foo();
+var_dump($my_test->test);
+?>
+--EXPECTF--
+array(2) {
+  [0]=>
+  string(3) "foo"
+  [1]=>
+  string(3) "bar"
+}