[php-src] Issue #15087: The optional `options` parameter of the `IntlChar::foldCase` is actually not optional
| From: | mmalferov | Date: | Tue, 23 Jul 2024 22:51:38 +0000 |
| Subject: | [php-src] Issue #15087: The optional `options` parameter of the `IntlChar::foldCase` is actually not optional | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247352@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15087
Author: mmalferov
The method signature designates the
options parameter as optional with the constant
IntlChar::FOLD_CASE_DEFAULT as default. I am expecting the string(1)
"i" when calling var_dump(IntlChar::foldCase("I"), but I get
an error:
> Fatal error: Uncaught ArgumentCountError: IntlChar::foldCase() expects exactly 2 arguments, 1
> given
```
<?php
$method = new ReflectionMethod('IntlChar', 'foldCase');
$options = $method->getParameters()[1];
// All good
var_dump(
"Param name: " . $options->name,
"Is optional: " . $options->isOptional(),
"Type: " . $options->getType(),
"Is default available: " . $options->isDefaultValueAvailable(),
"Is default value constant: ". $options->isDefaultValueConstant(),
"Default const name: " . $options->getDefaultValueConstantName(),
"Default value: " . $options->getDefaultValue(),
);
// But fatal error
var_dump(IntlChar::foldCase('I'));
```