Mantis - Quercus
Viewing Issue Advanced Details
3979 major always 04-03-10 16:20 05-13-10 07:42
domdorn  
nam  
normal  
closed 4.0.6  
fixed  
none    
none 4.0.7  
0003979: is_executable is broken
is_executable delegates to com.caucho.vfs.Path.isExecutable().
However, this seems to be broken, which then breaks various PHP applications that require external binaries (e.g. ImageMagick) and check if they are executable before calling them (e.g. Typo3, PHPGallery).

<?
touch("someprogram.sh");
chmod("someprogram.sh", 0700);

if( file_exists("someprogram.sh"))
{
    echo "SUCCESS";
}
else
{
    echo "FAILED: someprogram.sh should have been created";
}
echo "
";

if( is_executable("someprogram.sh") === true){
    echo "SUCCESS";
}
else
{
    echo "FAILED: someprogram.sh should be executable";
}
echo "
";

if( is_executable("/bin/bash") === true){
    echo "SUCCESS";
}
else
{
    echo "FAILED: /bin/bash should be executable";
}
echo "
";

if( is_executable("/bin/sh") === true){
    echo "SUCCESS";
}
else
{
    echo "FAILED: /bin/sh should be executable";
}
echo "
";

?>
SUCCESS
FAILED: someprogram.sh should be executable
FAILED: /bin/bash should be executable
FAILED: /bin/sh should be executable

Notes
(0004568)
nam   
05-11-10 17:19   
It's not possible to determine if a file is executable in pure Java. But a possible workaround is to run a shell script that tests the file for executability.
(0004575)
nam   
05-13-10 07:42   
php/160y