Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111000 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 9032 invoked from network); 14 Jul 2020 16:18:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Jul 2020 16:18:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3254318050A for ; Tue, 14 Jul 2020 08:10:31 -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,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 mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) (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 ; Tue, 14 Jul 2020 08:10:30 -0700 (PDT) Received: by mail-il1-f170.google.com with SMTP id o3so14456773ilo.12 for ; Tue, 14 Jul 2020 08:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QB+LuNCTwdbPS9JZC9r3ezlhFSA4IfXGqXSBfgS1jyE=; b=ADeRm7304ezGKvpZB6Wpq8wtoPegeQ43yAj7F64d5UnBcoDUrpxqMB75Ozyq9F/IFE DBhNiTZPh3phBfptSUB1kEDO+jv9ah1UU20c3ypJtM2XUskp3iDwdlPsPUNqdMaq6zyF EjHpAjYKFrflJhayp/+6VLWNTbiOV0NhqrjKY= 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=QB+LuNCTwdbPS9JZC9r3ezlhFSA4IfXGqXSBfgS1jyE=; b=k6YUBPVVi1lECLJkgI0KtfisbUVj1ZzaaqBudpYOqAnn/q4KTWVLrXUIwC2bjwl488 NXzXYOHpR3OYIam4xCFakNoq/2bdkVPer9SNTBxDyD4BOr8TwOWkM8coDsYBEXiHraRG B0Yzr3xz9LHDTWdqBYIeyxrEvukWhf79VPa4jzwud/XBlYGsZJt8UYQ1LU8UAXK32Iau K9DTQv1RkO1F1G0Kyiz2TclDr1VoXVVFPVqUo0zdabyY6yT2Ei3CpULeRVSgN1oBa2z3 6KJHycPMGU96DJRHfaZ4Casu5O0u5DdnuewWCPqyCFmGj5QJ5cHSkta5Pe3yc/iFt413 Ry9w== X-Gm-Message-State: AOAM531kC5mQCQR+61u2fc+8gOHt3lvXvcP52vP7QQBQ7g6ZHRFT0EJB QMX1YX0lDGIFRA/uGro3nGBMuVXPnXrWik5mVbhnAA== X-Google-Smtp-Source: ABdhPJx+tXm1/huayE5rxAiWOuRZO2kzNogAFy0TbRSVIdjNlhHBQswB/RvdTjhSp8dAEuwIsaJ02wEEH/wWgw9c3og= X-Received: by 2002:a92:8451:: with SMTP id l78mr5221940ild.234.1594739429528; Tue, 14 Jul 2020 08:10:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: Levi Morrison Date: Tue, 14 Jul 2020 09:10:18 -0600 Message-ID: To: Marcio Almada Cc: Levi Morrison , internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Changing default assertion mode to throw exceptions From: internals@lists.php.net ("Levi Morrison via internals") On Mon, Jul 13, 2020 at 11:52 AM Marcio Almada wrote: > > I'd like to change the default mode of assertion failures to throw. > > The current default is to warn. In my opinion this is a bad strategy: > > the engine asserted that something that is expected to be true is not, > > so executing further is a bad idea. This leaves throwing or bailing > > out. I think throwing an exception is better than bailing out, so > > that's what I propose. > > Couldn't agree more, but I always assumed this BC break could be > too big before. Did you make any research on the impact already? > > Otherwise +1 Nikita put together a search of top packagist repositories to look for assert: https://gist.github.com/nikic/8311ee63c72573d514217456bf2df552 We can't generally know what their ini settings are, though. In my opinion this change is worth any backwards compatibility break as we are choosing the worst setting except for ignoring them altogether, and can be changed back to the previous value using an existing ini setting; we just need to put a note in the migrating guide.