php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74439 Wrong reflection on the Locale methods
Submitted: 2017-04-14 12:06 UTC Modified: -
From: fabien dot villepinte at gmail dot com Assigned:
Status: Closed Package: I18N and L10N related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2017-04-14 12:06 UTC] fabien dot villepinte at gmail dot com
Description:
------------
All optional parameters of the Locale class are described as required by reflection.

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

$methods = [
'getDefault',
'acceptFromHttp',
'canonicalize',
'composeLocale',
'getAllVariants',
'getKeywords',
'getPrimaryLanguage',
'getRegion',
'getScript',
'parseLocale',
'setDefault',
'getDisplayLanguage',
'getDisplayName',
'getDisplayRegion',
'getDisplayScript',
'getDisplayVariant',
'filterMatches',
'lookup',
];

foreach ($methods as $method) {
    $rm = new ReflectionMethod(Locale::class, $method);
    printf("%s: %d, %d\n", $method, $rm->getNumberOfParameters(), $rm->getNumberOfRequiredParameters());
}

Expected result:
----------------
getDefault: 0, 0
acceptFromHttp: 1, 1
canonicalize: 1, 1
composeLocale: 1, 1
getAllVariants: 1, 1
getKeywords: 1, 1
getPrimaryLanguage: 1, 1
getRegion: 1, 1
getScript: 1, 1
parseLocale: 1, 1
setDefault: 1, 1
getDisplayLanguage: 2, 1
getDisplayName: 2, 1
getDisplayRegion: 2, 1
getDisplayScript: 2, 1
getDisplayVariant: 2, 1
filterMatches: 3, 2
lookup: 4, 2

Actual result:
--------------
getDefault: 0, 0
acceptFromHttp: 1, 1
canonicalize: 1, 1
composeLocale: 1, 1
getAllVariants: 1, 1
getKeywords: 1, 1
getPrimaryLanguage: 1, 1
getRegion: 1, 1
getScript: 1, 1
parseLocale: 1, 1
setDefault: 1, 1
getDisplayLanguage: 2, 2
getDisplayName: 2, 2
getDisplayRegion: 2, 2
getDisplayScript: 2, 2
getDisplayVariant: 2, 2
filterMatches: 3, 3
lookup: 4, 4

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-17 06:59 UTC] krakjoe@php.net
Automatic comment on behalf of fabien.villepinte@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7dc6b04f453d0111447a3bcd1f3e88a5c32c2a22
Log: Fixed bug #74439 Wrong reflection on the Locale methods
 [2017-04-17 06:59 UTC] krakjoe@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 10:01:28 2024 UTC