]> granicus.if.org Git - php/commitdiff
MFH: Fix for bug #30967 (properties in extended mysqli classes don't work)
authorGeorg Richter <georg@php.net>
Fri, 3 Dec 2004 07:57:39 +0000 (07:57 +0000)
committerGeorg Richter <georg@php.net>
Fri, 3 Dec 2004 07:57:39 +0000 (07:57 +0000)
NEWS
ext/mysqli/mysqli.c

diff --git a/NEWS b/NEWS
index 6b5c8f58eaa4b9fb6f3cc2df4583dc5c286096a9..46eed24b605b1c52b985d709f9f8f7415e169b74 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ PHP                                                                        NEWS
 - Extended the functionality of is_subclass_of() to accept either a class name
   or an object as first parameter. (Andrey) 
 - Fixed potential problems with unserializing invalid serialize data. (Marcus)
+- Fixed bug #30967 (properties in extended mysqli classes don't work). (Georg)
 - Fixed bug #30962 (mssql returns space for NULL columns). (Ilia)
 - Fixed bug #30856 (ReflectionClass::getStaticProperties segfaults). (Marcus)
 - Fixed bug #30832 ("!" stripped off comments in xml parser). (Rob)
index a6cb3de2fe389895095d0fd3a793a5632b1c177e..833d8a5d075c4944afda623be48c7f8e42c5ed70 100644 (file)
@@ -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);