Skip to content

[DomCrawler] Do not rely on mbstring.substitute_character #60305

Closed as not planned
@lyrixx

Description

@lyrixx

Symfony version(s) affected

allk

Description

Woooo, I faced a very hard to find bug!
I use bopoda/robots-txt-parser, and they hardcoded something very strange in a class:

// Strip invalid characters from UTF-8 strings
ini_set('mbstring.substitute_character', "none");

I already open an issue there to fix the issue.

But I think we can protect Symfony for such issue.

How to reproduce

I created a small reproducer.
(Un)Comment the following line, and run the script

new RobotsTxtParser('');

You'll see the output is different.

Possible Solution

Force the following line in our code

ini_set('mbstring.substitute_character', "");

Additional Context

I'm not sure we have to do this. But let's discuss it!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions