1--TEST--
2Bug #66731: file: extensive backtracking, with pcre.jit=0
3--EXTENSIONS--
4fileinfo
5--SKIPIF--
6<?php
7if (defined("PHP_DEBUG") && PHP_DEBUG)
8    die("skip not suitable for debug build");
9if (getenv('SKIP_PERF_SENSITIVE'))
10    die("skip performance sensitive test");
11?>
12--INI--
13pcre.jit=0
14--FILE--
15<?php
16$fd = __DIR__.'/cve-2014-3538.data';
17
18file_put_contents($fd,
19  'try:' .
20  str_repeat("\n", 1000000));
21
22$fi = finfo_open(FILEINFO_NONE);
23$t = microtime(true);
24var_dump(finfo_file($fi, $fd));
25$t = microtime(true) - $t;
26finfo_close($fi);
27if ($t < 1) {
28    echo "Ok\n";
29} else {
30    printf("Failed, time=%.2f\n", $t);
31}
32
33?>
34Done
35--CLEAN--
36<?php
37@unlink(__DIR__.'/cve-2014-3538.data');
38?>
39--EXPECTF--
40string(%d) "%s"
41Ok
42Done
43