From: Etienne Kneuss Date: Tue, 27 Apr 2010 05:58:39 +0000 (+0000) Subject: Fix #51374 (Wrongly initialized object properties) X-Git-Tag: php-5.2.14RC1~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6edecbf5d92b34ea72e24b436e8d4c9358a523a0;p=php Fix #51374 (Wrongly initialized object properties) --- diff --git a/NEWS b/NEWS index 443094fc5d..9aeaebcbe8 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,7 @@ PHP NEWS - Fixed bug #51445 (var_dump() invalid/slow *RECURSION* detection). (Felipe) - Fixed bug #51393 (DateTime::createFromFormat() fails if format string contains timezone). (Adam) +- Fixed bug #51374 (Wrongly initialized object properties). (Etienne) - Fixed bug #51338 (URL-Rewriter is still enabled if use_only_cookies is on). (Ilia, j dot jeising at gmail dot com) - Fixed bug #51269 (zlib.output_compression Overwrites Vary Header). (Adam) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index a0a9251aa8..3ea16685bb 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -341,6 +341,9 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_ php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); ce = ce ? ce : source->info_class; + + zend_update_class_constants(ce TSRMLS_CC); + return_value->value.obj = spl_filesystem_object_new_ex(ce, &intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; @@ -381,6 +384,9 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil switch (type) { case SPL_FS_INFO: ce = ce ? ce : source->info_class; + + zend_update_class_constants(ce TSRMLS_CC); + return_value->value.obj = spl_filesystem_object_new_ex(ce, &intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; @@ -399,6 +405,9 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil break; case SPL_FS_FILE: ce = ce ? ce : source->file_class; + + zend_update_class_constants(ce TSRMLS_CC); + return_value->value.obj = spl_filesystem_object_new_ex(ce, &intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; diff --git a/ext/spl/tests/bug51374.phpt b/ext/spl/tests/bug51374.phpt new file mode 100644 index 0000000000..a4d285322d --- /dev/null +++ b/ext/spl/tests/bug51374.phpt @@ -0,0 +1,19 @@ +--TEST-- +SPL: SplFileObject wrongly initializes objects +--FILE-- +setFileClass('Foo'); +$file = $fileInfo->openFile('r'); + +print var_dump($file->bam); // is null or UNKNOWN:0 +?> +===DONE=== +--EXPECT-- +array(0) { +} +===DONE===