php / php/php-src

Copy() target is blank in PHP 8.3.0

未关闭
#12,899 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Status: Needs Triage
主要语言
C
星标
40.4k
派生
8.2k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

The following code:

<?php
$source = '/media/sf_source/text.txt';
$destination = '/media/sf_destination/text.txt';
copy($source, $destination);

Resulted in this output:
/media/sf_destination/text.txt is an empty 0 bytes file.

How to replicate

php is running in the guest and tries to copy a file from a shared folder to an other shared folder.
Permissions are ok on the source and destination.
I tried to activate/disable the option "Host Input/Output Caching" of VirtualBox. There is no visible impact.

Environnement

Host: Windows 10 running VirtualBox 7.0.12
Guest: Ubuntu 20.04.

Workaround
<?php
file_put_contents('/media/sf_destination/text.txt', file_get_contents('/media/sf_source/text.txt'));
Related?

https://github.com/php/php-src/issues/9656
https://github.com/php/php-src/issues/9653

PHP Version

PHP 8.3.0

Operating System

Ubuntu 20.04 + Windows 10

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用所述的 Windows 10、VirtualBox 7.0.12、Ubuntu 20.04 和共享文件夹配置,重现 PHP 8.3.0 中 copy() 的失败。将其行为与 file_get_contents()/file_put_contents() 的变通方案进行比较,并检查相关 issue 9656 和 9653;当 copy() 在此环境中能够可靠地保留源内容时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
operating-systems
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。