1--TEST-- 2preg_replace() and invalid UTF8 3--SKIPIF-- 4<?php 5if (@preg_match('/./u', '') === false) { 6 die('skip no utf8 support in PCRE library'); 7} 8?> 9--FILE-- 10<?php 11 12$string = urldecode("search%e4"); 13$result = preg_replace("#(&\#x*)([0-9A-F]+);*#iu","$1$2;",$string); 14var_dump($result); 15var_dump(preg_last_error()); 16 17echo "Done\n"; 18?> 19--EXPECT-- 20NULL 21int(4) 22Done 23