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