|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51374 initialized empty arrays in SPLFileObject subclasses fails
Submitted: 2010-03-24 01:32 UTC Modified: 2010-04-27 08:01 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: johnny at localmomentum dot net Assigned: colder (profile)
Status: Closed Package: SPL related
PHP Version: 5.3.2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: johnny at localmomentum dot net
New email:
PHP Version: OS:


 [2010-03-24 01:32 UTC] johnny at localmomentum dot net
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:
class Foo extends SplFileObject
        public $bar = 'baz';
        public $bam = array();
	function __construct($file)
		// do stuff
$fileInfo = new SplFileInfo('php://temp');
$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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-27 07:58 UTC]
Automatic comment from SVN on behalf of colder
Log: Fix #51374 (Wrongly initialized object properties)
 [2010-04-27 08:01 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: colder
 [2010-04-27 08:01 UTC]
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
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 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 18 04:03:37 2021 UTC