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-- Bug #72685: Same string is UTF-8 validated repeatedly --SKIPIF-- <?php if (getenv..
Decoded Output download
--TEST--
Bug #72685: Same string is UTF-8 validated repeatedly
--SKIPIF--
<?php
if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test");
?>
--FILE--
<?php
$input_size = 64 * 1024;
$str = str_repeat('a', $input_size);
$start = microtime(true);
$pos = 0;
while (preg_match('/\G\w/u', $str, $m, 0, $pos)) ++$pos;
$end = microtime(true);
var_dump(($end - $start) < 0.5); // large margin, more like 0.05 in debug build
?>
--EXPECT--
bool(true)
Did this file decode correctly?
Original Code
--TEST--
Bug #72685: Same string is UTF-8 validated repeatedly
--SKIPIF--
<?php
if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test");
?>
--FILE--
<?php
$input_size = 64 * 1024;
$str = str_repeat('a', $input_size);
$start = microtime(true);
$pos = 0;
while (preg_match('/\G\w/u', $str, $m, 0, $pos)) ++$pos;
$end = microtime(true);
var_dump(($end - $start) < 0.5); // large margin, more like 0.05 in debug build
?>
--EXPECT--
bool(true)
Function Calls
getenv | 1 |
Stats
MD5 | 5f844e5adc80ad17d59d32cdfecf7fd5 |
Eval Count | 0 |
Decode Time | 111 ms |