Bug #74339 [Opn->Nab]: BOGUS: Fatal error: strict_types declaration must be the very first statement

From: Date: Thu, 30 Mar 2017 11:57:20 +0000
Subject: Bug #74339 [Opn->Nab]: BOGUS: Fatal error: strict_types declaration must be the very first statement
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208179@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74339&edit=1 ID: 74339 Updated by: peehaa@php.net Reported by: spam2 at rhsoft dot net Summary: BOGUS: Fatal error: strict_types declaration must be the very first statement -Status: Open +Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 7.1.3 Block user comment: N Private report: N New Comment: This is defined behavior and is not a scripting engine problem Previous Comments: ------------------------------------------------------------------------ [2017-03-30 11:47:56] spam2 at rhsoft dot net Description: ------------ for cli scripts it's no problem to start with a #!/usr/bin/php shebang followed by <?php declare(strict_types=1); as first line, in case of mod_php the sample below throws "PHP Fatal error: strict_types declaration must be the very first statement in the script" *it is* because PHP has no business to claim anything outside <?php ?> as part of "the script" Test script: --------------- <html> <head><title>Test</title></head> <body> <?php declare(strict_types=1); ?> </body> </html> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74339&edit=1

« previous php.bugs (#208179) next »