Assembla home | Assembla project page
 

Changeset 272

Show
Ignore:
Timestamp:
08/01/08 09:23:17 (4 months ago)
Author:
Seldaek
Message:

fixes #56

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Phergie/Plugin/Quit.php

    r232 r272  
    8181                    } 
    8282                    $file = trim($file); 
    83                     if (is_file($path . $file)) { 
     83                    if (@is_file($path . $file)) { 
    8484                        $phpPath = $path . $file; 
    8585                        break 2; 
    86                     } else if (is_file(dirname($path) . DIRECTORY_SEPARATOR . $file)) { 
     86                    } else if (@is_file(dirname($path) . DIRECTORY_SEPARATOR . $file)) { 
    8787                        $phpPath = dirname($path) . DIRECTORY_SEPARATOR . $file; 
    8888                        break 2; 
     
    9595             * PHP executable 
    9696             */ 
    97             if (strtolower(substr(PHP_OS, 0, 3)) !== 'win') { 
    98                 $exec = trim(exec('which php')); 
    99                 if (!empty($exec) && is_file($exec)) { 
    100                     $phpPath = $exec; 
    101                 } 
     97            if (strtolower(substr(PHP_OS, 0, 3)) !== 'win' && function_exists('exec')) { 
     98                $func = new ReflectionFunction('exec'); 
     99                // skip this if exec is disabled by safe_mode or whatever 
     100                if (!$func->isDisabled()) { 
     101                        $exec = trim(exec('which php')); 
     102                        if (!empty($exec) && is_file($exec)) { 
     103                            $phpPath = $exec; 
     104                        } 
     105                } 
     106                unset($func); 
    102107            } 
    103108            unset($files, $file, $paths, $path, $exec);