cvs: php-src(PHP_5_0) /ext/spl/tests bug31185.phpt
| From: | Marcus Boerger | Date: | Sat, 19 Mar 2005 15:10:56 +0000 |
| Subject: | cvs: php-src(PHP_5_0) /ext/spl/tests bug31185.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-31020@lists.php.net to get a copy of this message | ||
helly Sat Mar 19 10:10:56 2005 EDT
Added files: (Branch: PHP_5_0)
/php-src/ext/spl/tests bug31185.phpt
Log:
- MFH Add new test
http://cvs.php.net/co.php/php-src/ext/spl/tests/bug31185.phpt?r=1.1&p=1
Index: php-src/ext/spl/tests/bug31185.phpt
+++ php-src/ext/spl/tests/bug31185.phpt
--TEST--
Bug #31185 (Crash when exceptions thrown from ArrayAccess::offsetUnset())
--FILE--
<?php
class FooBar implements ArrayAccess {
private $array = array();
public function offsetExists($index) {
return isset($this->array[$index]);
}
public function offsetGet($index) {
return $this->array[$index];
}
public function offsetSet($index, $value) {
$this->array[$index] = $value;
}
public function offsetUnset($index) {
throw new Exception('FAIL');
unset($this->array[$index]);
}
}
$i = 0;
$foo = new FooBar();
$foo[$i] = $i++;
$foo[$i] = $i++;
$foo[$i] = $i++;
try
{
unset($foo[1]);
}
catch (Exception $e)
{
echo "CAUGHT: " . $e->getMessage() . "\n";
}
print_R($foo);
?>
===DONE===
--EXPECT--
CAUGHT: FAIL
FooBar Object
(
[array:private] => Array
(
[1] => 0
[2] => 1
[3] => 2
)
)
===DONE===