warning: shell_exec() has been disabled for security reasons, getid3.lib.php
joachim - February 23, 2007 - 09:51
| Project: | Media Field |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I'm getting the fatal error described at http://drupal.org/node/121018
In addition, when I create a new node and it correctly displays the first time, I get this warning message at the top of the node content:
warning: shell_exec() has been disabled for security reasons in /home/seasider/public_html/drupal5/misc/lib/getid3/getid3/getid3.lib.php on line 635.
This happens with both 5.x-1.0 and the latest dev version.

#1
Downloaded 5.0 dev release. Official one created by Heine doesn't have this fix.
As for getid3, I didn't find shell_exec() somewhere in their code. I think this problem isn't connected with Drupal or audio field.
#2
I've found this thread about it:
http://drupal.org/node/43120
Same error, but another module.
But I can't find any mention of 'shell_exec' in any part of my drupal install.
#3
Yes, we don't use this function at all.
I think this problem isn't connected with our module but is a result of your PHP settings.
#4
My PHP settings are the default for my system's installation.
Could you improve the error message and add a mention of this problem to the documentation?
#5
I will certainly add it when it is clear what is the reason of the problem and how it can be fixed, otherwize, there is no need to put something into documentation. Other users and me didn't come across with such problem before.
#6
Same error here..
#7
the part above rule 635 is GETID3_OS_ISWINDOWS.. my webhost is running linux so it shouldn't even be running that code if i'm correct..
#8
It is not mediafield bug.
#9
It is a bug, but not in mediafield.
Line 635 of getid3.lib.php is
return substr(`$commandline`, 0, $hash_length);The backticks are php shorthand for shell_exec, which is why you couldn't find shell_exec in any code files.
The if (GETID3_OS_ISWINDOWS) statement is a bit of a red herring - the failing line of code (635) is outside that if-block anyway.
The key is four lines earlier, on line 631:
if((bool) ini_get('safe_mode'))This uses some alternative processing if PHP is running in safe mode (which also disables shell_exec). The bug is that shell_exec can be disabled by the PHP disable_functions directive as well as the safe mode directive, but the code only checks for one of these conditions.
The patch is pretty easy. Change the offending line of code to
if(((bool) ini_get('safe_mode')) || (strpos(' '.ini_get('disable_functions'), 'shell_exec')))