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

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=74339&edit=1

 ID:                 74339
 Updated by:         [email protected]
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.