php-src/Zend/tests/030.phpt

69 lines
1.1 KiB
Plaintext
Raw Normal View History

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--
object(Exception)#2 (6) {
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) {
}
}
}
}
'test' => '0'
'test_2' => '1'
'test_3' => '2'
ok