Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109129 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 39637 invoked from network); 18 Mar 2020 18:18:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Mar 2020 18:18:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C853B1804B8 for ; Wed, 18 Mar 2020 09:41:42 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 18 Mar 2020 09:41:42 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id u12so27841918ljo.2 for ; Wed, 18 Mar 2020 09:41:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ujutAZcUcCjiWNEPS2IcpSEKiM2vb10drQpgR8zqoDo=; b=Si+FVpUXO6U05HAWyOAyOxq3hC7RpWZxaZ5tIeNf/WIKvY+BbdPuCqlOGmXOEn2z2z 9Hr4DE8s1Uce1Nw24izqpEND1wpGpFH9rsiB2pExp2phythS3LiCXUWzEUEPMPkD883j 51jbC2Ld410uN9js1Rn4t+fvD9gLzo7/RGtflkaEaYpwYA/YpX2kfyR3fFw5ZvomaOq1 C/c59kX/NSf6l8YtvIcZyLz1ENBFe+/9BbiNNKQKhds50qh7lRAPu0/g8hiOAuhFTepm ucypy1sGOZmjf8wG+zexsCkZfNFtjo3XVkZzLmXA6VuCv7FEmIluFo4XEomRMVRi5Li7 3dlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ujutAZcUcCjiWNEPS2IcpSEKiM2vb10drQpgR8zqoDo=; b=Y0cJGegCRFqOpneT6DtgVmVnyZavK1Cg8Me+8Ik35xmUStoE+JUkt7ibs+J2om4v39 h0NKSkulBdAmDh4XBajtpJZF48izzd2lZUYpAJFpJb7bPt3bokQYTQiW4/LS/LR/C+2l +//ntiDZJZfDOTWTkDXjJvoIZx4jlGxq8IpgDebsxD0x6iLkhaallqyUgWttjpQsHwfH yopEIUiLnjK1bRuafueN1roCODlptI54ZIi7sKG7PC1J6Ac90SFjN8CPHkTKrn3PEZdt KgkhAZAk9G3nJyMhhzWBYXRpnk+6FJGcrS0VVvJm8UY0Dimi62ByYsk2nP21RpCXbId2 hV4A== X-Gm-Message-State: ANhLgQ2MElHDMNyi5ZCHmTGzIALqO7DZ8ksDEsR5LCFTeuLMsXvg0afQ veeeMvQ1KMM0CmeacDDT4l5gsXYFo8D9RGOapss= X-Google-Smtp-Source: ADFU+vufWS8mLqf2iolgmggOmYnZ4snaeF8bEzidNpF15JZeJwKE5gtz6r2oOu5LnjlPCZZp2zLrwtwi2AUf9c3VzVY= X-Received: by 2002:a2e:91d9:: with SMTP id u25mr2934761ljg.145.1584549700082; Wed, 18 Mar 2020 09:41:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 18 Mar 2020 17:41:23 +0100 Message-ID: To: Mark Randall Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000009fad05a123ba0c" Subject: Re: [PHP-DEV] [Discussion] Promoting declare failure notices to exceptions? From: nikita.ppv@gmail.com (Nikita Popov) --000000000000009fad05a123ba0c Content-Type: text/plain; charset="UTF-8" On Sat, Mar 14, 2020 at 9:20 PM Mark Randall wrote: > Greetings, > > I have created a PR that will throw exceptions when using define() > with invalid types or when trying to redefine. > > Trying to redefine a constant or define a bad constant would throw a > ValueError on the name parameter, trying to pass an unsupported type > would give a TypeError on the value parameter. > > Normal promotions are fairly run of the mill, however for some utterly > bizarre reason the existing behaviour is to print a notice and not a > warning as with almost all other functions that are failing. > > Is there a good reason not to promote these to exceptions? > > https://github.com/php/php-src/pull/5265 > This was previously discussed in the context of https://wiki.php.net/rfc/constant_redefinition. Looking back at the thread, it basically went "we should not break BC in a minor version, do it in PHP 8 instead". Well, now we have PHP 8, so let's do it. This is also the first step towards improving our optimization capabilities in this area. It's not quite enough by itself (due to early binding related issues), but it's a step in the right direction. Regards, Nikita --000000000000009fad05a123ba0c--