2008-04-18 13:54:46 +00:00
|
|
|
--TEST--
|
|
|
|
Overriding $this in catch and checking the object properties later.
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
class foo {
|
|
|
|
public $test = 0;
|
|
|
|
private $test_2 = 1;
|
|
|
|
protected $test_3 = 2;
|
|
|
|
|
|
|
|
public function bar() {
|
|
|
|
try {
|
|
|
|
throw new Exception('foo');
|
|
|
|
} catch (Exception $this) {
|
|
|
|
var_dump($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->baz();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function baz() {
|
|
|
|
foreach ($this as $k => $v) {
|
|
|
|
printf("'%s' => '%s'\n", $k, $v);
|
|
|
|
}
|
|
|
|
print "ok\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$test = new foo;
|
|
|
|
$test->bar();
|
|
|
|
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
2008-07-27 17:37:07 +00:00
|
|
|
object(Exception)#2 (%d) {
|
2008-04-19 23:11:26 +00:00
|
|
|
[u"message":protected]=>
|
|
|
|
unicode(3) "foo"
|
|
|
|
[u"string":u"Exception":private]=>
|
|
|
|
unicode(0) ""
|
|
|
|
[u"code":protected]=>
|
2008-04-18 13:54:46 +00:00
|
|
|
int(0)
|
2008-04-19 23:11:26 +00:00
|
|
|
[u"file":protected]=>
|
|
|
|
unicode(%d) "%s"
|
|
|
|
[u"line":protected]=>
|
2008-04-18 13:54:46 +00:00
|
|
|
int(%d)
|
2008-04-19 23:11:26 +00:00
|
|
|
[u"trace":u"Exception":private]=>
|
2008-04-18 13:54:46 +00:00
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
array(6) {
|
2008-04-19 23:11:26 +00:00
|
|
|
[u"file"]=>
|
|
|
|
unicode(%d) "%s"
|
|
|
|
[u"line"]=>
|
2008-04-18 13:54:46 +00:00
|
|
|
int(%d)
|
2008-04-19 23:11:26 +00:00
|
|
|
[u"function"]=>
|
|
|
|
unicode(3) "bar"
|
|
|
|
[u"class"]=>
|
|
|
|
unicode(3) "foo"
|
|
|
|
[u"type"]=>
|
|
|
|
unicode(2) "->"
|
|
|
|
[u"args"]=>
|
2008-04-18 13:54:46 +00:00
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-07-27 17:37:07 +00:00
|
|
|
[u"previous":u"Exception":private]=>
|
|
|
|
NULL
|
2008-04-18 13:54:46 +00:00
|
|
|
}
|
|
|
|
'test' => '0'
|
|
|
|
'test_2' => '1'
|
|
|
|
'test_3' => '2'
|
|
|
|
ok
|