php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74705 Wrong reflection on Collator::getSortKey and collator_get_sort_key,
Submitted: 2017-06-08 04:47 UTC Modified: 2017-06-13 06:49 UTC
From: tandre at themeetgroup dot com Assigned: remi
Status: Closed Package: intl (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID:
 [2017-06-08 04:47 UTC] tandre at themeetgroup dot com
Description:
------------
The Collator::getSortKey() method and the collator_get_sort_key() functions have one extra parameter by reflection compared to the documentation ( 
https://secure.php.net/manual/en/collator.getsortkey.php).

If we call the method with 2 parameters the following warning is emitted:
Warning: Collator::getSortKey() expects exactly 1 parameter, 2 given
(Same type of bug as https://bugs.php.net/bug.php?id=74468, different method)

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

$method = new ReflectionMethod('Collator', 'getSortKey');
var_dump($method->getNumberOfParameters());
var_dump($method->getNumberOfRequiredParameters());
$method = new ReflectionFunction('collator_get_sort_key');
var_dump($method->getNumberOfParameters());
var_dump($method->getNumberOfRequiredParameters());

// outputs 2, 2, 3, 3,


Expected result:
----------------
The ReflectionMethod parameters should have 1 parameter, the ReflectionFunction should expect 2 parameters

Actual result:
--------------
The ReflectionMethod parameters has parameters, the ReflectionFunction has 3 parameters

Patches

getSortKey.patch (last revision 2017-06-08 04:48 UTC) by tandre at themeetgroup dot com)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-13 06:45 UTC] remi@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: remi
 [2017-06-13 06:49 UTC] remi@php.net
-Summary: Wrong reflection on Collator::getSortKey +Summary: Wrong reflection on Collator::getSortKey and collator_get_sort_key,
 [2017-06-13 06:50 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=78970d5338e443eb19b6e589a4f6c449ca0a3d02
Log: Fix bug #74705 for collator_get_sort_key
 [2017-06-13 06:50 UTC] remi@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Mon Jul 24 10:01:45 2017 UTC