tony2001                Sat Nov 26 04:40:55 2005 EDT

  Modified files:              (Branch: PHP_5_1)
    /php-src    NEWS 
    /php-src/ext/date   php_date.c 
  Log:
  MFH: fix #35402 (New date class causes crash in get_object_vars())
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2027.2.224&r2=1.2027.2.225&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.224 php-src/NEWS:1.2027.2.225
--- php-src/NEWS:1.2027.2.224   Fri Nov 25 07:55:54 2005
+++ php-src/NEWS        Sat Nov 26 04:40:50 2005
@@ -5,6 +5,7 @@
 - Added an additional field $frame['object'] to the result array of
   debug_backtrace() that contains a reference to the respective object when the
   frame was called from an object. (Sebastian)
+- Fixed bug #35402 (New date class causes crash in get_object_vars()). (Tony)
 - Fixed bug #35391 (pdo_mysql::exec does not return number of affected rows). 
   (Tony)
 - Fixed bug #35360 (exceptions in interactive mode (php -a) may cause crash).
http://cvs.php.net/diff.php/php-src/ext/date/php_date.c?r1=1.43.2.22&r2=1.43.2.23&ty=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.22 
php-src/ext/date/php_date.c:1.43.2.23
--- php-src/ext/date/php_date.c:1.43.2.22       Sun Nov 20 15:14:23 2005
+++ php-src/ext/date/php_date.c Sat Nov 26 04:40:54 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_date.c,v 1.43.2.22 2005/11/20 20:14:23 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.23 2005/11/26 09:40:54 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -1038,11 +1038,16 @@
 {
        php_date_obj *intern;
        zend_object_value retval;
+       zval *tmp;
 
        intern = emalloc(sizeof(php_date_obj));
        memset(intern, 0, sizeof(php_date_obj));
        intern->std.ce = class_type;
-
+       
+       ALLOC_HASHTABLE(intern->std.properties);
+       zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+       zend_hash_copy(intern->std.properties, &class_type->default_properties, 
(copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
+       
        retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t)zend_objects_destroy_object, 
(zend_objects_free_object_storage_t) date_object_free_storage_date, NULL 
TSRMLS_CC);
        retval.handlers = &date_object_handlers_date;
        
@@ -1075,6 +1080,12 @@
                timelib_time_dtor(intern->time);
        }
 
+       if (intern->std.properties) {
+               zend_hash_destroy(intern->std.properties);
+               efree(intern->std.properties);
+               intern->std.properties = NULL;
+       }
+       
        efree(object);
 }
 

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

Reply via email to