summaryrefslogtreecommitdiff
path: root/ext/mysqli
diff options
context:
space:
mode:
authorGeorg Richter <georg@php.net>2004-12-03 07:56:19 +0000
committerGeorg Richter <georg@php.net>2004-12-03 07:56:19 +0000
commit30dd61abb7f1eda176db6457f251d8a86e2e8423 (patch)
treef8be0983a0d47958cec7f5f049513ed18165fc18 /ext/mysqli
parente99526eb7eb5b1353c8c8c600b8c946247eda45c (diff)
downloadphp-git-30dd61abb7f1eda176db6457f251d8a86e2e8423.tar.gz
Fixed bug #30967 (properties in extended mysqli classes don't work)
Diffstat (limited to 'ext/mysqli')
-rw-r--r--ext/mysqli/mysqli.c11
-rw-r--r--ext/mysqli/tests/bug30967.phpt21
2 files changed, 28 insertions, 4 deletions
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index a6cb3de2fe..833d8a5d07 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -310,7 +310,7 @@ PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_
zend_object_value retval;
mysqli_object *intern;
zval *tmp;
- zend_class_entry *parent;
+ zend_class_entry *mysqli_base_class;
intern = emalloc(sizeof(mysqli_object));
memset(intern, 0, sizeof(mysqli_object));
@@ -320,11 +320,14 @@ PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_
intern->ptr = NULL;
intern->valid = 0;
intern->prop_handler = NULL;
- if ((parent = class_type->parent))
+
+ mysqli_base_class = class_type;
+ while (mysqli_base_class->type != ZEND_INTERNAL_CLASS && mysqli_base_class->parent != NULL)
{
- zend_hash_find(&classes, parent->name, parent->name_length + 1, (void **) &intern->prop_handler);
+ mysqli_base_class = mysqli_base_class->parent;
}
- zend_hash_find(&classes, class_type->name, class_type->name_length + 1, (void **) &intern->prop_handler);
+ zend_hash_find(&classes, mysqli_base_class->name, mysqli_base_class->name_length + 1,
+ (void **) &intern->prop_handler);
ALLOC_HASHTABLE(intern->zo.properties);
zend_hash_init(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
diff --git a/ext/mysqli/tests/bug30967.phpt b/ext/mysqli/tests/bug30967.phpt
new file mode 100644
index 0000000000..f441cf0f19
--- /dev/null
+++ b/ext/mysqli/tests/bug30967.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #30967 testcase (properties)
+--FILE--
+<?php
+ include "connect.inc";
+
+ class mysql1 extends mysqli {
+ }
+
+ class mysql2 extends mysql1 {
+ }
+
+ $mysql = new mysql2("localhost", "root", "", "test");
+
+ $mysql->query("THIS DOES NOT WORK");
+ printf("%d\n", $mysql->errno);
+
+ $mysql->close();
+?>
+--EXPECTF--
+1064