1--TEST--
2Bug #60591 (Memory leak when access a non-exists file)
3--DESCRIPTION--
4this is an indirect test for bug 60591, since mem leak is reproted in the server side
5and require php compiled with --enable-debug
6--SKIPIF--
7<?php
8include "skipif.inc";
9?>
10--FILE--
11<?php
12include "php_cli_server.inc";
13$info = php_cli_server_start(null, 'router.php');
14file_put_contents($info->docRoot . '/router.php', <<<'PHP'
15<?php
16if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"]))
17        return false; // serve the requested resource as-is.
18else {
19        echo "here";
20}
21PHP
22);
23
24$host = PHP_CLI_SERVER_HOSTNAME;
25$fp = php_cli_server_connect();
26
27if(fwrite($fp, <<<HEADER
28POST /no-exists.jpg HTTP/1.1
29Host: {$host}
30
31
32HEADER
33)) {
34    while (!feof($fp)) {
35        echo fgets($fp);
36        break;
37    }
38}
39
40fclose($fp);
41?>
42--EXPECT--
43HTTP/1.1 404 Not Found
44