svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/spl/spl_directory.c branches/PHP_5_2/ext/spl/tests/bug51374.phpt
branches/PHP_5_3/ext/spl/spl_directory.c branches/PHP_5_3/ext/spl/tests/bug51374.phpt trunk/ext/spl/spl_directory.c trunk/ext/spl/tests/bug51374.phpt
| From: | Etienne Kneuss | Date: | Tue, 27 Apr 2010 05:58:39 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/spl/spl_directory.c branches/PHP_5_2/ext/spl/tests/bug51374.phpt branches/PHP_5_3/ext/spl/spl_directory.c branches/PHP_5_3/ext/spl/tests/bug51374.phpt trunk/ext/spl/spl_directory.c trunk/ext/spl/tests/bug51374.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-62429@lists.php.net to get a copy of this message | ||
colder Tue, 27 Apr 2010 05:58:39 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=298638
Log:
Fix #51374 (Wrongly initialized object properties)
Bug: http://bugs.php.net/51374 (Open) initialized empty
arrays in SPLFileObject subclasses fails
Changed paths:
U php/php-src/branches/PHP_5_2/NEWS
U php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c
A php/php-src/branches/PHP_5_2/ext/spl/tests/bug51374.phpt
U php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c
A php/php-src/branches/PHP_5_3/ext/spl/tests/bug51374.phpt
U php/php-src/trunk/ext/spl/spl_directory.c
A php/php-src/trunk/ext/spl/tests/bug51374.phpt
Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS 2010-04-27 05:56:56 UTC (rev 298637)
+++ php/php-src/branches/PHP_5_2/NEWS 2010-04-27 05:58:39 UTC (rev 298638)
@@ -35,6 +35,7 @@
- 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)
Modified: php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c 2010-04-27 05:56:56 UTC (rev 298637)
+++ php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c 2010-04-27 05:58:39 UTC (rev 298638)
@@ -341,6 +341,9 @@
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 @@
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 @@
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;
Added: php/php-src/branches/PHP_5_2/ext/spl/tests/bug51374.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/spl/tests/bug51374.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/spl/tests/bug51374.phpt 2010-04-27 05:58:39 UTC (rev 298638)
@@ -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===
Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c 2010-04-27 05:56:56 UTC (rev 298637)
+++ php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c 2010-04-27 05:58:39 UTC (rev 298638)
@@ -397,6 +397,9 @@
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 @@
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 @@
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;
Added: php/php-src/branches/PHP_5_3/ext/spl/tests/bug51374.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/spl/tests/bug51374.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug51374.phpt 2010-04-27 05:58:39 UTC (rev 298638)
@@ -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===
Modified: php/php-src/trunk/ext/spl/spl_directory.c
===================================================================
--- php/php-src/trunk/ext/spl/spl_directory.c 2010-04-27 05:56:56 UTC (rev 298637)
+++ php/php-src/trunk/ext/spl/spl_directory.c 2010-04-27 05:58:39 UTC (rev 298638)
@@ -397,6 +397,9 @@
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 @@
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 @@
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;
Added: php/php-src/trunk/ext/spl/tests/bug51374.phpt
===================================================================
--- php/php-src/trunk/ext/spl/tests/bug51374.phpt (rev 0)
+++ php/php-src/trunk/ext/spl/tests/bug51374.phpt 2010-04-27 05:58:39 UTC (rev 298638)
@@ -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===