summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Richter <georg@php.net>2004-12-25 16:42:53 +0000
committerGeorg Richter <georg@php.net>2004-12-25 16:42:53 +0000
commitea22bf606367381fcdabae26d9da60d2fd3b1197 (patch)
tree6d554f36f9c912e84dbae35b2d641a0736402016
parent8c7bd30a7bcaddb611660c998bcb4ce485c8070e (diff)
downloadphp-git-ea22bf606367381fcdabae26d9da60d2fd3b1197.tar.gz
fix for bug 31141
-rw-r--r--ext/mysqli/mysqli.c5
-rw-r--r--ext/mysqli/tests/bug31141.phpt28
2 files changed, 31 insertions, 2 deletions
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index d9a8e1137b..28f9e97729 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -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
index 0000000000..acad79f1f9
--- /dev/null
+++ b/ext/mysqli/tests/bug31141.phpt
@@ -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"
+}