A PHP snippet that has run without issue for weeks suddenly logs a deprecation notice, with no code changes on your own end.
⚡ Quick Fix (TL;DR)
The Culprit: mb_convert_encoding() with 'HTML-ENTITIES' as the target encoding was deprecated in PHP 8.2. Any server that upgrades its own PHP version will start logging this notice on unchanged code that previously ran silently.
The Fix: Replace it with mb_encode_numericentity(), which does the same job – converting non-ASCII characters to numeric HTML entities – without triggering the deprecation. Avoid htmlspecialchars() as a substitute here if the content contains real HTML tags you still need parsed afterward, since it would escape those tags too.
$convmap = array(0x80, 0x10FFFF, 0, 0xFFFFFF);
$safe_content = mb_encode_numericentity($content, $convmap, 'UTF-8');Tagged in :
More from the field
Bisect to an Empty Baseline Before Trusting Any Single Theory
.
Multiple plausible-sounding theories for a bug each turned out to be wrong when actually tested – time was spent building fixes…
A Security Dashboard’s Activity Log Can Lag a Full Day Behind Real Time
.
Trying to check a security tool’s activity log for an event that had just happened showed nothing at all.