Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42463 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6457 invoked from network); 3 Jan 2009 14:19:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2009 14:19:56 -0000 Authentication-Results: pb1.pair.com header.from=thekid@thekid.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=thekid@thekid.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain thekid.de from 212.227.17.2 cause and error) X-PHP-List-Original-Sender: thekid@thekid.de X-Host-Fingerprint: 212.227.17.2 mout-bounce.kundenserver.de Received: from [212.227.17.2] ([212.227.17.2:64538] helo=mout-bounce.kundenserver.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/B0-01547-9047F594 for ; Sat, 03 Jan 2009 09:19:55 -0500 Received: from carla (port-92-205-34-144.dynamic.qsc.de [92.205.34.144]) by mrelayeu.kundenserver.de (node=mrelayeu0) with ESMTP (Nemesis) id 0MKwh2-1LJ7Ly3YBd-0003GW; Sat, 03 Jan 2009 15:19:51 +0100 Message-ID: To: Date: Sat, 3 Jan 2009 15:19:42 +0100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0003_01C96DB6.B3C3D140" X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 14.0.8050.1202 X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8050.1202 X-Provags-ID: V01U2FsdGVkX1/TQ3snaQS3NsJBars2mR+UqchyCJqLPtwDXdS MLhH3UIcqCHj0tpG2b82Iz/9JgQfTT2PgiRRnQVjc4YpZHkY9P goVTY5t/UMEc+35lpsWLf75N04S1+yP Subject: php://input in CLI sapi From: thekid@thekid.de ("Timm Friebe") ------=_NextPart_000_0003_01C96DB6.B3C3D140 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Hi, is there any reason php://input is not supported in CLI sapi? It would be nice to test raw post data reading in unittests without having to run them inside a web server sapi and it's only a five-line patch making php://input read from stdin in cli (attached). - Timm ------=_NextPart_000_0003_01C96DB6.B3C3D140 Content-Type: text/plain; format=flowed; name="sapi-cli.txt"; reply-type=original Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="sapi-cli.txt" Index: sapi/cli/php_cli.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /repository/php-src/sapi/cli/php_cli.c,v retrieving revision 1.129.2.13.2.22.2.20 diff -u -r1.129.2.13.2.22.2.20 php_cli.c --- sapi/cli/php_cli.c 2 Jan 2009 13:14:49 -0000 1.129.2.13.2.22.2.20 +++ sapi/cli/php_cli.c 3 Jan 2009 14:15:56 -0000 @@ -346,6 +346,12 @@ } /* }}} */ +static int sapi_cli_read_post(char *buffer, uint count_bytes TSRMLS_DC) +{ + return read(0, buffer, count_bytes); +} +/* }}} */ + static int sapi_cli_header_handler(sapi_header_struct *h, sapi_header_op_enum op, sapi_headers_struct *s TSRMLS_DC) /* {{{ */ { return 0; @@ -414,7 +420,7 @@ sapi_cli_send_headers, /* send headers handler */ sapi_cli_send_header, /* send header handler */ - NULL, /* read POST data */ + sapi_cli_read_post, /* read POST data */ sapi_cli_read_cookies, /* read Cookies */ sapi_cli_register_variables, /* register server variables */ ------=_NextPart_000_0003_01C96DB6.B3C3D140--