]> granicus.if.org Git - php/commitdiff
MFB Fixed bug #46086 (Segfault when accessing fileinfo class property)
authorScott MacVicar <scottmac@php.net>
Mon, 15 Sep 2008 22:15:16 +0000 (22:15 +0000)
committerScott MacVicar <scottmac@php.net>
Mon, 15 Sep 2008 22:15:16 +0000 (22:15 +0000)
ext/fileinfo/fileinfo.c

index 9695bad6726ba98e2f3334b4e60609094fed6d8c..1b89036efef5e4b7e0aab640f1d523ab94795674 100644 (file)
@@ -99,16 +99,13 @@ PHP_FILEINFO_API zend_object_value finfo_objects_new(zend_class_entry *class_typ
 {
        zend_object_value retval;
        struct finfo_object *intern;
+       zval *tmp;
+
+       intern = emalloc(sizeof(struct finfo_object));
+
+       zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
+       zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *));
 
-       intern = ecalloc(1, sizeof(struct finfo_object));
-       intern->zo.ce = class_type;
-       intern->zo.properties = NULL;
-#if ZEND_MODULE_API_NO >= 20050922
-       intern->zo.guards = NULL;
-#else
-       intern->zo.in_get = 0;
-       intern->zo.in_set = 0;
-#endif
        intern->ptr = NULL;
 
        retval.handle = zend_objects_store_put(intern, finfo_objects_dtor, NULL, NULL TSRMLS_CC);