php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #41754 copy() function returns true for copying an empty file on windows.
Submitted: 2007-06-21 08:06 UTC Modified: 2007-08-16 14:08 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: nikhil dot gupta at in dot ibm dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5CVS-2007-06-21 (snap) OS: Windows
Private report: No CVE-ID: None
 [2007-06-21 08:06 UTC] nikhil dot gupta at in dot ibm dot com
Description:
------------
When copy()  function is used to make a copy of an empty file on Windows, it returns "true".But according to the documentation : 

"Note: Windows compatibility: If you copy a file with no size, copy() will return FALSE, but the file will be correctly copied."

but it outputs true on Windows as well as Linux on both php5 and php6. This behaviour is contradictory to that mentioned in documentation. It may require change in documentation.




Reproduce code:
---------------
<?php
$file_handle = fopen("temp.txt", "w");
fclose($file_handle);
var_dump(copy("temp.txt", "tempcopy.txt"));
?>

Expected result:
----------------
bool(false)

Actual result:
--------------
bool(true)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-16 14:08 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Aug 15 22:00:02 2025 UTC