Skip to content

copy() target is blank in PHP 8.2.0-rc3 #9653

Closed
@pesselbach

Description

@pesselbach

Description

The following code:

<?php
copy("test.txt", "testcopy.txt");

Resulted in this output:
testcopy.txt is an empty 0 bytes file.

But I expected this output instead:
testcopy.txt is a copy of test.txt

The following workaround is working:

<?php
file_put_contents("testcopy.txt", file_get_contents("test.txt"));

This problem exists at least since PHP 8.2.0-rc1. Production versions such as PHP 8.1.11 are working as expected. I am using Debian 10 with the packages provided by https://deb.sury.org running in a VirtualBox machine.

PHP Version

PHP 8.2.0-rc3

Operating System

Debian 10

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions