From:             flack at contentcontrol-berlin dot de
Operating system: Ubuntu Linux
PHP version:      5.5.3
Package:          *General Issues
Bug Type:         Bug
Bug description:copy() doesn't work when destination filename is created by 
tempnam()

Description:
------------
See the script below. The expected output is

int(4)

instead, I get 

int(0)

I tested on the Ubuntu packages for php 5.3.10, 5.4.4 and 5.5.3.

When I use 

file_put_contents($src, $dst)

instead of copy(), it works as expected. Also, when I use fopen() and
stream_copy_to_stream(). Only the plain copy() function doesn't behave as
expected. Everything is on the same hard disk and was tested on three
different machines (Ubuntu 12.04, 13.04 and Debian 7).


Test script:
---------------
$src = '/tmp/file.txt';
touch ($src);
file_put_contents($src, 'test');
$dst = tempnam('/tmp', 'dst');
copy($src, $dst);
var_dump(filesize($dst));

Expected result:
----------------
int(4)

Actual result:
--------------
int(0)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65701&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65701&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65701&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65701&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65701&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65701&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65701&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65701&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65701&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65701&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65701&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65701&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65701&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65701&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65701&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65701&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65701&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65701&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65701&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65701&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65701&r=mysqlcfg

Reply via email to