cvs: pear /DB_DataObject DataObject.php

From: Date: Thu, 03 Apr 2003 03:33:11 +0000
Subject: cvs: pear /DB_DataObject DataObject.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-9709@lists.php.net to get a copy of this message
alan_k Wed Apr 2 22:33:11 2003 EDT Modified files: /pear/DB_DataObject DataObject.php Log: make error handling for autoload includes alot nicer - depends on php4.3 now Index: pear/DB_DataObject/DataObject.php diff -u pear/DB_DataObject/DataObject.php:1.74 pear/DB_DataObject/DataObject.php:1.75 --- pear/DB_DataObject/DataObject.php:1.74 Wed Apr 2 01:55:40 2003 +++ pear/DB_DataObject/DataObject.php Wed Apr 2 22:33:10 2003 @@ -20,7 +20,7 @@ * @package DB_DataObject * @category DB * - * $Id: DataObject.php,v 1.74 2003/04/02 06:55:40 alan_k Exp $ + * $Id: DataObject.php,v 1.75 2003/04/03 03:33:10 alan_k Exp $ */ /** @@ -1372,15 +1372,23 @@ } $table = substr($class,strlen($_DB_DATAOBJECT['CONFIG']['class_prefix'])); - // this should/could autoload - @include_once($_DB_DATAOBJECT['CONFIG']['require_prefix'].ucfirst($table).".php"); + // only include the file if it exists - and barf badly if it has parse errors :) + + if ($fh = @fopen($_DB_DATAOBJECT['CONFIG']['require_prefix'].ucfirst($table).".php",'r',1)) { + fclose($fh); + include_once $_DB_DATAOBJECT['CONFIG']['require_prefix'].ucfirst($table).".php"; + } + + if (!class_exists($class)) { DB_DataObject::raiseError("autoload:Could not autoload {$class}", DB_DATAOBJECT_ERROR_INVALIDCONFIG); return false; } return $class; } - + + + /** * Have the links been loaded? *

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