Benchmark_Iterate ($Id: Iterate.php,v 1.12 2006/02/17 16:29:44 toggg Exp $) logic error

From: Date: Tue, 26 Sep 2006 01:15:20 +0000
Subject: Benchmark_Iterate ($Id: Iterate.php,v 1.12 2006/02/17 16:29:44 toggg Exp $) logic error
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-44060@lists.php.net to get a copy of this message
// see comments function run() {
       $arguments     = func_get_args();
       $iterations    = array_shift($arguments);
       $function_name = array_shift($arguments);
       if (strstr($function_name, '::')) {
         $function_name = explode('::', $function_name);
// // now $function_name is array //
         $objectmethod = $function_name[1];
       }
// // now, on next line on array will affected strstr() function.. // solution: change next "if" on "elseif" or replace places previous and next blocks //
       if (strstr($function_name, '->')) {
           $function_name = explode('->', $function_name);
           $objectname = $function_name[0];
           $object = $GLOBALS[$objectname];
           $objectmethod = $function_name[1];
           for ($i = 1; $i <= $iterations; $i++) {
               $this->setMarker('start_' . $i);
               call_user_func_array(array($object, $function_name[1]), $arguments);
               $this->setMarker('end_' . $i);
           }
           return(0);
       }
       for ($i = 1; $i <= $iterations; $i++) {
           $this->setMarker('start_' . $i);
           call_user_func_array($function_name, $arguments);
           $this->setMarker('end_' . $i);
       }
   } 


« previous php.pear.dev (#44060) next »