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

From: Date: Fri, 07 Aug 2020 11:51:42 +0000
Subject: Bug->Doc #79942 [Opn->Ver]: b/c break: new\class now fails
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17754@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: cmb@php.net Reported by: sjon@php.net Summary: b/c break: new\class now fails -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem Package: Class/Object related Operating System: archLinux PHP Version: 8.0.0beta1 Block user comment: N Private report: N New Comment: 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> Previous Comments: ------------------------------------------------------------------------ [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 (#17754) next »