Bug #72122 [Opn->Csd]: IteratorIterator breaks '@' error suppression

From: Date: Tue, 12 Jul 2016 08:28:42 +0000
Subject: Bug #72122 [Opn->Csd]: IteratorIterator breaks '@' error suppression
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202227@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72122&edit=1 ID: 72122 Updated by: jpauli@php.net Reported by: kinglozzer at gmail dot com Summary: IteratorIterator breaks '@' error suppression -Status: Open +Status: Closed Type: Bug Package: SPL related Operating System: OS X PHP Version: 5.5.34 -Assigned To: +Assigned To: jpauli Block user comment: N Private report: N New Comment: The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2016-04-28 14:32:49] kinglozzer at gmail dot com Description: ------------ The '@' error suppression operator appears to not work correctly when wrapped by IteratorIterator. The issue occurs when an error is triggered (and supposedly suppressed) in getIterator() in the inner iterator - an InvalidArgumentException is thrown instead. I’ve not tested this in any great detail, or with other iterator types (apologies, time is tight at the moment). Test script: --------------- <?php class CustomIterator implements IteratorAggregate { public function getIterator() { @unlink('/missing/file.txt'); return new ArrayIterator(array('item')); } } $obj = new CustomIterator; $iterator = new IteratorIterator($obj); echo 'done'; Expected result: ---------------- Text 'done' should be shown Actual result: -------------- Fatal error: Uncaught exception 'InvalidArgumentException' with message 'unlink(/missing/file.txt): No such file or directory' ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72122&edit=1

« previous php.bugs (#202227) next »