HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/thread-self/root/opt/cloudlinux/alt-php74/root/usr/share/pear/test/jsond/tests/bug46944.phpt
--TEST--
Bug #46944 (json_encode() doesn't handle 3 byte utf8 correctly)
--SKIPIF--
<?php if (!extension_loaded('jsond')) print 'skip'; ?>
--FILE--
<?php
require_once "bootstrap.inc";

for ($i = 1; $i <= 16; $i++) {
	$first = 0xf0|($i >> 2);
	$second = 0x8f|($i & 3) << 4;
	$string = sprintf("aa%c%c\xbf\xbdzz", $first, $second);
	echo $jsond_encode($string) . "\n";
}


echo "Done\n";
?>
--EXPECT--
"aa\ud83f\udffdzz"
"aa\ud87f\udffdzz"
"aa\ud8bf\udffdzz"
"aa\ud8ff\udffdzz"
"aa\ud93f\udffdzz"
"aa\ud97f\udffdzz"
"aa\ud9bf\udffdzz"
"aa\ud9ff\udffdzz"
"aa\uda3f\udffdzz"
"aa\uda7f\udffdzz"
"aa\udabf\udffdzz"
"aa\udaff\udffdzz"
"aa\udb3f\udffdzz"
"aa\udb7f\udffdzz"
"aa\udbbf\udffdzz"
"aa\udbff\udffdzz"
Done