cvs: pear /LiveUser LiveUser.php
| From: | Lukas Smith | Date: | Sun, 09 Apr 2006 16:07:56 +0000 |
| Subject: | cvs: pear /LiveUser LiveUser.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39516@lists.php.net to get a copy of this message | ||
lsmith Sun Apr 9 16:07:56 2006 UTC
Modified files:
/pear/LiveUser LiveUser.php
Log:
- disable __autoload() in class_exists() calls (bug #7304)
http://cvs.php.net/viewcvs.cgi/pear/LiveUser/LiveUser.php?r1=1.156&r2=1.157&diff_format=u
Index: pear/LiveUser/LiveUser.php
diff -u pear/LiveUser/LiveUser.php:1.156 pear/LiveUser/LiveUser.php:1.157
--- pear/LiveUser/LiveUser.php:1.156 Fri Apr 7 22:21:12 2006
+++ pear/LiveUser/LiveUser.php Sun Apr 9 16:07:55 2006
@@ -40,7 +40,7 @@
* @author Bjoern Kraus <krausbn@php.net>
* @copyright 2002-2006 Markus Wolff
* @license http://www.gnu.org/licenses/lgpl.txt
- * @version CVS: $Id: LiveUser.php,v 1.156 2006/04/07 22:21:12 lsmith Exp $
+ * @version CVS: $Id: LiveUser.php,v 1.157 2006/04/09 16:07:55 lsmith Exp $
* @link http://pear.php.net/LiveUser
*/
@@ -536,10 +536,10 @@
*/
function loadClass($classname, $supress_error = false)
{
- if (!class_exists($classname)) {
+ if (!LiveUser::classExists($classname)) {
$filename = str_replace('_', '/', $classname).'.php';
@include_once($filename);
- if (!class_exists($classname) && !$supress_error) {
+ if (!LiveUser::classExists($classname) && !$supress_error) {
if (!LiveUser::fileExists($filename)) {
$msg = 'File for the class does not exist ' . $classname;
} else {
@@ -684,9 +684,9 @@
*
* @access public
*/
- function fileExists($file)
+ function fileExists($filename)
{
- $fp = @fopen($file, 'r', true);
+ $fp = @fopen($filename, 'r', true);
if (is_resource($fp)) {
@fclose($fp);
return true;
@@ -695,6 +695,22 @@
}
/**
+ * Checks if a class exists without triggering __autoload
+ *
+ * @param string classname
+ * @return bool true success and false on error
+ *
+ * @access public
+ */
+ function classExists($classname)
+ {
+ if (version_compare(phpversion(), "5.0", ">=") {
+ return class_exists($classname, false);
+ }
+ return class_exists($classname);
+ }
+
+ /**
* Reads the configuration array.
*
* @param array|file Conf array or file path to configuration