Bug #66077 [Opn]: Cannot use __HALT_COMPILER(); with require() in namespace.
| From: | kevin at herrera dot io | Date: | Mon, 11 Nov 2013 06:12:26 +0000 |
| Subject: | Bug #66077 [Opn]: Cannot use __HALT_COMPILER(); with require() in namespace. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182698@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66077&edit=1
ID: 66077
User updated by: kevin at herrera dot io
Reported by: kevin at herrera dot io
Summary: Cannot use __HALT_COMPILER(); with require() in
namespace.
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Ubuntu 12.04 LTS
PHP Version: 5.5.5
Block user comment: N
Private report: N
New Comment:
The example demonstrates that this is not true in all cases.
Previous Comments:
------------------------------------------------------------------------
[2013-11-11 06:10:25] phpmpan at mpan dot pl
"__halt_compiler() can only be used from the outermost scope."
http://php.net/manual/function.halt-compiler.php
------------------------------------------------------------------------
[2013-11-11 03:23:14] kevin at herrera dot io
Description:
------------
If I require() a file within "namespace {}", I cannot call __HALT_COMPILER(); at the end
of the script. Instead, I receive a fatal error.
Test script:
---------------
https://gist.github.com/kherge/7407259
Expected result:
----------------
Hello, world!
Actual result:
--------------
PHP Fatal error: No code may exist outside of namespace {} in /home/kherrera/Testing/b.php on line
3
PHP Stack trace:
PHP 1. {main}() /home/kherrera/Testing/a.php:0
Fatal error: No code may exist outside of namespace {} in /home/kherrera/Testing/b.php on line 3
Call Stack:
0.0001 235816 1. {main}() /home/kherrera/Testing/a.php:0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66077&edit=1