Skip to content

IntlChar::foldCase()'s $option is not optional #15087

Closed

Description

@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'));

Activity

  1. damianwadley commented on Jul 23, 2024

    @damianwadley
    Member
  2. cmb69 commented on Jul 23, 2024

    @cmb69
    Member

    This doesn't look like a doc-en issue, though.

  3. transferred this issue fromphp/doc-enon Jul 23, 2024
  4. cmb69 commented on Jul 24, 2024

    @cmb69
    Member

    The regression had been introduced with 1f05966 (as such as of PHP 8.0.0). Of course, we cannot fix that for unmaintained and security branches, but likely for PHP-8.2 and up.

  5. self-assigned this
    on Jul 24, 2024
  6. changed the title [-]The optional `options` parameter of the `IntlChar::foldCase` is actually not optional[/-] [+]IntlChar::foldCase()'s $option is not optional[/+] on Jul 24, 2024
  7. added a commit that references this issue on Jul 24, 2024
    82a76be
  8. added 2 commits that reference this issue on Jul 24, 2024
    5fbda73
    ce25be5
  9. added a commit that references this issue on Jul 24, 2024
    58ac56f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions