Copy() target is blank in PHP 8.3.0
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.2k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the PHP 8.3.0 copy() failure with the stated Windows 10, VirtualBox 7.0.12, Ubuntu 20.04, and shared-folder setup. Compare the behavior with the file_get_contents()/file_put_contents() workaround and review related issues 9656 and 9653; done means copy() reliably preserves the source contents in this environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100