bug67198.phpt 1022 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. php://input is empty when enable_post_data_reading=Off
  3. --INI--
  4. allow_url_fopen=1
  5. --SKIPIF--
  6. <?php
  7. include __DIR__."/../../sapi/cli/tests/skipif.inc";
  8. ?>
  9. --FILE--
  10. <?php
  11. require __DIR__."/../../sapi/cli/tests/php_cli_server.inc";
  12. $code =
  13. <<<'FL'
  14. if(!ini_get('enable_post_data_reading')){
  15. if($_SERVER['REQUEST_METHOD']=='POST'){
  16. exit(file_get_contents('php://input'));
  17. }
  18. }else{
  19. exit('Please SET php.ini: enable_post_data_reading = Off');
  20. }
  21. FL;
  22. $postdata = "PASS";
  23. $opts = array('http' =>
  24. array(
  25. 'method' => 'POST',
  26. 'header' => 'Content-type: application/x-www-form-urlencoded',
  27. 'content' => $postdata
  28. )
  29. );
  30. $context = stream_context_create($opts);
  31. php_cli_server_start("exit(file_get_contents('php://input'));", false, "-d enable_post_data_reading=Off");
  32. var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS, false, $context));
  33. var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS, false, $context));
  34. --EXPECT--
  35. string(4) "PASS"
  36. string(4) "PASS"