php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71412 Wrong parameters for ArrayIterator::__construct
Submitted: 2016-01-19 10:00 UTC Modified: 2017-07-02 14:44 UTC
From: arjen at parse dot nl Assigned: pollita (profile)
Status: Closed Package: SPL related
PHP Version: 7.0.2 OS: Linux
Private report: No CVE-ID: None
 [2016-01-19 10:00 UTC] arjen at parse dot nl
Description:
------------
https://3v4l.org/SlLdF#v702

http://php.net/manual/en/arrayiterator.construct.php mentions two parameters: array and flags.

In 7.0.1 it has only array, since 7.0.2 it has array, ar_flags and iterator_class. Behaviour changed by https://bugs.php.net/bug.php?id=71077

For ArrayObject is also reports ar_flags instead of flags.

Test script:
---------------
<?php

$rm = new ReflectionMethod('ArrayIterator', '__construct');

var_dump($rm->getParameters());

Expected result:
----------------
array(1) {
  [0]=>
  object(ReflectionParameter)#2 (1) {
    ["name"]=>
    string(5) "array"
  }
}

or 

array(3) {
  [0]=>
  object(ReflectionParameter)#2 (1) {
    ["name"]=>
    string(5) "array"
  }
  [1]=>
  object(ReflectionParameter)#3 (1) {
    ["name"]=>
    string(8) "flags"
  }
}

Actual result:
--------------
array(3) {
  [0]=>
  object(ReflectionParameter)#2 (1) {
    ["name"]=>
    string(5) "array"
  }
  [1]=>
  object(ReflectionParameter)#3 (1) {
    ["name"]=>
    string(8) "ar_flags"
  }
  [2]=>
  object(ReflectionParameter)#4 (1) {
    ["name"]=>
    string(14) "iterator_class"
  }
}

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-20 02:52 UTC] laruence@php.net
-Package: Reflection related +Package: Documentation problem
 [2017-01-28 13:14 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem -Package: Documentation problem +Package: SPL related
 [2017-07-02 14:44 UTC] pollita@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: pollita
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 03:01:29 2024 UTC