php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78575 copy() always report an error with a custom stream wrapper
Submitted: 2019-09-20 13:02 UTC Modified: 2019-10-30 10:32 UTC
Votes:5
Avg. Score:4.0 ± 0.6
Reproduced:5 of 5 (100.0%)
Same Version:5 (100.0%)
Same OS:4 (80.0%)
From: thomas dot gerbet at enalean dot com Assigned: nikic (profile)
Status: Closed Package: Streams related
PHP Version: 7.4.0RC2 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: thomas dot gerbet at enalean dot com
New email:
PHP Version: OS:

 

 [2019-09-20 13:02 UTC] 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"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-30 10:25 UTC] 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-10-30 10:28 UTC] nikic@php.net
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.
 [2019-10-30 10:32 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 07:01:29 2024 UTC