Doc #69956 [Opn->Asn]: SplTempFileObject::__construct() arguments
| From: | salathe@php.net | Date: | Sun, 28 Jun 2015 14:57:49 +0000 |
| Subject: | Doc #69956 [Opn->Asn]: SplTempFileObject::__construct() arguments | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12484@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69956&edit=1
ID: 69956
Updated by: salathe@php.net
Reported by: phansys at gmail dot com
Summary: SplTempFileObject::__construct() arguments
-Status: Open
+Status: Assigned
Type: Documentation Problem
Package: Documentation problem
Operating System: Irrelevant
PHP Version: Irrelevant
-Assigned To:
+Assigned To: salathe
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2015-06-28 13:49:41] 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
```
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69956&edit=1