cvs: pear /MDB2 MDB2.php

From: Date: Sat, 19 Aug 2006 15:21:41 +0000
Subject: cvs: pear /MDB2 MDB2.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-41711@lists.php.net to get a copy of this message
lsmith Sat Aug 19 15:21:41 2006 UTC Modified files: /pear/MDB2 MDB2.php Log: - check if safe_mode is enabled in fileExists() to determine what algo to use (Bug #8296) http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2.php?r1=1.251&r2=1.252&diff_format=u Index: pear/MDB2/MDB2.php diff -u pear/MDB2/MDB2.php:1.251 pear/MDB2/MDB2.php:1.252 --- pear/MDB2/MDB2.php:1.251 Sun Aug 13 13:42:02 2006 +++ pear/MDB2/MDB2.php Sat Aug 19 15:21:41 2006 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: MDB2.php,v 1.251 2006/08/13 13:42:02 lsmith Exp $ +// $Id: MDB2.php,v 1.252 2006/08/19 15:21:41 lsmith Exp $ // /** @@ -911,10 +911,20 @@ */ function fileExists($file) { - $fp = @fopen($file, '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; }

« previous php.pear.cvs (#41711) next »