new test for php://input and patch for small flaw in run-tests.php

From: Date: Sat, 17 Feb 2007 04:24:44 +0000
Subject: new test for php://input and patch for small flaw in run-tests.php
Groups: php.internals 
Request: Send a blank email to internals+get-28062@lists.php.net to get a copy of this message
Hi all, While porting improvements of run-tests.php into the pear run-tests command, I noticed that there are no tests for the php://input stream in PHP_5_2 (didn't look at HEAD yet), so I thought I would offer one if it is useful. At the same time, I found a flaw in the implementation of POST_RAW, patch attached. Basically, \n is appended to all lines including the last line. The patch corrects this by appending \n to all but the last line so there is no trailing whitespace. Here's the new test: --TEST-- php://input --SKIPIF-- <?php if (php_sapi_name()=='cli') die('skip'); ?> --POST_RAW-- Content-Type: application/x-www-form-urlencoded userid=joe&password=guessme --FILE-- <?php var_dump($_FILES); var_dump($_POST); $fp = fopen('php://input', 'r'); $a = fread($fp, 8192); fclose($fp); var_dump($a); ?> --EXPECT-- array(0) { } array(2) { ["userid"]=> string(3) "joe" ["password"]=> string(7) "guessme" } string(27) "userid=joe&password=guessme"

« previous php.internals (#28062) next »