Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- preg_replace() and invalid UTF8 --SKIPIF-- <?php if (@preg_match('/./u', '') === ..
Decoded Output download
--TEST--
preg_replace() and invalid UTF8
--SKIPIF--
<?php
if (@preg_match('/./u', '') === false) {
die('skip no utf8 support in PCRE library');
}
?>
--FILE--
<?php
$string = urldecode("search%e4");
$result = preg_replace("#(&\#x*)([0-9A-F]+);*#iu","$1$2;",$string);
var_dump($result);
var_dump(preg_last_error());
echo "Done
";
?>
--EXPECT--
NULL
int(4)
Done
Did this file decode correctly?
Original Code
--TEST--
preg_replace() and invalid UTF8
--SKIPIF--
<?php
if (@preg_match('/./u', '') === false) {
die('skip no utf8 support in PCRE library');
}
?>
--FILE--
<?php
$string = urldecode("search%e4");
$result = preg_replace("#(&\#x*)([0-9A-F]+);*#iu","$1$2;",$string);
var_dump($result);
var_dump(preg_last_error());
echo "Done\n";
?>
--EXPECT--
NULL
int(4)
Done
Function Calls
preg_match | 1 |
Stats
MD5 | 2440278f722752aa9caab4196c4c9caf |
Eval Count | 0 |
Decode Time | 82 ms |