php / php/php-src

Copy() target is blank in PHP 8.3.0

オープン
#12,899 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. 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 を短くまとめたダイジェスト。