georg           Fri Dec  3 02:56:19 2004 EDT

  Added files:                 
    /php-src/ext/mysqli/tests   bug30967.phpt 

  Modified files:              
    /php-src/ext/mysqli mysqli.c 
  Log:
  Fixed bug #30967 (properties in extended mysqli classes don't work)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.52&r2=1.53&ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.52 php-src/ext/mysqli/mysqli.c:1.53
--- php-src/ext/mysqli/mysqli.c:1.52    Wed Aug 25 09:57:35 2004
+++ php-src/ext/mysqli/mysqli.c Fri Dec  3 02:56:18 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli.c,v 1.52 2004/08/25 13:57:35 georg Exp $ 
+  $Id: mysqli.c,v 1.53 2004/12/03 07:56:18 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -310,7 +310,7 @@
        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 @@
        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);

http://cvs.php.net/co.php/php-src/ext/mysqli/tests/bug30967.phpt?r=1.1&p=1
Index: php-src/ext/mysqli/tests/bug30967.phpt
+++ php-src/ext/mysqli/tests/bug30967.phpt
--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

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to