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: 2024-04-14 15:39 UTC
From: phansys at gmail dot com Assigned:
Status: Open Package: SPL related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
 [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

Pull Requests

Pull requests:

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
 [2021-10-04 14:49 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fixed bug #78042 
On GitHub:  https://github.com/php/php-src/pull/4186
Patch:      https://github.com/php/php-src/pull/4186.patch
 [2024-04-14 15:39 UTC] bukka@php.net
-Package: Filesystem function related +Package: SPL related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 01:01:30 2024 UTC