Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112568 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 23913 invoked from network); 20 Dec 2020 23:04:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Dec 2020 23:04:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D95A51804F3 for ; Sun, 20 Dec 2020 14:36:40 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08olkn2068.outbound.protection.outlook.com [40.92.45.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 20 Dec 2020 14:36:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gCU2e0TdK9c6CBqCOizm23n1zpFwBcT52flAAqo69Pt3jHgrO0zWpPO22a6BlHL62PimeJ2L0JdRsPYbG6kH/tUFyQgjlqat3tla5w9LufkUIbnHm7Xz49YTdRWlGTHVNPT0Ehm16SBkexfjFES2IpcJasRmeQOPvJA4NJGB6Ui46K9VVLB5m0Fk0NcnqHKlAkn0DrpzgyTpCJ1GczkFopllVc7kPbYwzfKulHAvQTCifPZjOA90/g/V+aKW+oyD7bLQAKK3UGRNBmaphCCh+f18kVqFMQtxA9oDEZL7H4lFa7ZRct3SQLfOZAi2CN2dB1UQxchYzJmo++r2PcKl7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5/Bvqz05/CaNRsfukUPPB0i6ljDPdeR35ATeGrpinkU=; b=RlFL6TEQ/Nd0ertXrOAbq+GPbj4Uou+d3SUUMNTAaHaSv6TsuVlDhLCQjvPdtBUppHMfvNAkeYLAKbwlBEq66lOZ7UirpTb7EtR7k94qVSCo1HKG/bjoPQfyFsgzyg+I5++vEU+DUnyYfTuyT/kSFl/0Iy/P93xw2g+dc8cOl4wpqmdypN4Ha44vAQ7tZBi0yJpd0mGQ/nJGe7qigGhhqM1Z7FijfERSrMdU+8E9KJN1G44elcqDPhUsQ1miaM+SBI8C6/emC6ouNsIzWMXwKXxzX+jNXoio7eKlhv5gKzaHvF3G35pPS2OhdvWHfhGrBD5jS7HL+j4WlHFJPxkXbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5/Bvqz05/CaNRsfukUPPB0i6ljDPdeR35ATeGrpinkU=; b=BSrgueqIiCnpGZEa3kTL5TCd34bl+xUirE3mbh/o8iIgyBAzWHWUX+iOHuhku4MWOz9vlTozkGIyGRnYT+B55ndzLBMLGMm5Qk8zySc21Rmbzhu+31zyp1oYoPPH/hjRe7kg+WewicPZPUTiqNlxNqAlQywT4h+8o8nok1d4E6EYg7n6TH1V7nkP4cdcTpQY2w6rGZXK8PIN7rby8sI06JWdrbUKAa7kSSj9nwoHB5kRe2lCj3vdDJ0lCTY++wud31E939SYm5x7RZGbqVJ3XSN8oUPhwXCowMtt0doHZy7yvsR4FJ3T99nHjJTQH2SZD1iyQTRUpnTRHT6avyBb0w== Received: from BN3NAM04FT011.eop-NAM04.prod.protection.outlook.com (10.152.92.57) by BN3NAM04HT134.eop-NAM04.prod.protection.outlook.com (10.152.93.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25; Sun, 20 Dec 2020 22:36:38 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:7e4e::4d) by BN3NAM04FT011.mail.protection.outlook.com (2a01:111:e400:7e4e::149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25 via Frontend Transport; Sun, 20 Dec 2020 22:36:38 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::b4c4:dc11:5337:821d]) by DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::b4c4:dc11:5337:821d%4]) with mapi id 15.20.3676.033; Sun, 20 Dec 2020 22:36:38 +0000 To: "internals@lists.php.net" Thread-Topic: [RFC] Configurable callback to dump results of expressions in `php -a` Thread-Index: AQHW1x7Yg3FUP/hma0qSEEKC7GDKEg== Date: Sun, 20 Dec 2020 22:36:38 +0000 Message-ID: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:194D1E2FAE5E266C00787B66D59B056CE0E5530485D0C665A998D7C1F2FA4193;UpperCasedChecksum:98784097F293F044038C94339E46128EEE9CA4B46BE7CE76535C74232B160695;SizeAsReceived:6855;Count:41 x-tmn: [PjzIF1BNe7D1o7KTxDM5oST1v9A4OZMJopoqmKktp3j9uPvCiT27pJSWg703yjJ9] x-ms-publictraffictype: Email x-incomingheadercount: 41 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 0754c07e-f625-44c7-6524-08d8a537b73f x-ms-traffictypediagnostic: BN3NAM04HT134: x-ms-exchange-minimumurldomainage: externals.io#1631 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DuZftL6Gf/ypVz7s8kLuosjas8aiCEUZdRY4HLa7WDnaJmCP1NabPSbVhf5lxfaZRsJol48a8PWzs37mogYWG5706cLsWNUE9Zq2gxWgr1Xb7RydLP4ZVmuB8o25i5sLd3B23mvWPQRCnNY9Teu/vqtuw5TrxK4H4XD6BmeuZEwS1pSyP7rtHxvy475hBxm4R/M67pBRg38ZkFe4XkQcFAvTeEU+hVDZl2m8v/yea2724vneywKb50r1tjU8CV7bvYl8la4rF4g39ztkmj4bAt/b7M+RIZK1DYMRcGYmyNw= x-ms-exchange-antispam-messagedata: Z7DGggByscQ31uOqb/AAzImWjNs7wmF/Q5EfjkPvbH27o5D8imnWgZInHjVFmlHSgwlrYXrgsJeE8KyKxLH8QqWB0KtzXSo2xcat4M6iTw/NBo2bF9gcZ1A6pq+LZtgBradOElzH0WFB781yb7i/00YQV6UAcg2uRycdtMeaZ+4AV9ie2G8lg/YUQRQ+DSNf/A2y/qLSBasFtbwLz6/m1g== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: BN3NAM04FT011.eop-NAM04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 0754c07e-f625-44c7-6524-08d8a537b73f X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2020 22:36:38.7925 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3NAM04HT134 Subject: [RFC] Configurable callback to dump results of expressions in `php -a` From: tysonandre775@hotmail.com (tyson andre) Hi internals,=0A= =0A= I've created a new RFC https://wiki.php.net/rfc/readline_interactive_shell_= result_function=0A= adding a way to configure a callback to be called to dump the value of sing= le-expression statements from `php -a`=0A= (and an ini setting that can be disabled to prevent that callback from bein= g called).=0A= =0A= Many REPLs (Read-Eval-Print Loops) for other programming languages that I'm= familiar with=0A= print a (possibly truncated) representation of the result of expressions, b= ut PHP doesn't.=0A= It would be useful to allow users to extend the functionality of the defaul= t interactive php shell (php -a),=0A= possibly with auto_prepend_file or through use of command wrappers/aliases,= or after loading the shell.=0A= Prior to this RFC, there was no way to extend the interactive php shell in = this way.=0A= (I've seen https://github.com/bobthecow/psysh mentioned as an alternative f= or php -a while investigating this,=0A= but that's a shell written from scratch, and doesn't have some functionalit= y from php -a such as tolerance of fatal errors)=0A= =0A= Because PHP's interactive shell is written in C, adding new features or bug= fixes is inconvenient - it would require a lot=0A= of time getting familiar with C programming, PHP's internals and memory man= agement,=0A= and with PHP's internal C ast representation.=0A= It would be easier and more accessible to extend PHP's interactive shell th= rough code written in PHP rather than code written in C.=0A= =0A= This was among the proposed enhancements I brought up in https://externals.= io/message/111073 .=0A= An earlier version of the implementation was also created months ago - htt= ps://github.com/php/php-src/pull/5962=0A= =0A= Thanks,=0A= - Tyson=