1--TEST-- 2GHSA-4w77-75f9-2c8w (Heap-Use-After-Free in sapi_read_post_data Processing in CLI SAPI Interface) 3--INI-- 4allow_url_fopen=1 5--SKIPIF-- 6<?php 7include "skipif.inc"; 8?> 9--FILE-- 10<?php 11include "php_cli_server.inc"; 12 13$serverCode = <<<'CODE' 14var_dump(file_get_contents('php://input')); 15CODE; 16 17php_cli_server_start($serverCode, null, []); 18 19$options = [ 20 "http" => [ 21 "method" => "POST", 22 "header" => "Content-Type: application/x-www-form-urlencoded", 23 "content" => "AAAAA", 24 ], 25]; 26$context = stream_context_create($options); 27 28echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/", context: $context); 29 30$options = [ 31 "http" => [ 32 "method" => "POST", 33 ], 34]; 35$context = stream_context_create($options); 36 37echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/", context: $context); 38?> 39--EXPECT-- 40string(5) "AAAAA" 41string(0) "" 42