Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109813 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 29399 invoked from network); 23 Apr 2020 15:44:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Apr 2020 15:44:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5E0B9180505 for ; Thu, 23 Apr 2020 07:16:40 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.64.0.0/10 X-Spam-Virus: No X-Envelope-From: Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11olkn2060.outbound.protection.outlook.com [40.92.20.60]) (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 ; Thu, 23 Apr 2020 07:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q0uMXmDf2iOjUEIxNdliNEgDvhc9WDrJL7aBEEW84HjrpviZjOzK5pJnpTGKwT0au6WG8zEIY8fB2wRTFDOGU+4/zZZTRjEj/h7KM8kCS290+hxhD7PormNTd+Ni9WShWXPFfr5RGKNC/KQXLm2NoeK3C1aWlMFtKF17PYX1LOKWfeasuf1Qhw7YqMT3wjU6zkyX4R/hafLFJG3RHV7VssPDy4I4Wz0EOo+pNESqS1WNWRWLYicx4NVBU+8VnbIJwUstDG/pybEUSgid2doIoeYheKzs1cNzdiDlqjQ3PFGgOArHU8ssQuFOMeYSzaUJPHAElOSANszVRs5YdW2RTA== 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=7sOKQk2YiSIFKAZBcueqveU+VVghBbYabJQvJlBvqLY=; b=niXjui4Xs24swjBqZBcb6NmO9hsblXI8ps4SL5y69ikGmXv/9w9V5otNWISMRz6vJfQTh8F6aY36+Hkj4sw5yFtQ7P/KvSZl/lDwo60e7wWOEiKbQxAr8q4B2V9U6P51wssNVSzjfQuxgcExkuYttIsu7PYe5LNicyx4p53zJISQP8igrFsxXwf3rGuqsjq46j2zlWU6HF4xd/y0hiP8IR2s0xv6ylgV9MxBSTAY3tfefttp1b0A1lLyT2wZ1U84B3No0EeHjKt+AWJ9ZkZSvnlqokcZKcnzfQxeYHQh0pvoce1qsMTrcQfSy8BErAuQkoDBXaGO1va/ItLMPjfOeQ== 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=7sOKQk2YiSIFKAZBcueqveU+VVghBbYabJQvJlBvqLY=; b=JsDLVKK1Qa7P4LsocWg0k8airMt9N1//kKNVzPAg3MIfB2RyE3+ncSXPQyI+dBU+qQjhorajOLRU20AwdHmdxRVvrmald79hExHnzuPWakwE1BWnXYU1u39cW4iKlzx3vYTh8N0jCAxVaI7GdNnpdBksmSTEuiDcVLCuuMGk70j38n+Fnlp+u27QGm0nmaghTX81GIanlQTfDRzTHOeM6K7kh++TE+rex504nc2A5HNhhdmu39E7NcwpWVHPRqUxIIpgr5UXoaxOuHf/BLkW4AmZKZcc/VqiHolAj3cMmxUoHG+ze9TdufomViTq4Rhax0Oxt0K6VzwInfnivJJ3ug== Received: from CO1NAM11FT052.eop-nam11.prod.protection.outlook.com (2a01:111:e400:3861::52) by CO1NAM11HT201.eop-nam11.prod.protection.outlook.com (2a01:111:e400:3861::129) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.15; Thu, 23 Apr 2020 14:16:38 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:3861::47) by CO1NAM11FT052.mail.protection.outlook.com (2a01:111:e400:3861::225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.15 via Frontend Transport; Thu, 23 Apr 2020 14:16:38 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::e553:b74f:bf64:30c5]) by DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::e553:b74f:bf64:30c5%4]) with mapi id 15.20.2921.030; Thu, 23 Apr 2020 14:16:38 +0000 To: Ilija Tovilo , PHP internals Thread-Topic: [PHP-DEV] Re: [DISCUSSION] Match expression Thread-Index: AQHWF0BYxxJ9i22Q4E++xgAoT9Xhl6iGmlMAgAAaq4CAAA0PqQ== Date: Thu, 23 Apr 2020 14:16:38 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:5F466EAC9266D5D64461B70630D36633142F764EF6F8DDB3EA669C85DC1142C8;UpperCasedChecksum:5A5D83846B39D03366F99FC612FB21B66DB1BEAC7486C08D0141FBF18A449E36;SizeAsReceived:7179;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [6LGFCuLfJjMzwR8nh98OJy+BqWLdXj69] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: efd97691-59ce-4038-e2fc-08d7e790f002 x-ms-traffictypediagnostic: CO1NAM11HT201: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Jjf8JmsJjj1exeTQldEv2cHEJ+A+2szk0oKRyyMfDDHCuzVIZG942UWq+AU9Ehc0XfRKHTNlLFcN7FRd8w3i7zytW2A+aYlexYkl27MLmgN6thA3qWQWrv+SCtcC5euvVTk4jKSl7mKJCfn9UOIXOBuGtvVm3QgPgPHansHakidcbmo6QoHKq0UCYgtqAlPnbl5xvDK1FXTk9rzEp8wlL3SbWW7Bpbg22Ah1965xDdM3KT4NoDZADFuIl8lx/wdM x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR07MB6618.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; x-ms-exchange-antispam-messagedata: dcYtQ71Nu/LXr6spIl7+TAehWh/pw4CUWIqC6CVVtw5VJQgA4XV3tKvBJtxNHsQsgGar3k+bbZGmymiV05ntfYWKDMQkhKxidtwOp38XYJKG6aU0qDU7S+GjjWAGMgQBg5KiC1SIlgccSExJoq8c0w== 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-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: efd97691-59ce-4038-e2fc-08d7e790f002 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2020 14:16:38.3992 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM11HT201 Subject: Re: [PHP-DEV] Re: [DISCUSSION] Match expression From: tysonandre775@hotmail.com (tyson andre) Hi Ilija,=0A= =0A= >=A0This is because we don't generate a jumptable when there are less than= =0A= > 5 integer conditions. Because of this inconsistency I'm not sure if we=0A= > should just remove the warning. As you mentioned, it could be=0A= > intentional in some cases. Tyson also mentioned that some constants=0A= > are platform dependent which would make it warn on some platforms but=0A= > not on others.=0A= =0A= It's also inconsistent in that the float, false, null, true, and possibly a= rrays not containing objects or references don't have warnings.=0A= =0A= I'd prefer to go with leaving that check for linters or static analyzers, r= ather than an E_COMPILE_WARNING, because php compiles at runtime (unless pr= eload is used properly)=0A= Multiple static analyzers can do this for switch, e.g. `phan --plugin Dupli= cateArrayKeyPlugin` =0A= https://github.com/phan/phan/tree/master/.phan/plugins#duplicatearraykeyplu= ginphp=0A= =0A= If we did start doing this, I'd personally want it both for switch and matc= h at the same time to be consistent, as a separate RFC.=0A= =0A= Another idea I'd thought of would be to add an `opcache.pedantic` mode for = checks like that,=0A= which would warn about errors noticed by opcache (emitted at compile time, = not runtime) within a single file without running the code=0A= (e.g. calling a function with the wrong type (strlen($obj), too few or too = many arguments to native functions, dead code (e.g. conditions that were al= ways true/false on a platform), etc).=0A= =0A= - Due to platform dependence, that would have false positives, which is why= this would be called pedantic=0A= - This would emit errors directly to a log file or stderr, in order to not = trigger side effects such as user error handlers=0A= =0A= - Tyson=