PHP  
 PHP_7_2
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Valgrind Report for tests/basic/bug67198.phpt ('php://input is empty when enable_post_data_reading=Off')

Script

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

Report

==27087== Jump to the invalid address stated on the next line
==27087==    at 0x4FE: ???
==27087==  Address 0x4fe is not stack'd, malloc'd or (recently) free'd
==27087== 
==27087== 
==27087== Process terminating with default action of signal 11 (SIGSEGV)
==27087==  Bad permissions for mapped region at address 0x4FE
==27087==    at 0x4FE: ???

 

Generated at Fri, 15 Dec 2017 07:20:55 +0000 (37 hours ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.