#48127 [Opn->Bgs]: Namespace error when file saved as UTF-8

From: Date: Fri, 01 May 2009 20:31:53 +0000
Subject: #48127 [Opn->Bgs]: Namespace error when file saved as UTF-8
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-136637@lists.php.net to get a copy of this message
ID: 48127 Updated by: derick@php.net Reported By: sol at venasoft dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows XP PHP Version: 5.3.0RC1 New Comment: 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 Quite likely you have a BOM in this PHP file. You need to configure your editor not to write those. Previous Comments: ------------------------------------------------------------------------ [2009-05-01 20:17:22] sol at venasoft dot com Description: ------------ Scripts containing namespaces fail with an error if the file is saved in encoding UTF-8, but works as expected when saved in encoding ANSI using Windows Notepad. Only namespaces seem to be effected by this error. Reproduce code: --------------- <?php namespace { print 'Hello World'; } Expected result: ---------------- Hello World Actual result: -------------- Fatal error: Namespace declaration statement has to be the very first statement in the script in C:\home\public_html\name.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48127&edit=1

« previous php.bugs (#136637) next »