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.3.3RC1~259 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c200eeeb613b6d20063269c69ad725a53e2f0e37;p=php Fix #51374 (Wrongly initialized object properties) --- diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 3b47374206..e9eb9bad54 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -397,6 +397,9 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_ zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling 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; @@ -437,6 +440,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; @@ -455,6 +461,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===