Doc #67558 [NEW]: Method call passthrough of IteratorIterator is not documented
| From: | chris at cs278 dot org | Date: | Thu, 03 Jul 2014 09:17:17 +0000 |
| Subject: | Doc #67558 [NEW]: Method call passthrough of IteratorIterator is not documented | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-11326@lists.php.net to get a copy of this message | ||
From: chris at cs278 dot org
Operating system: n/a
PHP version: Irrelevant
Package: SPL related
Bug Type: Documentation Problem
Bug description:Method call passthrough of IteratorIterator is not documented
Description:
------------
If you call a method that does not exist on an IteratorIterator, it
delegates that call to the inner iterator. The test script demonstrates
this non existent method delegation.
I'm unable to find any reference to this behaviour in the
documentation.
It should probably also be documented that implementing __call() will
replace the normal delegation.
Test script:
---------------
<?php
$inner = new ArrayIterator([1, 2]);
$outer = new IteratorIterator($inner);
var_dump(method_exists(get_class($outer), 'count'));
var_dump(method_exists($outer, 'count'));
var_dump($outer->count());
// bool(false)
// bool(true)
// int(2)
--
Edit bug report at https://bugs.php.net/bug.php?id=67558&edit=1
--