Bug #79653 [Ver]: Unexpected error for ArrayIterator::ksort()

From: Date: Sat, 30 May 2020 09:05:39 +0000
Subject: Bug #79653 [Ver]: Unexpected error for ArrayIterator::ksort()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227241@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79653&edit=1 ID: 79653 Updated by: kocsismate@php.net Reported by: admad dot coder at gmail dot com -Summary: Wrong ReflectionType for sprintf/printf args parameter +Summary: Unexpected error for ArrayIterator::ksort() Status: Verified Type: Bug Package: SPL related Operating System: Linux PHP Version: master-Git-2020-05-29 (Git) Assigned To: kocsismate Block user comment: N Private report: N New Comment: Uh, I think the browser autocomplete messed up the title, sorry. Previous Comments: ------------------------------------------------------------------------ [2020-05-30 09:02:26] kocsismate@php.net Thank you for reporting the issue! I managed to verify the problem, which was caused by a refactoring. ------------------------------------------------------------------------ [2020-05-30 06:25:32] admad dot coder at gmail dot com Description: ------------ Using ArrayIterator::ksort() without any arguments generates ArgumentCountError error. Issue seems related to implementation of this feature request https://bugs.php.net/bug.php?id=62840. Test script: --------------- <?php $array = []; $arrIter = new ArrayIterator($array); $arrIter->ksort(); Expected result: ---------------- As per https://github.com/php/php-src/blob/4fa3687e56050a111e8eaffe330258003628225e/ext/spl/spl_array.stub.php#L191 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79653&edit=1

« previous php.bugs (#227241) next »