Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69505 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59537 invoked from network); 7 Oct 2013 15:03:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2013 15:03:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.83.50 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.83.50 mail-ee0-f50.google.com Received: from [74.125.83.50] ([74.125.83.50:40189] helo=mail-ee0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/A8-24156-E5DC2525 for ; Mon, 07 Oct 2013 11:03:59 -0400 Received: by mail-ee0-f50.google.com with SMTP id d51so3336370eek.37 for ; Mon, 07 Oct 2013 08:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=6PCLpiK0EjQBVfRX21GwO+5zhL1bFgl89eQ6P7+KlrQ=; b=lVL1r3UDUXLtW6rwOQuT6yqQbIeVMlLai+cepl/fVFxbaZRjIGGls6Xd92SwuM0HcF xvUi9SLLnTOGIDiMv9EsSbXcwkjimtMbFyC+rZ4Sq4VTHW6cvs0C4KBmzmx5dzD3XEcx jmzIASBPp97xFH2tZB83Ouj0vaT6CSE5EcLCUSZhw24lOeZit8pVwKhtbZUkh7WFKhd/ RTbD+5jhGF7HQZQTiUXCHBMt06kb/heZ8phak7bo+pBMey+i8WV5Q+yQBNOS3JoZsk1T vxBRCp1dN+CTlvOCdSiUodKwqB5C14L3da2BkOz9hNwCp1wFnbPAG3MLd6MhT1+10Hjv 2vXg== X-Received: by 10.15.22.2 with SMTP id e2mr1150111eeu.89.1381158236491; Mon, 07 Oct 2013 08:03:56 -0700 (PDT) Received: from [192.168.0.131] ([62.189.198.114]) by mx.google.com with ESMTPSA id r48sm64380074eev.14.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Oct 2013 08:03:55 -0700 (PDT) Message-ID: <5252CD5B.1090202@gmail.com> Date: Mon, 07 Oct 2013 16:03:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: internals@lists.php.net References: <1380723023.19591.24.camel@guybrush> <1380750003.19591.55.camel@guybrush> <1381144884.10732.31.camel@guybrush> In-Reply-To: <1381144884.10732.31.camel@guybrush> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] HTTP supergloblas and request body/query (was: Parsing PUT data) From: rowan.collins@gmail.com (Rowan Collins) Hi All, Johannes Schlüter wrote (on 07/10/2013): > Why replace something? Are there flaws which can't be fixed? Adding too > many ways to do the same thing is confusing for everybody. If you want > it "object oriented" or such frameworks do great things. The language > should offer a good foundation. (It is my strong believe that we should > move as many "high level" things as possible in libraries) I think this is a strong point: PHP as it is now is a long way from being usable as a modern framework in its own right, and building a framework-like API for this kind of functionality may open a bigger can of worms than was intended. Zend, Symfony, et al have a massive head-start on any kind of "PHP native framework". Rather than trying to build the framework logic into the core, how about exposing the functionality currently in core to user-space so that frameworks can wrap it more efficiently? Looking around, we currently have the slightly awkward parse_str for query strings and application/x-www-form-urlencoded bodies; I imagine there's something in pecl_http for multi-part/form-data, but I'm not familiar with that extension, and it's not part of core. If the internal implementations were decoupled from the population of $_POST as a consistent set of functions, frameworks could simply wrap them alongside custom parsers such as JSON (with appropriate options) or XML (restricted to some framework-defined schema). This also allows for simulated requests, unit testing, etc, and passing in file_get_contents('php://input') should allow parsing any request body. If this was done as some consistent "serialization/deserialization" module, it could expose the session serialization formats as well, replacing the horrible environment-clobbering of session_decode(). Regards, -- Rowan Collins [IMSoP]