On 19-Aug-05, at 2:46 PM, Morbus Iff wrote:
Can anyone (Goba?) confirm or not confirm that ?> is unnecessary at the end of included PHP files (like Drupal modules)? I prefer that it remains, regardless whether it is needed or not. PHP coding everywhere, for any application, needs to have both the <? and ?>. Having PHP developers come to Drupal with an admonition to not close their tags is dirty, anti-learning, and case-scenario-ish. But you do not deny that it solves the whitespace issue. I do not think code style should win over a problem, but... the list will decide. I agree that it will solve the whitespace problem, but at too great a cost.
Not that this is all all that unique, but we've found this a useful tool to find the extra white space in our php files, so thought I'd contribute it: $ find . -name \*.php | xargs -n 1 perl -0777ne 'print $ARGV,"\n" if ! /\?>$/s' $ find . -name \*.php -o -name \*.class -o -name \*.inc | xargs -n 1 perl -0777ne 'print $ARGV,"\n" if !(/\?>$/s) && !(/\?>[\r]$/s)' $ find . -name \*.php -o -name \*.class -o -name \*.inc | xargs -n 1 perl -0777ne 'print $ARGV,"\n" if !(/\?>[ \t]*$/s) && !(/\?>[ \t]*[\r]$/s)' I'm totally in favour of keeping both <?php and ?> - and yes, gotta keep vigilant against short tags too. Mike -- Mike Gifford, OpenConcept Consulting Free Software for Social Change -> http://www.openconcept.ca Latest launch Canadian Labour Congress / Congrès du travail du Canada http://canadianlabour.ca / http://congresdutravail.ca