Annotation of embedaddon/php/sapi/cli/tests/php_cli_server_016.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #60591 (Memory leak when access a non-exists file)
! 3: --DESCRIPTION--
! 4: this is a indirect test for bug 50691, since mem leak is reproted in the server side
! 5: and require php compiled with --enable-debug
! 6: --SKIPIF--
! 7: <?php
! 8: include "skipif.inc";
! 9: ?>
! 10: --FILE--
! 11: <?php
! 12: include "php_cli_server.inc";
! 13: php_cli_server_start(<<<'PHP'
! 14: if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"]))
! 15: return false; // serve the requested resource as-is.
! 16: else {
! 17: echo "here";
! 18: }
! 19: PHP
! 20: );
! 21:
! 22: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
! 23: $port = intval($port)?:80;
! 24:
! 25: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
! 26: if (!$fp) {
! 27: die("connect failed");
! 28: }
! 29:
! 30: if(fwrite($fp, <<<HEADER
! 31: POST /no-exists.jpg HTTP/1.1
! 32: Host: {$host}
! 33:
! 34:
! 35: HEADER
! 36: )) {
! 37: while (!feof($fp)) {
! 38: echo fgets($fp);
! 39: break;
! 40: }
! 41: }
! 42:
! 43: fclose($fp);
! 44: ?>
! 45: --EXPECTF--
! 46: HTTP/1.1 404 Not Found
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>