Page MenuHomePhabricator

Add closing PHP tags to end of all files
Closed, DeclinedPublic

Description

It would be best if all PHP files matched their opening tag with a proper closing tag at the end:
<?php

//bla

?>
including even the generated LocalSettings.php.

While not required, it would demonstrate well-formedness.


Version: 1.14.x
Severity: trivial

Details

Reference
bz17642

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 10:30 PM
bzimport set Reference to bz17642.
bzimport added a subscriber: Unknown Object (MLST).

robert wrote:

They were removed to avoid accidental whitespace issues, they will not be added back - they offer no additional functionality.

Well OK, but you never know. Look what bash is doing these days, suddenly printing lots of warnings:
line 261: warning: here-document at line 253 delimited by end-of-file (wanted `EOF')

OK, easy enough to fix when the time comes...
...if one has permissions to update all components.

Official Zend coding style is to omit the closing tags, for the same reason we do. It's unlikely they would change the parser so as to break their own code.

ayg wrote:

(In reply to comment #3)

Well OK, but you never know. Look what bash is doing these days, suddenly
printing lots of warnings:
line 261: warning: here-document at line 253 delimited by end-of-file (wanted
`EOF')

What file is that in? Here-documents shouldn't be terminated by end-of-file. If we removed the ?> tags, this error would still occur, just the "?>" would be included in the string . . .

(In reply to comment #5)

(In reply to comment #3)

Well OK, but you never know. Look what bash is doing these days, suddenly
printing lots of warnings:
line 261: warning: here-document at line 253 delimited by end-of-file (wanted
`EOF')

What file is that in? Here-documents shouldn't be terminated by end-of-file.
If we removed the ?> tags, this error would still occur, just the "?>" would be
included in the string . . .

He's complaining about bash, not PHP, and about some unrelated script, not about MediaWiki.

No, I was saying: forget your closing ?>'s in php, and end up like the
folks who forgot their closing EOFs in bash (will very soon): one day
the webhost updates bash and all your programs start printing warnings
before you can return from Hawaii to figure out what your readers are
complaining about.

I forgot that PHP also has here documents in addition to ?>, sorry for
the confusion.

Of course I don't even know how to spell PHP, so don't quote me.

(In reply to comment #8)

No, I was saying: forget your closing ?>'s in php, and end up like the
folks who forgot their closing EOFs in bash (will very soon): one day
the webhost updates bash and all your programs start printing warnings
before you can return from Hawaii to figure out what your readers are
complaining about.

First of all, PHP warnings aren't ever shown to visitors if your wiki is configured right, they'll just clutter the error log.

And to explain why this will probably never cause warnings, I'll reply with a quote:

(In reply to comment #4)

Official Zend coding style is to omit the closing tags, for the same reason we
do. It's unlikely they would change the parser so as to break their own code.