#50657 [Opn->Ana]: copy() with an empty (zero-byte) HTTP source succeeds but returns false

From: Date: Mon, 04 Jan 2010 22:07:08 +0000
Subject: #50657 [Opn->Ana]: copy() with an empty (zero-byte) HTTP source succeeds but returns false
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-146334@lists.php.net to get a copy of this message
ID: 50657 Updated by: jani@php.net Reported By: php at lorddeath dot net -Status: Open +Status: Analyzed Bug Type: Filesystem function related Operating System: Win32/Linux PHP Version: 5.3SVN-2010-01-04 (snap) New Comment: _php_stream_copy_to_stream_ex() contains the problem, it assumes read length of 0 to be an error.. Previous Comments: ------------------------------------------------------------------------ [2010-01-04 21:57:30] jani@php.net Nevermind, the auto-link-thing in this crappy bug tracker messed the url. :) ------------------------------------------------------------------------ [2010-01-04 21:56:47] jani@php.net Was the file always returning 404 ? ------------------------------------------------------------------------ [2010-01-04 15:51:34] php at lorddeath dot net Description: ------------ The copy() function returns false (but otherwise succeeds in copying the file) when the source file is accessed via a HTTP stream, but is empty (zero bytes). Other, non-HTTP, stream types might also be affected, but local files are definitely *NOT* affected. I have successfully reproduced this bug with PHP 5.2.9 on Linux, and 5.2.5, 5.2.12, 5.3.0, 5.3.1 and 5.3.3-dev (2010-Jan-04 15:00:00) on Windows. (I will keep the empty.txt URL in the reproduce code accessible for a while.) Reproduce code: --------------- $r = copy("http://lspace.sihnon.net/pub/empty.txt", "temp"); var_dump($r); Expected result: ---------------- bool(true) Actual result: -------------- bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50657&edit=1

« previous php.bugs (#146334) next »