diff options
| author | Etienne Kneuss <colder@php.net> | 2010-04-27 05:58:39 +0000 |
|---|---|---|
| committer | Etienne Kneuss <colder@php.net> | 2010-04-27 05:58:39 +0000 |
| commit | 739ebcc66e5033ec253f018c85a1b58a64a0b442 (patch) | |
| tree | 1bfc78f1a13a9fb1609e32c4b0b0da1fc2b74175 | |
| parent | 1892d92d68ec62122816a83b019c0d96fd79005f (diff) | |
| download | php-git-739ebcc66e5033ec253f018c85a1b58a64a0b442.tar.gz | |
Fix #51374 (Wrongly initialized object properties)
| -rwxr-xr-x | ext/spl/spl_directory.c | 9 | ||||
| -rw-r--r-- | ext/spl/tests/bug51374.phpt | 19 |
2 files changed, 28 insertions, 0 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 9b114fc0ad..b7fa311c65 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-- +<?php +class Foo extends SplFileObject +{ + public $bam = array(); +} +$fileInfo = new SplFileInfo('php://temp'); +$fileInfo->setFileClass('Foo'); +$file = $fileInfo->openFile('r'); + +print var_dump($file->bam); // is null or UNKNOWN:0 +?> +===DONE=== +--EXPECT-- +array(0) { +} +===DONE=== |
