Doc #79942 [Ver->Csd]: b/c break: new\class now fails

From: Date: Mon, 10 Aug 2020 09:26:04 +0000
Subject: Doc #79942 [Ver->Csd]: b/c break: new\class now fails
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17757@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79942&edit=1 ID: 79942 Updated by: sjon@php.net Reported by: sjon@php.net Summary: b/c break: new\class now fails -Status: Verified +Status: Closed Type: Documentation Problem Package: Class/Object related Operating System: archLinux PHP Version: 8.0.0beta1 -Assigned To: +Assigned To: sjon Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2020-08-10 09:20:41] nikic@php.net I have added a mention of this case to the UPGRADING note: https://github.com/php/php-src/commit/e81ad4089e7435bec8dc075089e9c47851b8ddb7 ------------------------------------------------------------------------ [2020-08-07 11:51:42] cmb@php.net That behavioral change is due to "RFC: Treat namespaced names as single token"[1]; new\x is now a single token (same for some other operators, e.g. instanceof). That needs to be documented. > Somewhat inconsistently, new$x still works […] TIL, but actually not really surprising, since the scanner "automatically" sees two tokens here. [1] <https://wiki.php.net/rfc/namespaced_names_as_token> ------------------------------------------------------------------------ [2020-08-07 11:15:12] sjon@php.net Description: ------------ It's no longer to create an object from a specific namespace without a trailing space after the 'new' keyword. This change is not documented as b/c incompatible change in the NEWS or UPGRADING file. Somewhat inconsistently, new$x still works: https://3v4l.org/JSAFD originally found as https://3v4l.org/ZMgiM Test script: --------------- <?php class x {} new\x; Actual result: -------------- Fatal error: Uncaught Error: Undefined constant "new\x" in /in/KsknY:4 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79942&edit=1

« previous php.doc.bugs (#17757) next »