xref: /PHP-8.3/ext/mbstring/tests/mb_scrub.phpt (revision 6f53dbb8)
1--TEST--
2mb_scrub()
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7var_dump(
8    "?" === mb_scrub("\x80"),
9    "?" === mb_scrub("\x80", 'UTF-8')
10);
11
12$utf8str = "abc 日本語 Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞";
13// Check $utf8str so it is marked as 'valid UTF-8'
14// This will enable optimized implementation of mb_scrub
15if (!mb_check_encoding($utf8str, 'UTF-8'))
16    die("Test string should be valid UTF-8");
17var_dump(mb_scrub($utf8str));
18?>
19--EXPECT--
20bool(true)
21bool(true)
22string(122) "abc 日本語 Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞"
23