|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-09-05 11:59 UTC] Bjorn dot Wiberg at its dot uu dot se
Description: ------------ If open_basedir is used -- even if it includes /tmp among its directories -- calling tempnam() with an empty string as the first (directory) argument does not make PHP fall back to "the system default" as http://se.php.net/manual/en/function.tempnam.php specifies. Reproduce code: --------------- // open_basedir: .:/apache/php/lib:/tmp:/usr/local/bin:/usr/local/etc/Counter/data:/apache/htdocs/webdev-its tempnam('', 'test'); Expected result: ---------------- No errors, temporary file gets created in /tmp or whatever the fallback is. Actual result: -------------- From the Apache error log: Warning: tempnam(): open_basedir restriction in effect. File() is not within the allowed path(s): (.:/apache/php/lib:/tmp:/usr/local/bin:/usr/local/etc/Counter/data:/apache/htdocs/webdev-its) in /apache/htdocs/webdev-its/limesurvey/admin/classes/pear/OLE/PPS/File.php on line 87 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 13:00:01 2025 UTC |
I think... this will not cause side effects. in the file: ext/standard/file.c in the function: PHP_FUNCTION(tempnam) remove: if (php_check_open_basedir(dir TSRMLS_CC)) { RETURN_FALSE; } in the file: main/php_open_temporary_file.c in the function: PHPAPI int php_open_temporary_fd_ex include before the comment: /* Try the directory given as parameter. */ this: if (php_check_open_basedir(dir TSRMLS_CC)) { return -1; } And remove this: !open_basedir_check It seems it does not work, and now it will be bad.