Bug #60456 [Opn->Csd]: copy() does not work consistently with stream wrappers and safe mode

From: Date: Thu, 27 Aug 2015 14:23:39 +0000
Subject: Bug #60456 [Opn->Csd]: copy() does not work consistently with stream wrappers and safe mode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195553@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60456&edit=1 ID: 60456 Updated by: cmb@php.net Reported by: lyricnz at gmail dot com Summary: copy() does not work consistently with stream wrappers and safe mode -Status: Open +Status: Closed Type: Bug Package: Safe Mode/open_basedir Operating System: Mac PHP Version: 5.3.8 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: As of PHP 5.4.0 the safe mode "feature" has been removed, so this issue is resolved. Previous Comments: ------------------------------------------------------------------------ [2011-12-07 11:04:23] lyricnz at gmail dot com Description: ------------ Stream wrappers which ultimately result in file operations which should be permitted by safe mode do not work in some circumstances. For example, a stream wrapper which simply stores files in sys_get_temp_dir() works fine without safe mode, but fails when that is enabled: // copy 1: file to stream wrapper $ok = copy('/tmp/source.txt', 'temp://destination.txt'); // copy 2: stream wrapper to file $ok = copy('temp://destination.txt', '/tmp/source.txt'); // copy 3: SAME file as stream wrapper to file $ok = copy(sys_get_temp_dir() . '/destination.txt', '/tmp/source.txt'); Under safe mode, the second copy fails with error message Warning: copy() [function.copy]: Unable to access temp://destination.txt in .../test-copy.php on line ... This may be related to https://bugs.php.net/bug.php?id=46888 Test script: --------------- http://drupal.org/files/test-copy.txt Expected result: ---------------- All three file copies should succeed, since sys_get_temp_dir() returns a directory accessible to safe-mode. Actual result: -------------- Second copy fails. Third copy, which refers to the same files, succeeds. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60456&edit=1

« previous php.bugs (#195553) next »