georg           Fri Dec  3 02:57:39 2004 EDT

  Added files:                 (Branch: PHP_5_0)
    /php-src/ext/mysqli/tests   bug30967.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/mysqli mysqli.c 
  Log:
  MFH: Fix for bug #30967 (properties in extended mysqli classes don't work)
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.138&r2=1.1760.2.139&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.138 php-src/NEWS:1.1760.2.139
--- php-src/NEWS:1.1760.2.138   Thu Dec  2 21:26:36 2004
+++ php-src/NEWS        Fri Dec  3 02:57:38 2004
@@ -7,6 +7,7 @@
 - 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)
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.43.2.6&r2=1.43.2.7&ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.43.2.6 
php-src/ext/mysqli/mysqli.c:1.43.2.7
--- php-src/ext/mysqli/mysqli.c:1.43.2.6        Sat Sep  4 10:19:20 2004
+++ php-src/ext/mysqli/mysqli.c Fri Dec  3 02:57:39 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli.c,v 1.43.2.6 2004/09/04 14:19:20 georg Exp $ 
+  $Id: mysqli.c,v 1.43.2.7 2004/12/03 07:57:39 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