drupflare/worker - v1.0.4
    Preparing search index...

    Variable MB_SANITIZEConst

    MB_SANITIZE: string = ...

    Closes the mb_substr() content-loss bug in PHP, without a rebuild.

    Without mbstring, Symfony's polyfill returns '' for any string with invalid UTF-8 (iconv returns false), where native PHP substitutes '?'. Real iconv fails the same way, so compiling it in would not help. This defines the affected mb_* functions before the polyfill bootstraps, so its function_exists() guards skip; each replaces invalid UTF-8 with '?' and delegates to the polyfill. mb_check_encoding() and mb_detect_encoding() are left alone: sanitising first would make the former answer true for invalid input.

    Inert on a build carrying mbstring (the shipping long64 build does); the guard is the contract. Exported alone so a gate test can drive it against native mbstring as the oracle.