|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42965 copy() should support context parameters for URLs
Submitted: 2007-10-15 02:21 UTC Modified: 2010-08-17 14:19 UTC
Avg. Score:4.2 ± 0.4
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: mmatson at apple dot com Assigned: kalle (profile)
Status: Closed Package: *General Issues
PHP Version: 5.2.4 OS: OS X 10.4.10
Private report: No CVE-ID: None
 [2007-10-15 02:21 UTC] mmatson at apple dot com
The copy function should accept context parameters since it can accept 
URL's of the fopen wrapper variety. Specific situation where this is 
needed is when using ftp:// url's you should be able to specify 
overwrite context for the destination URL.

Reproduce code:
N/A: feature request for filesystem function

Expected result:
copy should be able to over write a destination file when using ftp:// 

Actual result:
Throws error:
PHP Warning:  copy( failed to open 
stream: Remote file already exists and overwrite context option not 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-16 23:56 UTC]
Automatic comment from SVN on behalf of kalle
Log: Fixed the context parameter on copy() to actually have an effect

# After looking at the logs, Jani did a bad merge into 5.3, so that
# the context parameter sent to copy() actually isn't used at all. This
# relatively simple patch fixes that for trunk.
# See FR #42965

# internals:
# This changes the php_copy_*() decls to contain an additional parameter for stream contexts
 [2010-08-16 23:57 UTC]
-Status: Open +Status: Assigned -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: kalle
 [2010-08-17 14:19 UTC]
-Status: Assigned +Status: Closed
 [2010-08-17 14:19 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

Fixed for 5.3.4, see svn logs for more info why it wasn't working in 5.3.0-5.3.3
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jun 13 07:01:23 2021 UTC