NuSphere Forums Forum Index
NuSphere Forums
Reply to topic

Do you miss the php end tag '?>' at the end of php files in order to prevent the "http headers already sent" errors?
yes, sometimes I do
20%
 20%  [ 1 ]
no, I don't
80%
 80%  [ 4 ]
no, I didn't know this could be useful
0%
 0%  [ 0 ]
Total Votes : 5

PHP closing tags ?>


Joined: 18 Jun 2008
Posts: 4
Reply with quote
Version 5.95, following PHP file is marked as invalid by the built-in parser:

Code:
<?php
echo "Hello world! There is no php-close tag at the end of this file...";


The error message is: "Reached the end of the document before the ending... ?> ..."

The thing is, that...
- PHP runs such a script without any problem
- i *want* miss the PHP close tag. It helps to prevent the "HTTP headers already sent" errors, because I don't need to beware of whitespaces at the end of included files.

Is there a way how to make the code above valid? (I haven't found such setting)
If not, I'd propose to change back the parser's behavior.
View user's profileFind all posts by bzuKSend private message


Joined: 27 Apr 2007
Posts: 72
Reply with quote
I have the same issue, it is very annoying! All my php files omits ending ?>. Even frameworks like Zend, Nette, Drupal has ommiting of ending tag in their code standarts.

Quote:

Best Practices and Closing Tags (Zend)

We didn't forget the closing (?>) PHP tag! We intentionally omit it to avoid unintentional output of whitespace in the response in certain cases. In fact, this is one of the best practices recommended in the Zend Framework coding standards.
View user's profileFind all posts by sirjardaSend private message


Joined: 27 Apr 2007
Posts: 72
Reply with quote
I have raised an issue to Nusphere support.
View user's profileFind all posts by sirjardaSend private message


Joined: 27 Apr 2007
Posts: 72
Reply with quote
Ok, I have got an answer from support, it seems there is a problem with HMTL Validator.
To solve this, turn off option "Validate HTML in PHP" in Code Insight settings.
View user's profileFind all posts by sirjardaSend private message
PHP closing tags ?>
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic