PHP Classes


Recommend this page to a friend!

      QDispatcher  >  All threads  >  Suggestions  >  (Un) Subscribe thread alerts  
Summary:Backward compatibility
Author:Alexander Over
Date:2010-01-09 19:51:02
Update:2010-01-11 07:30:43

  1. Suggestions   Reply   Report abuse  
Picture of Alexander Over 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);

  2. Re: Suggestions   Reply   Report abuse  
Picture of Tom Schaefer Tom Schaefer - 2010-01-11 07:30:43 - In reply to message 1 from Alexander Over
Thx. Will review it.