php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69956 SplTempFileObject::__construct() arguments
Submitted: 2015-06-28 13:49 UTC Modified: 2015-06-28 15:05 UTC
From: phansys at gmail dot com Assigned: salathe (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: phansys at gmail dot com
New email:
PHP Version: OS:

 

 [2015-06-28 13:49 UTC] phansys at gmail dot com
Description:
------------
Documentation tells that SplTempFileObject::__construct() inherits SplFileObject::__construct, but this isn't true since the constructor is overwrited in the class:

```
/* Methods */
public __construct ([ int $max_memory ] )

/* Inherited methods */
public SplFileObject::__construct ( string $filename [, string $open_mode = "r" [, bool $use_include_path = false [, resource $context ]]] )
```

Since there is no access to parent's constructor, there is no way to specify the open mode for SplTempFileObject.

Test script:
---------------
$file = new \SplTempFileObject('php://temp', 'a+');
$file->fwrite(file_get_contents($filePath));
$file->fflush();

Expected result:
----------------
$file->isReadable(); // I would expect this to return true, but the open mode is always "w" and I haven't a way to change it.

Actual result:
--------------
```
RuntimeException: SplTempFileObject::__construct() expects at most 1 parameter, 2 given
```

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-28 14:57 UTC] salathe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: salathe
 [2015-06-28 15:04 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=337074
Log: use constructorsynopsis for SplFileObject (doc bug #69956)

So that the constructor is not incorrectly listed
under Inherited Methods for child classes.
 [2015-06-28 15:05 UTC] salathe@php.net
-Status: Assigned +Status: Closed
 [2015-06-28 15:05 UTC] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

The documentation has been updated so that SplFileObject::__construct() will not be listed under Inherited Methods for SplTempFileObject
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 12:00:01 2026 UTC