> On 5 Nov 2014, at 22:29, Sherif Ramadan <theanomaly...@gmail.com> wrote: > > From all the people I've spoken with that have a problem with handling PUT > requests in PHP, it seems that they'd rather have PHP populate > $_FILES/$_POST automatically in this case. Which would be relatively easy > to do by modifying the default post reader function in the SAPI > http://lxr.php.net/xref/PHP_5_6/main/php_content_types.c#51 however, that > is itself a small BC break. > > Does anyone have any recommendations on what they think the best approach > is? I'd appreciate any feedback/suggestions/constructive-criticism. Thanks!
I don’t think auto-populating for PUT/DELETE etc. is a good idea, they’re quite different semantically. If I send a DELETE request to code expecting a POST, and PHP pretends it’s a POST request, that’s bad. However, I think the solution is simple: Add a function to do multipart/form-data parsing. Not a suite of functions, not a class, just one simple function. That way, for the few people that need it, they can do $_POST = multipart_form_data_parse(file_get_contents(‘php://input')); and their problem’s solved. If we can’t expose the parser, we could also just add a function to force population (force_parse_post_data() or something?). Again, this allows the few that need this to do so explicitly, but doesn’t make $_POST allow it for everyone else. -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php