|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-09-24 20:19 UTC] software-php at interfasys dot ch
Description:
------------
I'm using PHP-FPM 5.4.33
In a secondary ini file add a section which will apply to one website and disable chmod
[HOST=my.web.site]
disable_functions = "chmod"
Check that the function is disabled via phpinfo()
In my case, the local value for disable_functions shows "chmod"
Create a simple script which chmods a file
Test script:
---------------
if (!ini_get('display_errors')) {
ini_set('display_errors', '1');
}
echo ini_get('display_errors');
echo "I am chowning a file";
chmod("testcase.php", 0777);
Expected result:
----------------
I should get an error message telling me that this is not allowed
Actual result:
--------------
The file is chowned to 777.
Not that if the same function is added to Suhosin's blacklist, then I will get the proper warning:
"Warning: chmod() has been disabled for security reasons"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 05:00:01 2025 UTC |
There are 2 problems with your test #1 You did not add disable_functions to a php.ini section. That's where there might be a problem. It's still php.ini (the only location where disable_functions works), so should be supported or clearly stated as not working --INI-- [HOST=my.web.site] disable_functions = "chmod" #2 Your test did not test phpinfo() to see if chmod was being reported as being disabled. In my test it was shown as disabled (via the GUI), indicating that php.ini sections settings were properly picked up, but not properly applied. --FILE-- <? php echo 'disable_functions = ' . ini_get('disable_functions') . "</br>"; echo 'Is chmod allowed? ' . function_exists('chmod') . "</br>"; Now if I go to my.web.site/test.php, I get this disable_functions = chmod Is chmod allowed? 1 instead of disable_functions = chmod Is chmod allowed? 0