Hi,

I checkout Drupal HEAD from CVS, but php files do not ends with ?>. Is it required behavior? Can anyone explain me why it is like this and what I can do to correct php files?

Thanks.

Comments

djnz’s picture

Why do you want to 'correct' it?
--------------------- WEBg8 ---------------------

qube’s picture

Beacouse I can't execute such php files in webserver.

morbus iff’s picture

qube, I fought direly against this change, but its intentional, though undocumented (for Drupal, at least). For Drupal, it's supposed to fix a bug related to whitespace AFTER the ?>, which can cause syntax errors and breakage via require() or include(). Could you give us more information on why you can't run without this? Any dirt I can use to get this patch reverted, I'm happy about.

http://disobey.com/
http://gamegrene.com/

Geary’s picture

Sorry, but I'm all for omitting the closing ?> tag. Having invisible whitespace at the end of a file being significant is a natural source of errors. PHP does not require the closing tag, and in fact the PHP docs specifically recommend omitting it to avoid errors:

http://www.php.net/manual/en/language.basic-syntax.instruction-separatio...

Note: The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using include() or require(), so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace at the end of the parts generated by the included files.

morbus iff’s picture

Geary: suffice it to say, I'm keeping my mouth shut. I've argued this on the list already enough, and I don't want to repeat myself on this node.

http://disobey.com/
http://gamegrene.com/

Geary’s picture

Sounds like I was rehashing an old debate. Didn't mean to do that! It was just a new discovery for me. :-)

qube’s picture

I didn't know this. I thought, it is broken file. I will try it later.

qube’s picture

I'm sorry, I was just surprized with the fact it is missing, that I immediatelly posted new topic without actually trying it. I want to test it all later. Can you direct me to the thread where you discussed it (direly fought against it :-)? I searched forums, but found nothing relevant to this. (Maybe search is ommiting ?> string.)

Geary’s picture

...who was direly fighting against it. :-) No apology needed, it would probably be surprising to anyone who is used to seeing the ?> and finds it for the first time.

morbus iff’s picture

The bulk of the discussion happened on the drupal-devel mailing list, but you can see remnants of it (where I've repeated everything I'd've wanted say, really) at http://drupal.org/node/29385.

http://disobey.com/
http://gamegrene.com/