Skip to content

Commit

Permalink
- check if safe_mode is enabled in fileExists() to determine what alg…
Browse files Browse the repository at this point in the history
…o to use (Bug #8296)

git-svn-id: http://svn.php.net/repository/pear/packages/LiveUser/trunk@218495 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
Lukas Smith committed Aug 19, 2006
1 parent 3cb2fc4 commit 3949e97
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions LiveUser.php
Expand Up @@ -685,12 +685,22 @@ function arrayMergeClobber($a1, $a2)
*
* @access public
*/
function fileExists($filename)
function fileExists($file)
{
$fp = @fopen($filename, 'r', true);
if (is_resource($fp)) {
@fclose($fp);
return true;
// safe_mode does notwork with is_readable()
if (ini_get('safe_mode')) {
$fp = @fopen($file, 'r', true);
if (is_resource($fp)) {
@fclose($fp);
return true;
}
} else {
$dirs = explode(PATH_SEPARATOR, ini_get('include_path'));
foreach ($dirs as $dir) {
if (is_readable($dir . DIRECTORY_SEPARATOR . $file)) {
return true;
}
}
}
return false;
}
Expand Down

0 comments on commit 3949e97

Please sign in to comment.