2008-04-18 14:05:47 +00:00
|
|
|
--TEST--
|
|
|
|
Overriding $this in catch and checking the object properties later.
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
class foo {
|
2020-02-03 21:52:20 +00:00
|
|
|
public $test = 0;
|
|
|
|
private $test_2 = 1;
|
|
|
|
protected $test_3 = 2;
|
2018-09-16 17:16:42 +00:00
|
|
|
|
2020-02-03 21:52:20 +00:00
|
|
|
public function bar() {
|
|
|
|
try {
|
|
|
|
throw new Exception('foo');
|
|
|
|
} catch (Exception $this) {
|
|
|
|
var_dump($this);
|
|
|
|
}
|
2008-04-18 14:05:47 +00:00
|
|
|
|
2020-02-03 21:52:20 +00:00
|
|
|
$this->baz();
|
|
|
|
}
|
2018-09-16 17:16:42 +00:00
|
|
|
|
2020-02-03 21:52:20 +00:00
|
|
|
public function baz() {
|
|
|
|
foreach ($this as $k => $v) {
|
|
|
|
printf("'%s' => '%s'\n", $k, $v);
|
|
|
|
}
|
|
|
|
print "ok\n";
|
|
|
|
}
|
2008-04-18 14:05:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$test = new foo;
|
|
|
|
$test->bar();
|
|
|
|
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
2016-06-15 23:30:23 +00:00
|
|
|
Fatal error: Cannot re-assign $this in %s030.php on line 11
|