@@ -81,6 +81,58 @@ public function testPrintStringWithControlChar(): void
8181 $ this ->assertPrintRoundTrip ('" \\u{1}" ' );
8282 }
8383
84+ public function testPrintStringWithAllControlChars (): void
85+ {
86+ for ($ code = 0x00 ; $ code < 0x20 ; $ code ++) {
87+ if ($ code === 0x09 ) {
88+ continue ;
89+ } // tab uses \t
90+ if ($ code === 0x0A ) {
91+ continue ;
92+ } // newline uses \n
93+ if ($ code === 0x0D ) {
94+ continue ;
95+ } // CR uses \r
96+ $ escaped = '" \\u{ ' . strtoupper (dechex ($ code )) . '}" ' ;
97+ $ this ->assertPrintRoundTrip ($ escaped );
98+ }
99+ // DEL (0x7F)
100+ $ this ->assertPrintRoundTrip ('" \\u{7F}" ' );
101+ }
102+
103+ public function testPrintUnicodeBoundaryCharsPassThrough (): void
104+ {
105+ // U+D7FF (last before surrogates)
106+ $ d7ff = '" ' . mb_chr (0xD7FF , 'UTF-8 ' ) . '" ' ;
107+ $ this ->assertPrintRoundTrip ($ d7ff );
108+ // U+E000 (first after surrogates)
109+ $ e000 = '" ' . mb_chr (0xE000 , 'UTF-8 ' ) . '" ' ;
110+ $ this ->assertPrintRoundTrip ($ e000 );
111+ // U+10000 (first supplementary plane)
112+ $ sup = '" ' . mb_chr (0x10000 , 'UTF-8 ' ) . '" ' ;
113+ $ this ->assertPrintRoundTrip ($ sup );
114+ // U+10FFFF (max unicode)
115+ $ max = '" ' . mb_chr (0x10FFFF , 'UTF-8 ' ) . '" ' ;
116+ $ this ->assertPrintRoundTrip ($ max );
117+ }
118+
119+ // ---- 64-bit integer boundary round-trips ----
120+
121+ public function testPrintLargeInteger (): void
122+ {
123+ $ this ->assertPrintRoundTrip ('9007199254740992 ' );
124+ }
125+
126+ public function testPrintI64Max (): void
127+ {
128+ $ this ->assertPrintRoundTrip ((string ) PHP_INT_MAX );
129+ }
130+
131+ public function testPrintI64Min (): void
132+ {
133+ $ this ->assertPrintRoundTrip ((string ) PHP_INT_MIN );
134+ }
135+
84136 public function testPrintTrue (): void
85137 {
86138 $ this ->assertPrintRoundTrip ('true ' );
0 commit comments