Doc #67558 [Opn->Csd]: Method call passthrough of IteratorIterator is not documented
| From: | cmb@php.net | Date: | Sun, 08 Jul 2018 14:19:45 +0000 |
| Subject: | Doc #67558 [Opn->Csd]: Method call passthrough of IteratorIterator is not documented | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15857@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67558&edit=1
ID: 67558
Updated by: cmb@php.net
Reported by: chris at cs278 dot org
Summary: Method call passthrough of IteratorIterator is not
documented
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: SPL related
Operating System: n/a
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This issue has been resolved in the meantime:
<http://svn.php.net/viewvc?view=revision&revision=337231>.
Previous Comments:
------------------------------------------------------------------------
[2014-07-03 09:17:16] chris at cs278 dot org
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 this bug report at https://bugs.php.net/bug.php?id=67558&edit=1