Bug #74439 [NEW]: Wrong reflection on the Locale methods
| From: | fabien dot villepinte at gmail dot com | Date: | Fri, 14 Apr 2017 12:06:37 +0000 |
| Subject: | Bug #74439 [NEW]: Wrong reflection on the Locale methods | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-208547@lists.php.net to get a copy of this message | ||
From: fabien dot villepinte at gmail dot com
Operating system:
PHP version: Irrelevant
Package: I18N and L10N related
Bug Type: Bug
Bug description:Wrong reflection on the Locale methods
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
--
Edit bug report at https://bugs.php.net/bug.php?id=74439&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74439&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74439&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74439&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74439&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74439&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74439&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74439&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74439&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74439&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74439&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74439&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74439&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74439&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74439&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74439&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74439&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74439&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74439&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74439&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74439&r=mysqlcfg