Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112950 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 43460 invoked from network); 21 Jan 2021 01:36:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Jan 2021 01:36:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0B40A1804E4 for ; Wed, 20 Jan 2021 17:16:56 -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_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2070.outbound.protection.outlook.com [40.92.21.70]) (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 ; Wed, 20 Jan 2021 17:16:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jnr3YALJPxeWeMRz1rN1D8wsHyCoxs8+i1CtFbZre/tar9+TK6oN6Keiap53dghpvvW/Zy9OG6YNxMUQT0iM8QXCN2kiHv2HmoIhjfUqLbmaBbRbGXjifRwVglAxpiy15YPzOjDLOEMw4QXIi2fgsD6Or/0qFooUYpThWyZshgDMOGtWbIFT9QM/iiZXMV9pHuVXHzDKAilu5Dbmn9LgJcBfinMRghH2fJ+VhXpnoZEz7EQLxyeqdh5oYia7NX6iUPrQmEET98L24QxVmmfrZ2ahyCN684nWt+IUuohmwp5+MTGcwj8wdbMXBDa9gnZkHyTynUXaZrncMQoJJWHjOA== 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=QJsEViJYJUXlnNGJXWY8sLQqAEx5AMQaWn5V8qQhzqI=; b=W1DALFkQUdDvSoxWN9cHWlCq5Vm/uzFz3FkGXe5gOWXXA58/Y2Be05+/mOU1QooWRWJjXKGoxi7J1lgjoHRlV3nhHgdvqwwNN3l212KCyKeXRHwO3WTSFiI0X+kUdbBuSILy+QdrXrvsMmy2r08r/Z6Wd+yk6qxQeeziqt/iqpVTSKWStVqwpNnb3nUyaK0Qx8s9Coub44y8odS6EP8q6Ka25Lu/yk6bF9aZlvg/CoLKOPvk2RNQi4Qbyu/fHwXTqYK2rTR+YVlPrSrj8rya5KFsb8cfFFc95TGcpnF3QFIFWnJypEiBy/KDnV+JZ8CfL6/tkvi9IvZRAlG/h0v1+w== 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=QJsEViJYJUXlnNGJXWY8sLQqAEx5AMQaWn5V8qQhzqI=; b=MZfwP4jvPUiDD1dOeCpAD/niQzTptYwKV7IQzLgXClU/yHjksEw2t7xn6ptntHcKBaIcVI2XjdXsMiPKY/w/LM1kHgpLrKDyt8g6BpcAsv0nhmyYu6Fr63X9E8+Khi9674t7lCQGLd87Ev/dEa5XYB2eg0sIXz5PJuDg2q3jiaVvHoTcAFHsoCvgaEbmQRqXnJ1M0+i3ia8yW+PsoOjBI9huC/AS/4k2cETUhjGqTchj8lGNKtlgwnbyI52E4uL0rICCTAfHujreZuQARLzMJxiS0F0og4aVQSxxfqrO2Jm/r9pNfzBGLzdUnbYAbDeUZ+/rMLaRt/zvuiPFmpCobg== Received: from BN8NAM12FT027.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::40) by BN8NAM12HT008.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.7; Thu, 21 Jan 2021 01:16:54 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:fc66::41) by BN8NAM12FT027.mail.protection.outlook.com (2a01:111:e400:fc66::138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.6 via Frontend Transport; Thu, 21 Jan 2021 01:16:54 +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.3784.013; Thu, 21 Jan 2021 01:16:54 +0000 To: Sara Golemon , Rowan Tommins CC: PHP internals Thread-Topic: [PHP-DEV] Proposal: short_var_export($value, bool $return=false, int $flags=0) Thread-Index: AQHW7dmyhWuNOI20o0CCrwAKBqqvfqow3qYAgAAZbwCAABcUAIAAGoGAgAAb8cA= Date: Thu, 21 Jan 2021 01:16:54 +0000 Message-ID: References: <22e7ebcf-3f98-ff74-8d84-d2b50cda44b7@gmail.com> <1DF0F205-30A4-4FA3-8A58-703BAC6AD732@gmail.com> <18afe2ed-0802-8f76-b094-64d5ff8cf37f@gmail.com>, In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:25F9F7FB72AD73BF2DD46AA44448BFEE912EEF7226F518EBA8EFABBF7C6E7CCE;UpperCasedChecksum:22D8CDAACFFA9B01D63F2BBEC6D6467ADE2A4B09A6F56307515F312E3CFC6825;SizeAsReceived:7417;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [6cuiZndk+jPpdU8VUzBLeG4lg1oHqsnr5XnOheuyT52RM8qS2ZXxGVW8BvHQItif] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 2762447a-52cd-4abb-7016-08d8bdaa3d36 x-ms-traffictypediagnostic: BN8NAM12HT008: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: x4A+NBNFKyJq980P+PnBfxVVq+4aeayfF1F3ZpinhCgfxon/ydzRONzLF8kf6D11TxVRdlsthnMRZewtikX8+zV2hM8NNT2rRfImapyjlp2CsHBqt4DU+fVHpGwTCi1KslbyB6c8ffadfnIZvnEF04mPHSjXn3iUfXkpaQUkdFn8xhkZKrVzmBhmxt8hDw5k5ljz8esbkt6/EQHlWDCm7n4zWA93ttD8LN6hxvu2fDLqiFc/Yc1OwpG1Z79oi80qxtbit9Cb52H9CzsUNGhqgFgiEWAy0FGBLIN7+YEEyxI= x-ms-exchange-antispam-messagedata: vLlUZrkZ3/Ozsnrg2JjaTg6N5s4oqggMiFfL+GV1bB0xyy8C3P2Y/OyAXOfi9nF6TVG7xDRC3IKB2CGAcV38gFw4wBqHmq4cnrygXswvyDaHhiacRtiId4vO0BLMFYaBp4qcyDRkMHSnVC+lN4yU0ArsTztDrUXmp9wYjP9i+5raTwtfCKboSLgTWf+7E09li1A4zoIf0Nmuf4Q7NiFCDQ== 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: BN8NAM12FT027.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 2762447a-52cd-4abb-7016-08d8bdaa3d36 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2021 01:16:54.1543 (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: BN8NAM12HT008 Subject: Re: [PHP-DEV] Proposal: short_var_export($value, bool $return=false, int $flags=0) From: tysonandre775@hotmail.com (tyson andre) Hi Sara Golemon and Rowan Tommins,=0A= =0A= > > On 20/01/2021 20:21, Claude Pache wrote:=0A= > > > Or `short_var_export()` could just reuse the existing `__debugInfo()`= =0A= > > > magic method (which is already used by both `var_dump()` and=0A= > > > `print_r`, but not by `var_export()`). The programmer would just need= =0A= > > > to make sure that `__set_state()` can consume the array produced by= =0A= > > > `__debugInfo()`.=0A= > >=0A= > >=0A= > > This is an interesting question to explore, but I don't follow how this= =0A= > > relates to my previous e-mail. I'm saying that having print_r, var_dump= ,=0A= > > var_export, and var_export_short (or whatever we call it) all in one=0A= > > language is more confusing than helpful.=0A= > >=0A= > >=0A= > IMO print_r/var_dump should be kept out of this discussion. Those are hum= an=0A= > readable outputs for human consumption.=A0=A0 var_export() is about a mac= hine=0A= > readable output for recreating initial state within a runtime.=A0 The=0A= > requirements presented are wholly different.=0A= =0A= Even python has str(), repr(), and a separate https://docs.python.org/3/lib= rary/pprint.html module for pretty printing,=0A= and https://docs.python.org/3/library/reprlib.html=0A= =0A= I'd agree with leaving out print_r/var_dump out of this - using `__debugInf= o()` in a manner it isn't intended for=0A= and passing different arrays to `__set_state` in var_export and short_var_e= xport/var_representation would be=0A= an inconsistency I'd find surprising and inconsistent as an end user.=0A= =0A= Even as a machine-readable output, var_export has limitations=0A= but there's resistance to changing it and a lot of pre-existing code depend= ing on its current behavior -=0A= it predates namespaces so there's no leading backslash,=0A= the output is much longer than it needs to be and takes longer to generate = if the output is saved somewhere or sent over the network=0A= (e.g. million-element array with keys and indentation)=0A= =0A= As for print_r(), my stance is that the limitations of print_r() should be = documented on php.net with alternatives recommended,=0A= (false, null, and the empty string all become the empty string, for example= )=0A= and I avoid using it for new code,=0A= but there's not a compelling reason to remove it at the time - doing so wou= ld just be a barrier to upgrading=0A= =0A= -Tyson=