From:
Operating system: Mac
PHP version: 5.3.8
Package: Safe Mode/open_basedir
Bug Type: Bug
Bug description:copy() does not work consistently with stream wrappers and safe
mode
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 bug report at https://bugs.php.net/bug.php?id=60456&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60456&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60456&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60456&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60456&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60456&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60456&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60456&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60456&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60456&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60456&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60456&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60456&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60456&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60456&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60456&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60456&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60456&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60456&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60456&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60456&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60456&r=mysqlcfg