php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74993 Wrong reflection on some locale_* functions
Submitted: 2017-07-26 11:46 UTC Modified: 2017-07-26 23:00 UTC
From: fabien dot villepinte at gmail dot com Assigned: pollita (profile)
Status: Closed Package: intl (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2017-07-26 11:46 UTC] fabien dot villepinte at gmail dot com
Description:
------------
The optional parameters of the functions listed below are described as required by reflection.

locale_get_display_language
locale_get_display_name
locale_get_display_region
locale_get_display_script
locale_get_display_variant
locale_filter_matches
locale_lookup

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

$funcs = [
'locale_get_display_language',
'locale_get_display_name',
'locale_get_display_region',
'locale_get_display_script',
'locale_get_display_variant',
'locale_filter_matches',
'locale_lookup',
];

foreach ($funcs as $func) {
    $rf = new ReflectionFunction($func);
    printf("%s: %d, %d\n", $func, $rf->getNumberOfParameters(), $rf->getNumberOfRequiredParameters());
}

Expected result:
----------------
locale_get_display_language: 2, 1
locale_get_display_name: 2, 1
locale_get_display_region: 2, 1
locale_get_display_script: 2, 1
locale_get_display_variant: 2, 1
locale_filter_matches: 3, 2
locale_lookup: 4, 2

Actual result:
--------------
locale_get_display_language: 2, 2
locale_get_display_name: 2, 2
locale_get_display_region: 2, 2
locale_get_display_script: 2, 2
locale_get_display_variant: 2, 2
locale_filter_matches: 3, 3
locale_lookup: 4, 4

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-26 21:50 UTC] pollita@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: pollita
 [2017-07-26 21:50 UTC] pollita@php.net
Thanks, this'll be in 7.2.0beta2 and later
 [2017-07-26 22:57 UTC] pollita@php.net
Automatic comment on behalf of pollita
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c7aa8ba0eed1c227ba4e41a28b8ca125b99b80f9
Log: Bugfix #74993 Wrong reflection param into for some intl: lookup_*() methods
 [2017-07-26 22:57 UTC] pollita@php.net
-Status: Assigned +Status: Closed
 [2017-07-26 23:00 UTC] pollita@php.net
Ended up backporting it to 7.0, so it should show up in 7.0.23+ and 7.1.9+ as well as 7.2.0beta2 and later.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC