
Alexander Over - 2010-01-09 19:51:03
You should replace the first if() with the following code for PHP4-constructor compatibility and forbid call to abstract classes.
if (!$reflectObj->IsInstantiable()) {
throw new Exception('called class has to be instantiable.');
}
if(!is_null($reflectObj->getConstructor())) {
$reflectMthd = new ReflectionMethod($className, $reflectObj->getConstructor()->name);
if($reflectMthd->getNumberOfParameters()>0) {
$instance = $reflectObj->newInstanceArgs($constructor);
}
}