Req #61439 [Com]: POST and other methods input data handling

From: Date: Thu, 25 Jun 2020 13:59:37 +0000
Subject: Req #61439 [Com]: POST and other methods input data handling
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227662@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61439&edit=1 ID: 61439 Comment by: me at daz dot one Reported by: martin dot koranda at gmail dot com Summary: POST and other methods input data handling Status: Duplicate Type: Feature/Change Request Package: *General Issues Operating System: * PHP Version: 5.4.0 Block user comment: N Private report: N New Comment: I've been trying to figure out how to work with this issue without having to break RESTful convention and boy howdie, what a rabbit hole, let me tell you. I'm adding this anywhere I can find in the hope that it will help somebody out in the future. I've just lost a day of development firstly figuring out that this was an issue, then figuring out where the issue lay. After trawling through a good few RFCs for php core, the core development team seem somewhat resistant to implementing anything to do with modernising the handling of HTTP requests. The issue was first reported in 2011, it doesn't look any closer to having a native solution. That said, I managed to find a PECL extension called apfd (always populate form data). I'm not really very familiar with pecl, and couldn't seem to get it working using pear. but I'm using CentOS and Remi PHP which has a yum package. I ran: yum install php-pecl-apfd and it literally fixed the issue straight away (well I had to restart my docker containers but that was a given). I believe there are other packages in various flavours of linux and I'm sure anybody with more knowledge of pear/pecl/general php extensions could get it running on windows or mac with no issue. Previous Comments: ------------------------------------------------------------------------ [2015-04-13 16:27:10] mike@php.net See bug #55815 and also https://pecl.php.net/package/json_post and https://pecl.php.net/package/apfd ------------------------------------------------------------------------ [2012-03-20 15:14:42] martin dot koranda at gmail dot com mike: yes that's better, parse it regarding on the request content type. it should be also good if it could automatically parse json or xml input, but main is the multipart. do you think you can push your proposal to some of the next builds? ------------------------------------------------------------------------ [2012-03-20 09:01:37] mike@php.net I second that. Actually I've sitting an unfinished proposal in my Inbox' Drafts which addresses this issue. BUT, I'm not thinking about php.ini, but SAPI code shouldn't care about the request method, but the request body's content type. And there should be an API to register content-type handlers. ------------------------------------------------------------------------ [2012-03-19 17:36:38] martin dot koranda at gmail dot com Description: ------------ when sending multipart/form-data via a POST method, PHP internally parses all variables into $_POST and files into $_FILES. but the parsing is not done with any other method (PUT,PATCH,PROPFIND ..) additionally, sending POST with multipart/form-data makes php://input unavailable. so there is no universal parsing solution which covers all methods. there should be a setting option (php.ini) where i can determine which particular methods i want the internal parser run for (eg. "parse_input_methods = POST,PUT,PATCH") and/or there should be an option for disabling that internal parser completely. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61439&edit=1

« previous php.bugs (#227662) next »