Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62046 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36423 invoked from network); 5 Aug 2012 09:50:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Aug 2012 09:50:27 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:58983] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 01/60-30533-0E14E105 for ; Sun, 05 Aug 2012 05:50:26 -0400 Received: from Hwhost2.local (36-231.203-62.cust.bluewin.ch [62.203.231.36]) by host1.trois-doubles.net (Postfix) with ESMTPA id 63C7A208442 for ; Sun, 5 Aug 2012 11:50:21 +0200 (CEST) Message-ID: <501E41E1.3010703@hoa-project.net> Date: Sun, 05 Aug 2012 11:50:25 +0200 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/16.0 Thunderbird/16.0a2 MIME-Version: 1.0 To: internals@lists.php.net References: <501D7D06.3060701@ajf.me> In-Reply-To: <501D7D06.3060701@ajf.me> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] php interactive shell without readline From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") Hello, This project is interesting but it is also possible to do it only with PH= P. As a proof of concept, I would like to share some links with you. First=20 one:=20 http://hg.hoa-project.net/Central/file/tip/Library/Console/Readline/Readl= ine.php,=20 which is highly hackable: we can add mappings (esc, ctrl, abc=E2=80=A6), = history=20 (when pressing key up and key down) and it works as an infinite=20 automaton based on the STATE_* constants. And thanks to PHP and its=20 static:: keyword, we can overload states, e.g.:=20 http://hg.hoa-project.net/Central/file/tip/Library/Console/Readline/Passw= ord.php.=20 Hop, password is hidden :-). This library has some limitations: it does not support multibytes=20 (Unicode) and has an unlimited history (which can cause memory errors),=20 but it is a (advanced-)POC. It works on Unix-based system, actually=20 STTY-based shells, and has a pretty simple fallback for DOS. It does not = require PHP to be compiled --with-readline, it uses stty options=20 instead. And finally, it uses around 850 lines of codes (with comments + = licences). Best regards :-). On 04/08/12 21:50, Andrew Faulds wrote: > Well, I saw it, and I say for a ~600 line library, why not? > > Heck, we could maybe reimplement the readline extension with it. > > On 04/08/12 20:49, Ferenc Kovacs wrote: >> Hi, >> >> As most of you know, the current php interactive shell is pretty much >> useless without compiling php --with-readline, but for the most users = >> this >> the first impression what they experience (eg. using the php interacti= ve >> shell without readline support). >> There is an alternative readline replacement called linenoise ( >> https://github.com/antirez/linenoise/) written by the author of=20 >> Redis, and >> I would like to know, what do you think about using that for the >> interactive shell if php is built without readline support. >> It is really small/compact and it is under the two clause BSD license = >> so I >> think it would be a good candidate for bundling it in php. >> What do you think about it? Is it something worth looking into? >> > --=20 Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/