php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39575 move_uploaded_file no longer working (safe mode related)
Submitted: 2006-11-21 23:08 UTC Modified: 2006-11-22 11:55 UTC
From: ch at hoffie dot info Assigned:
Status: Closed Package: Safe Mode/open_basedir
PHP Version: 5CVS-2006-11-21 (snap) OS: Linux 2.6
Private report: No CVE-ID: None
 [2006-11-21 23:08 UTC] ch at hoffie dot info
Description:
------------
While move_uploaded_file() correctly worked with PHP 5.2.0, it stopped working with recent snapshots of 5.2.1-dev (maybe earlier). Appearently PHP (main/safe_mode.c?) checks whether the target file exists -- and this obviously is never true for a file which is going to be moved there (but isn't there yet).

./configure --disable-all --disable-cli --enable-fastcgi

Reproduce code:
---------------
(with safe_mode enabled and a correct file upload POST request)
<?php
  move_uploaded_file($_FILES['foo']['tmp_name'], "test.gif");
?>

Expected result:
----------------
The POSTed file should be moved to "test.gif" like in earlier PHP versions.

Actual result:
--------------
Warning: move_uploaded_file(): Unable to access /www/test.gif in /www/upload.php on line 2

No test.gif appears (although the permissions are correct; the uid of PHP is the same as the directory where test.gif should be put; nothing has been changed since the update from 5.2.0 to today's cvs snapshot)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-22 11:55 UTC] tony2001@php.net
This bug has been fixed in CVS.

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


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 02:01:28 2024 UTC