From: kirils at r1g dot edu dot lv Operating system: Linux 2.4.32 PHP version: 4.4.1 PHP Bug Type: Safe Mode/open_basedir Bug description: new files can not be created in safe mode
Description: ------------ if safe_mode on, and fopen, imagejpeg (to file) .. wants to write to file that does not exist the file DOES NOT GET CREATED (file/dir permissions OK), but an error gets displayed. Warning: imagepng(): Unable to access img/test.png in /.../t.php on line 4 Warning: imagepng(): Invalid filename 'img/test.png' in /.../t.php on line 4 Reproduce code: --------------- <?php $img = imagecreatefrompng('img/font.png'); imagepng($img,'img/test.png') or die('wtf?'); echo 'test'; ?> Expected result: ---------------- i expect img/test.png to be created and "test" displayed. Actual result: -------------- img/test.png does not get created. imagecreatefrompng() works, but imagepng() fails ,dying with text "wtf?". -- this code circumvents the bug: <?php $img = imagecreatefrompng('img/font.png'); touch('img/test.png'); imagepng($img,'img/test.png') or die('wtf?'); echo 'test'; ?> -- Edit bug report at http://bugs.php.net/?id=35877&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35877&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35877&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35877&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35877&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35877&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35877&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35877&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35877&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35877&r=support Expected behavior: http://bugs.php.net/fix.php?id=35877&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35877&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35877&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35877&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35877&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35877&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35877&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35877&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35877&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35877&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35877&r=mysqlcfg