php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #67558 Method call passthrough of IteratorIterator is not documented
Submitted: 2014-07-03 09:17 UTC Modified: 2018-07-08 14:19 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: chris at cs278 dot org Assigned: cmb (profile)
Status: Closed Package: SPL related
PHP Version: Irrelevant OS: n/a
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
44 - 1 = ?
Subscribe to this entry?

 
 [2014-07-03 09:17 UTC] 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)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-07-08 14:19 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-07-08 14:19 UTC] cmb@php.net
This issue has been resolved in the meantime:
<http://svn.php.net/viewvc?view=revision&revision=337231>.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 09:01:29 2024 UTC