Skip to content

Multibyte strings may not fail parsing on MacOS #57

@gapple

Description

@gapple

Two tests from the httpwg suite fail on MacOS (15.4; PHP 8.4.6):

  • non-ascii string
  • non-ascii display string (unescaped)

When parsing füü, the ü character is not properly rejected as non-ascii by ctype_print().
Other methods do properly detect that the character is not in the ascii range.

php > var_dump(ctype_print("ü"));
bool(true)
php > var_dump(preg_match("/[[:print:]]/", "ü"));
int(0)
php > var_dump(mb_detect_encoding("ü", ['ASCII'], true));
bool(false)

A valid ascii character gives:

php > var_dump(ctype_print("f"));
bool(true)
php > var_dump(preg_match("/[[:print:]]/", "f"));
int(1)
php > var_dump(mb_detect_encoding("f", ['ASCII'], true));
string(5) "ASCII"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions