diff options
author | jokkedk <joakim@jokke.dk> | 2010-10-27 11:11:20 +0000 |
---|---|---|
committer | jokkedk <joakim@jokke.dk> | 2010-10-27 11:11:20 +0000 |
commit | 5351a300a3c7237b91f75fe669c3ea112ce5e9d3 (patch) | |
tree | 297054b14d4239d1b5f53c4d490cd23ea1af6f7f | |
parent | 395b69c04f904f387806f641ad072b91ce96c205 (diff) | |
download | webgrind-5351a300a3c7237b91f75fe669c3ea112ce5e9d3.zip webgrind-5351a300a3c7237b91f75fe669c3ea112ce5e9d3.tar.gz webgrind-5351a300a3c7237b91f75fe669c3ea112ce5e9d3.tar.bz2 |
[FIX] #61 Invalid argument to Preprocessor::subCallInformation in some cases
-rw-r--r-- | library/Preprocessor.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/library/Preprocessor.php b/library/Preprocessor.php index 880b8bb..4365b79 100644 --- a/library/Preprocessor.php +++ b/library/Preprocessor.php @@ -63,7 +63,16 @@ class Webgrind_Preprocessor // Found invocation of function. Read functionname list($function) = fscanf($in,"fn=%[^\n\r]s"); if(!isset($functions[$function])){ - $functions[$function] = array('filename'=>substr(trim($line),3), 'invocationCount'=>0,'nr'=>$nextFuncNr++,'count'=>0,'summedSelfCost'=>0,'summedInclusiveCost'=>0,'calledFromInformation'=>array(),'subCallInformation'=>array()); + $functions[$function] = array( + 'filename' => substr(trim($line),3), + 'invocationCount' => 0, + 'nr' => $nextFuncNr++, + 'count' => 0, + 'summedSelfCost' => 0, + 'summedInclusiveCost' => 0, + 'calledFromInformation' => array(), + 'subCallInformation' => array() + ); } $functions[$function]['invocationCount']++; // Special case for ENTRY_POINT - it contains summary header @@ -120,11 +129,11 @@ class Webgrind_Preprocessor $subCallCount = sizeof($function['subCallInformation']); fwrite($out, pack(self::NR_FORMAT.'*', $function['summedSelfCost'], $function['summedInclusiveCost'], $function['invocationCount'], $calledFromCount, $subCallCount)); // Write called from information - foreach($function['calledFromInformation'] as $call){ + foreach((array)$function['calledFromInformation'] as $call){ fwrite($out, pack(self::NR_FORMAT.'*', $call['functionNr'], $call['line'], $call['callCount'], $call['summedCallCost'])); } // Write sub call information - foreach($function['subCallInformation'] as $call){ + foreach((array)$function['subCallInformation'] as $call){ fwrite($out, pack(self::NR_FORMAT.'*', $call['functionNr'], $call['line'], $call['callCount'], $call['summedCallCost'])); } |