Bug #78575 [Opn]: copy() always report an error with a custom stream wrapper
| From: | nikic@php.net | Date: | Wed, 30 Oct 2019 10:28:39 +0000 |
| Subject: | Bug #78575 [Opn]: copy() always report an error with a custom stream wrapper | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223512@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78575&edit=1
ID: 78575
Updated by: nikic@php.net
Reported by: thomas dot gerbet at enalean dot com
Summary: copy() always report an error with a custom stream
wrapper
Status: Open
Type: Bug
Package: Streams related
PHP Version: 7.4.0RC2
Block user comment: N
Private report: N
New Comment:
Looks like that's indeed the case, and the issue has been recently fixed: https://github.com/bovigo/vfsStream/pull/204
Possibly we need to mention this potential issue in UPGRADING.
Previous Comments:
------------------------------------------------------------------------
[2019-10-30 10:25:47] nikic@php.net
copy() reports an error because a stream_read() call reported an error by returning false. Possibly
something in the implementation needs to be adjusted to return "" instead of false on EOF?
------------------------------------------------------------------------
[2019-09-20 13:02:47] thomas dot gerbet at enalean dot com
Description:
------------
Issue found while using the vfsStream library [0]. copy() always return false even if the data are
actually copied.
This behaviour change seems to be present since https://github.com/php/php-src/commit/11f3e24190fa45689c8ccaeea54a28db6752092e
[0] https://github.com/bovigo/vfsStream
Test script:
---------------
<?php
// See https://github.com/LeSuisse/php74-rc2-streamwrapper-bug
require_once __DIR__ . '/vendor/autoload.php';
$fs = org\bovigo\vfs\vfsStream::setup();
$source_path = $fs->url() . '/f1';
file_put_contents($source_path, 'A');
$destination_path = $fs->url() . '/f2';
var_dump(copy($source_path, $destination_path));
var_dump(file_get_contents($destination_path));
Expected result:
----------------
bool(true)
string(1) "A"
Actual result:
--------------
bool(false)
string(1) "A"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78575&edit=1