diff --git a/hphp/system/php/lang/Exception.php b/hphp/system/php/lang/Exception.php index 1414bd598..15db236b9 100644 --- a/hphp/system/php/lang/Exception.php +++ b/hphp/system/php/lang/Exception.php @@ -84,7 +84,7 @@ class Exception { $next = $cur->getPrevious(); while ($next instanceof Exception) { $cur = $next; - $next = $cur->getPrevious; + $next = $cur->getPrevious(); } $cur->setPrevious($previous); } diff --git a/hphp/test/quick/exception_set_previous_chain.php b/hphp/test/quick/exception_set_previous_chain.php new file mode 100644 index 000000000..22714f56a --- /dev/null +++ b/hphp/test/quick/exception_set_previous_chain.php @@ -0,0 +1,28 @@ +setPrevious($e2); +$e0->setPrevious($e1); + +$eA = new Exception('A'); +$eB = new Exception('B'); +$eC = new Exception('C'); +$eB->setPrevious($eC); +$eA->setPrevious($eB); + +$e0->setPreviousChain($eA); + +$proper_order = '012ABC'; +$actual_order = $e0->getMessage(); + +$cur = $e0; +while ($cur->getPrevious() !== null) { + $cur = $cur->getPrevious(); + $actual_order .= $cur->getMessage(); +} + +$result = $actual_order === $proper_order ? 'pass' : 'fail'; + +echo "{$result}\n"; diff --git a/hphp/test/quick/exception_set_previous_chain.php.expect b/hphp/test/quick/exception_set_previous_chain.php.expect new file mode 100644 index 000000000..2ae28399f --- /dev/null +++ b/hphp/test/quick/exception_set_previous_chain.php.expect @@ -0,0 +1 @@ +pass