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

From: Date: Mon, 12 Oct 2020 14:35:55 +0000
Subject: Bug #80225 [Ver->Csd]: broken namespace usage in eval code
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229580@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: Verified +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: GNU/Linux PHP Version: 8.0.0rc1 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=f9b7609d17694c5b5d5bba6321b27944220566be Log: Fixed bug #80225 Previous Comments: ------------------------------------------------------------------------ [2020-10-12 14:30:53] nikic@php.net Basically same as https://3v4l.org/bBCrm. No idea if that's "right", but I guess we can just match the previous behavior. ------------------------------------------------------------------------ [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 (#229580) next »