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";
13php_cli_server_start(<<<'PHP'
14if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"]))
15        return false; // serve the requested resource as-is.
16else {
17        echo "here";
18}
19PHP
20);
21
22list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
23$port = intval($port)?:80;
24
25$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
26if (!$fp) {
27  die("connect failed");
28}
29
30if(fwrite($fp, <<<HEADER
31POST /no-exists.jpg HTTP/1.1
32Host: {$host}
33
34
35HEADER
36)) {
37	while (!feof($fp)) {
38		echo fgets($fp);
39        break;
40	}
41}
42
43fclose($fp);
44?>
45--EXPECTF--
46HTTP/1.1 404 Not Found
47