Edit report at http://bugs.php.net/bug.php?id=51374&edit=1

 ID:          51374
 Updated by:  [email protected]
 Reported by: johnny at localmomentum dot net
 Summary:     initialized empty arrays in SPLFileObject subclasses fails
-Status:      Open
+Status:      Closed
 Type:        Bug
 Package:     SPL related
 PHP Version: 5.3.2
-Assigned To: 
+Assigned To: colder

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

It was caused by constant arrays not being transformed to real arrays
during class 

instantiation.


Previous Comments:
------------------------------------------------------------------------
[2010-04-27 07:58:43] [email protected]

Automatic comment from SVN on behalf of colder
Revision: http://svn.php.net/viewvc/?view=revision&revision=298638
Log: Fix #51374 (Wrongly initialized object properties)

------------------------------------------------------------------------
[2010-03-24 01:32:52] johnny at localmomentum dot net

Description:
------------
when subclassing SplFileObject and opening it via
SplFileInfo->openFile() initialized array properties of the subclass of
SplFileInfo are changing to null, while strings are fine.

Test script:
---------------
<?php

class Foo extends SplFileObject

{

        public $bar = 'baz';

        public $bam = array();

        function __construct($file)

        {

                // do stuff

                parent::__construct($file);     

        }

}

$fileInfo = new SplFileInfo('php://temp');

$fileInfo->setFileClass('Foo');

$file = $fileInfo->openFile('r');



print var_dump($file->bar); // is baz

print var_dump($file->bam); // is null or UNKNOWN:0

?>

Expected result:
----------------
I expected var_dump($file->bam) to print an empty array

Actual result:
--------------
null or UNKNOWN:0


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51374&edit=1

Reply via email to