Bug #80225 [Opn->Ver]: broken namespace usage in eval code

From: Date: Mon, 12 Oct 2020 14:30:53 +0000
Subject: Bug #80225 [Opn->Ver]: broken namespace usage in eval code
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229578@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80225&edit=1 ID: 80225 Updated by: nikic@php.net Reported by: remi@php.net Summary: broken namespace usage in eval code -Status: Open +Status: Verified Type: Bug Package: Scripting Engine problem Operating System: GNU/Linux PHP Version: 8.0.0rc1 Block user comment: N Private report: N New Comment: Basically same as https://3v4l.org/bBCrm. No idea if that's "right", but I guess we can just match the previous behavior. Previous Comments: ------------------------------------------------------------------------ [2020-10-12 13:47:03] remi@php.net Description: ------------ Looks like a regression in 8.0.0rc1 Was working in previous versions (7.2, 7.3, 7.4 and up to 8.0.0beta4) https://3v4l.org/gWW0K Test script: --------------- <?php eval("echo \"One\n\";\n"); eval("namespace Bar;\n\necho \"Two\n\";\n"); eval("?><?php\necho \"Three\n\";\n"); eval("?><?php\nnamespace Bar;\n\necho \"Four\n\";\n"); Expected result: ---------------- One Two Three Four Actual result: -------------- One Two Three Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /in/gWW0K(6) : eval()'d code on line 2 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80225&edit=1

« previous php.bugs (#229578) next »