[php-src] Issue #10939: Content of form request body not parsed completely

From: Date: Sat, 25 Mar 2023 18:08:54 +0000
Subject: [php-src] Issue #10939: Content of form request body not parsed completely
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244011@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10939 Author: joostdebruijn ### Description When I perform a POST-request with [the following content](https://pastebin.pl/view/bc9e0948) (Content-Type: application/x-www-form-urlencoded), the $_POST variable doesn't contain the full content. It's truncated from a certain point. However, the full content is actually received by the FPM-process, when checking the string content with file_get_contents('php://input');. So it looks like it goes wrong when transforming that input to the $_POST variable. I've reproduced this behavior on PHP-FPM 8.2.4 and PHP-FPM 8.1.17 without the use of any framework or other included code. The behavior is stable on my production environment (running PHP-FPM 8.2.4 in [a Docker container](https://github.com/laravel/vapor-dockerfiles/blob/master/php82.Dockerfile)): it always processes up until the same array key. However, on my development machine (not using Docker, but a regular installation on Ubuntu 22.04) it sometimes results in a segfault, while other times it outputs the incomplete $_POST variable (up until the same point as happens in the production environment). I've similar other form requests which producing the same behavior with other content. ```php <?php $raw_content = file_get_contents('php://input'); var_dump($raw_content, $_POST); exit; ``` Resulted in this output (bit tweaked, but check the size of the array with key "0186d680-95a2-7241-8452-0bb45b6b78ba" and the size of the last array with key 12: ``` index.php:7:string 'event_order%5B0186d680-95a1-700c-8514-f0522f4b56b6%5D%5B0%5D%5Bid%5D=0186d680-95c5-72f3-857c-692edb08e8bb&event_order%5B0186d680-95a1-700c-8514-f0522f4b56b6%5D%5B0%5D%5Bmodel%5D=EventDivider&event_order%5B0186d680-95a1-700c-8514-f0522f4b56b6%5D%5B0%5D%5Btext%5D=Block+B1%2C+1500+m&event_order%5B0186d680-95a1-700c-8514-f0522f4b56b6%5D%5B1%5D%5Bid%5D=0186d680-95d0-7363-951d-f01516c677d5&event_order%5B0186d680-95a1-700c-8514-f0522f4b56b6%5D%5B1%5D%5Bmodel%5D=Event&event_order%5B0186d680-95a1-700c-8514-f0522f4b5'... (length=169328) 'event_order' => array (size=2) '0186d680-95a1-700c-8514-f0522f4b56b6' => array (size=321) 0 => array (size=3) ... more elements... '0186d680-95a2-7241-8452-0bb45b6b78ba' => array (size=13) 0 => array (size=3) ... 1 => array (size=3) ... 2 => array (size=3) ... 3 => array (size=3) ... 4 => array (size=3) ... 5 => array (size=3) ... 6 => array (size=3) ... 7 => array (size=3) ... 8 => array (size=3) ... 9 => array (size=3) ... 10 => array (size=3) ... 11 => array (size=3) ... 12 => array (size=2) ... ``` I expect the array with the key "0186d680-95a2-7241-8452-0bb45b6b78ba" to have a size of 326 and every key in there should have an array with the size of 3. If needed I can provide extra information on this issue. I've no experience with debugging the segfault I encounter on my dev, but I can imagine it may provide some extra insights on what's going wrong. ### PHP Version PHP 8.2.4 ### Operating System Ubuntu 22.04 (dev) and Docker (production, based on php:8.2-fpm-alpine)

« previous php.bugs (#244011) next »