File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
tests /
classes /
array_access_013.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 5 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
1: --TEST--
2: ZE2 ArrayAccess and exceptions
3: --FILE--
4: <?php
5:
6: class Test implements ArrayAccess
7: {
8: public function offsetExists($offset) { throw new Exception(__METHOD__); return false; }
9: public function offsetGet($offset) { throw new Exception(__METHOD__); return $offset; }
10: public function offsetSet($offset, $data ) { throw new Exception(__METHOD__); }
11: public function offsetUnset($offset) { throw new Exception(__METHOD__); }
12: }
13:
14: $t = new Test;
15:
16: try
17: {
18: echo isset($t[0]);
19: }
20: catch(Exception $e)
21: {
22: echo "Caught in " . $e->getMessage() . "()\n";
23: }
24:
25: try
26: {
27: echo $t[0];
28: }
29: catch(Exception $e)
30: {
31: echo "Caught in " . $e->getMessage() . "()\n";
32: }
33:
34: try
35: {
36: $t[0] = 1;
37: }
38: catch(Exception $e)
39: {
40: echo "Caught in " . $e->getMessage() . "()\n";
41: }
42:
43: try
44: {
45: unset($t[0]);
46: }
47: catch(Exception $e)
48: {
49: echo "Caught in " . $e->getMessage() . "()\n";
50: }
51: ?>
52: ===DONE===
53: --EXPECT--
54: Caught in Test::offsetExists()
55: Caught in Test::offsetGet()
56: Caught in Test::offsetSet()
57: Caught in Test::offsetUnset()
58: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>