php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48595 Namespace is the first statement, but error is still thrown
Submitted: 2009-06-18 13:38 UTC Modified: 2009-06-18 13:46 UTC
From: spektom at gmail dot com Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 5.3.0RC3 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: spektom at gmail dot com
New email:
PHP Version: OS:

 

 [2009-06-18 13:38 UTC] spektom at gmail dot com
Description:
------------
See the reproduce code... Namespace is the first statement in the PHP 
section, but the error is still thrown.

Reproduce code:
---------------
<html>
<?php
namespace ABC;

Expected result:
----------------
Work without errors.

Actual result:
--------------
Fatal error: Namespace declaration statement has to be the very first 
statement in the script in C:\Documents and 
Settings\michael\workspace\runtime-pdt\php5.3\2.php on line 3 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-18 13:42 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

No, your <html> string is the first statement. It's basically "echo '<html>';" to PHP.
 [2009-06-18 13:46 UTC] spektom at gmail dot com
I understand that intermediate non-PHP sections are implemented using 
'echo' in PHP grammar, but is this really helpful to count them as PHP 
script when we are talking about namespace scoping?
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC