php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78042 SplTempFileObject::isReadable() / SplTempFileObject::isWritable() return values
Submitted: 2019-05-20 15:27 UTC Modified: -
From: phansys at gmail dot com Assigned:
Status: Open Package: Filesystem function related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-05-20 15:27 UTC] phansys at gmail dot com
Description:
------------
SplTempFileObject::isReadable() and SplTempFileObject::isWritable() are returning false regardless the resource is readable or writable.

Test script:
---------------
$file = new \SplTempFileObject(-1);
$written = $file->fwrite('readable content');
$file->fflush();
$file->rewind();
var_dump($file->getFileInfo()->getPathname());
var_dump($file->valid());
var_dump($file->isReadable());
var_dump($file->fread($written));
var_dump($file->isWritable());
$written += $file->fwrite(' is writable');
$file->fflush();
$file->rewind();
var_dump($file->fread($written));

// @see https://3v4l.org/OEYn8

Expected result:
----------------
string(12) "php://memory"
bool(true)
bool(true)
string(16) "readable content"
bool(true)
string(28) "readable content is writable"

Actual result:
--------------
string(12) "php://memory"
bool(true)
bool(false)
string(16) "readable content"
bool(false)
string(28) "readable content is writable"

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-20 15:31 UTC]
The following pull request has been associated:

Patch Name: [SplTempFileObject] [bug#78042] SplTempFileObject::isReadable() / SplTempFileObject::isWritable() return values
On GitHub:  https://github.com/php/php-src/pull/4178
Patch:      https://github.com/php/php-src/pull/4178.patch
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 18:01:38 2019 UTC