|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79653 Unexpected error for ArrayIterator::ksort()
Submitted: 2020-05-30 06:25 UTC Modified: 2020-05-30 09:05 UTC
From: admad dot coder at gmail dot com Assigned: kocsismate (profile)
Status: Closed Package: SPL related
PHP Version: master-Git-2020-05-29 (Git) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: admad dot coder at gmail dot com
New email:
PHP Version: OS:


 [2020-05-30 06:25 UTC] admad dot coder at gmail dot com
Using ArrayIterator::ksort() without any arguments generates ArgumentCountError error.

Issue seems related to implementation of this feature request

Test script:
$array = [];
$arrIter = new ArrayIterator($array);

Expected result:
As per
the new $sort_flags arguments has a default value. (In PHP 7 the method does not have any arguments).

So I do not expect any error to be generated when calling the method without any argument.

Actual result:
Above example code generate error like:

Fatal error: Uncaught ArgumentCountError: ArrayIterator::ksort() expects exactly 1 parameter, 0 given


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-30 09:02 UTC]
-Summary: Unexpected error for ArrayIterator::ksort() +Summary: Wrong ReflectionType for sprintf/printf args parameter -Status: Open +Status: Verified -PHP Version: master-Git-2020-05-30 (Git) +PHP Version: master-Git-2020-05-29 (Git) -Assigned To: +Assigned To: kocsismate
 [2020-05-30 09:02 UTC]
Thank you for reporting the issue! I managed to verify the problem, which was caused by a refactoring.
 [2020-05-30 09:05 UTC]
-Summary: Wrong ReflectionType for sprintf/printf args parameter +Summary: Unexpected error for ArrayIterator::ksort()
 [2020-05-30 09:05 UTC]
Uh, I think the browser autocomplete messed up the title, sorry.
 [2020-05-30 09:16 UTC]
The following pull request has been associated:

Patch Name: Fix #79653 Unexpected error for ArrayIterator::ksort()
On GitHub:
 [2020-05-30 15:00 UTC]
Automatic comment on behalf of
Log: Fix #79653 Unexpected error for ArrayIterator::ksort()
 [2020-05-30 15:00 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Feb 02 02:05:53 2023 UTC