php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #63917
Patch bug63917.phpt revision 2013-01-09 15:18 UTC by ashnazg@php.net

Patch bug63917.phpt for SPL related Bug #63917

Patch version 2013-01-09 15:18 UTC

Return to Bug #63917 | Download this patch
Patch Revisions:

Developer: ashnazg@php.net

--TEST--
Show that calling SplObjectStorage::detach() inside a foreach() does not disrupt proper Iterating
--CREDITS--
lastdragon@yandex.ru (bug reporter)
ashnazg@php.net (phpt)
--FILE--
<?php
$s = new SplObjectStorage();

$s->attach(new StdClass);
$s->attach(new StdClass);
$s->attach(new StdClass);
$s->attach(new StdClass);

var_dump($s->count());

foreach ($s as $v) {
    var_dump($v);

    $s->detach($v);
}

var_dump($s->count());
?>
--EXPECT--
int(4)
object(stdClass)#2 (0) {
}
object(stdClass)#3 (0) {
}
object(stdClass)#4 (0) {
}
object(stdClass)#5 (0) {
}
int(0)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 22:01:28 2024 UTC