Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97385 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96523 invoked from network); 13 Dec 2016 13:45:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2016 13:45:14 -0000 Received: from [127.0.0.1] ([127.0.0.1:6955]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 60/11-21185-A6BFF485 for ; Tue, 13 Dec 2016 08:45:14 -0500 Authentication-Results: pb1.pair.com smtp.mail=dejanstosic7@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dejanstosic7@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: dejanstosic7@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wm0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:38580] helo=mail-wm0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/01-21185-0F9FF485 for ; Tue, 13 Dec 2016 08:38:57 -0500 Received: by mail-wm0-f54.google.com with SMTP id f82so121320445wmf.1 for ; Tue, 13 Dec 2016 05:38:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=FNkJo4IBkCvgEypEDkK+0+mZqBoclQYcrHBn4M4Bef4=; b=L5BkiulDnkO7ckXLMUf6FIFygRNQZQbaYQqFeEu4ZWXI8iNENNMJBdDD8a4QcxzuH/ 0OiBIdVWdCqc22gCw4DrFAz1fErIvCvQEuguaWUzkwExQiSbh43A0ceDTnJww9VsY1O8 g0ctuLj/XoB3TOTqEeLwylAkLY7nEzumyeZyK8ShAmeG6mIMHI292H/azDYsJHTxKTP/ ADLwSOv/o7bmiIGp1mjf2738CvzfkXYVuE3pr3c4EJzlphsBYGXeWJN5mKc5eG0V5YGJ AXJl7WW6n/CZgpwSjI3pBnybOE0WqocPn54whwdG4kxpSJHVSnsmjtMSxIbYsDh1e3z8 t+Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FNkJo4IBkCvgEypEDkK+0+mZqBoclQYcrHBn4M4Bef4=; b=k0o1uk5ww8hKZg3sDvYnGJEn671GrZIqTj5ZkZLlSvIAk7+53GuStVGr4T+LdaDlVK 3ruLi7W6B5SbDku961hi423Whw1TaosRox0JoSVqdLcN8O3g312Ex+Bwp0+kLo40qxvd JhsfC07gNKisxYBZKuT8HnthtiCbcMEXMYaL87YfF6q56BtnuuInMNN2ICtxlyMzgW3n DyGTsWV3dmiglgIvmDtZmlW/UMC26zM8xlX1HJ8sgsNV2D0qviqDC895bm8qCOrQuedQ f67gEZ706gR2pEEBMVVqAWZ//Rgjy7KMIV0gxlijPxwlIumM4zfmrjWBv9T8CIlR2wDe /bEw== X-Gm-Message-State: AKaTC00Ih2f9Tb7NCizUxhF2HZmCFRzikFWHTcj7nE6drJSfNuPm5V9V+aYRf/h8s11lGl9rlgAkXixfOsOCUg== X-Received: by 10.25.56.65 with SMTP id d1mr30701434lfj.171.1481636333748; Tue, 13 Dec 2016 05:38:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.79.71 with HTTP; Tue, 13 Dec 2016 05:38:53 -0800 (PST) Date: Tue, 13 Dec 2016 14:38:53 +0100 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=f403045ea68a5c0d4705438a5755 Subject: [RFC Proposal] Introducing New Global Variable to Support Other HTTP Methods and Content Types From: dejanstosic7@gmail.com (=?UTF-8?B?RGVqYW4gU3RvxaFpxIc=?=) --f403045ea68a5c0d4705438a5755 Content-Type: text/plain; charset=UTF-8 *Disclaimer* Sorry if this has been discussed before, i tried searching, but i couldn't find much information. I probably have nowhere near the experience of you guys, so i apologize if i overlooked something obvious. I'd like to hear if this is a good or a terrible idea and the reasons behind it. I'm new to the world of core PHP development, but if this makes sense, i could try working on this myself. *Introduction* The world of web dev has shifted a lot toward API development in the last few years. Specifically - REST APIs are becoming the industry standard. Among other things, one of the core principles of REST is to utilize all HTTP methods - (GET, POST, PUT, PATCH, DELETE...). *The problem* Currently, PHP will parse the incoming HTTP request body only for GET requests (and store the data in superglobal $_GET) and for POST requests (and store the data in $_POST). Additionally it will parse the data only for *application/x-www-form-urlencoded* or *multipart/form-data *HTTP Content types. There are other 3rd party libraries and packages that enhance this and enable parsing for other request methods and content types, but i feel like this should have native support at this point. *Goal* Ideally, PHP should natively parse the incoming HTTP request body for all request methods, not only for GET and POST. I guess that completely replacing the $_POST and $_GET is out of the question as it would lead to no backward compatibility. Maybe an additional superglobal could be introduced ($_DATA)? Thanks --f403045ea68a5c0d4705438a5755--