Changed Default Flags to ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401

As of PHP 8.1.0, the flags argument of multiple html_*() functions defaults to ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, where previously it defaulted to ENT_COMPAT. This changes the result when the flags argument is not explicitly provided:

htmlentities("it's an apostrophe");

See execution result.

Affected functions:


The simplest solution is to provide the original default value explicitly:

htmlentities("it's an apostrophe", ENT_COMPAT);

See execution result.

See Also