Bug #72122 [NEW]: IteratorIterator breaks '@' error suppression
| From: | kinglozzer at gmail dot com | Date: | Thu, 28 Apr 2016 14:32:54 +0000 |
| Subject: | Bug #72122 [NEW]: IteratorIterator breaks '@' error suppression | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200809@lists.php.net to get a copy of this message | ||
From: kinglozzer at gmail dot com
Operating system: OS X
PHP version: 5.5.34
Package: SPL related
Bug Type: Bug
Bug description:IteratorIterator breaks '@' error suppression
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 bug report at https://bugs.php.net/bug.php?id=72122&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72122&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72122&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72122&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72122&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72122&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72122&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72122&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72122&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72122&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72122&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72122&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72122&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72122&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72122&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72122&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72122&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72122&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72122&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72122&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72122&r=mysqlcfg