Bug when creating new PHP file
Posted: March 13th, 2013, 6:20 pm
Hey,
When I create a new PHP script by right clicking on the file tree and using the menu:
Add -> Add New Item
The PHP file that gets created looks correct, but is in fact corrupted and will result in a Fatal Error if used with a namespace declaration statement.
Of course namespace certainly is the first statement!
What appears to be happening is the file is created as:
UTF8+BOM
http://en.wikipedia.org/wiki/Byte_order_mark
The BOM is making PHP think some output has taken place, and therefore the namespace declaration statement is not allowed. This has been happening for a couple of months and is not related to the recent release.
My solution has been to open the file in EditPlus and convert the file to regular UTF8 without a BOM.
When I create a new PHP script by right clicking on the file tree and using the menu:
Add -> Add New Item
The PHP file that gets created looks correct, but is in fact corrupted and will result in a Fatal Error if used with a namespace declaration statement.
- Code: Select all
Fatal error: Namespace declaration statement has to be the very first statement in the script in C:\Whatever.php on line 3
Of course namespace certainly is the first statement!
What appears to be happening is the file is created as:
UTF8+BOM
http://en.wikipedia.org/wiki/Byte_order_mark
The BOM is making PHP think some output has taken place, and therefore the namespace declaration statement is not allowed. This has been happening for a couple of months and is not related to the recent release.
My solution has been to open the file in EditPlus and convert the file to regular UTF8 without a BOM.