Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112909 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 27323 invoked from network); 16 Jan 2021 17:28:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Jan 2021 17:28:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7D31F1804E4 for ; Sat, 16 Jan 2021 09:07:31 -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_20,HTML_MESSAGE, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from darkcity.gna.ch (darkcity.gna.ch [195.49.47.11]) (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 ; Sat, 16 Jan 2021 09:07:30 -0800 (PST) Received: from wafer.home (unknown [IPv6:2a02:1205:5053:a220:81ae:3d94:ffa8:7dba]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 1FA06150A58A for ; Sat, 16 Jan 2021 18:07:27 +0100 (CET) Content-Type: multipart/alternative; boundary="Apple-Mail=_AB1466AB-DFED-4E0F-8A48-414E005537EA" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Message-ID: <70E24D44-D791-4AEB-92C3-3B8C9579F5CC@cschneid.com> Date: Sat, 16 Jan 2021 18:07:27 +0100 To: PHP internals X-Mailer: Apple Mail (2.3654.40.0.2.32) Subject: Consistent type errors for internal functions and BC breaks From: cschneid@cschneid.com (Christian Schneider) --Apple-Mail=_AB1466AB-DFED-4E0F-8A48-414E005537EA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii While testing the migration of our site to PHP 8 we noticed the BC break = in internal functions like round() for parameter type errors: round("foo") used to (silently, without warning) cast to float and = return 0 where as now it throws a TypeError: round(): https://3v4l.org/pU0LD The RFC at = https://wiki.php.net/rfc/consistent_type_errors#backward_incompatible_chan= ges states > Backward Incompatible Changes >=20 > A TypeError will be thrown instead of a warning if incorrectly typed = parameters are passed to a function, which is a backwards incompatible = change. But that is not the whole truth because it suggests that there was a = warning in 7.4 which is not the case for functions like round() and = possibly many more. This makes the BC break much more impactful as there is no easy way to = know if old code will suddenly abort with an exception whereas it used = to run without any warning. Is there any way of knowing what functions are affected by this? This might be a blocker for people to migrate to PHP 8, should there be = a way to have a warning-instead-of-exception stage added to PHP 8 even = though there first versions were already released to help people = migrate? Or did I miss something? - Chris --Apple-Mail=_AB1466AB-DFED-4E0F-8A48-414E005537EA--