Spent more time on this bug than I should have, but ...

I had a problem which I tracked down to two non-printable characters
of whitespace, inserted at the beginning of data sent to the client,
as a response to an ajax operation.

Now, where would *you* look to find how two unprintable characters
crept their way into AJAX response text?

I had a feeling there must be some white space after a closing tag,
somewhere.

But *where*?

And when did the problem start - I hadn't tested that operation in a
while?

Which changed files should I limit the search to?

So, with no choice left, I went back far into SVN to find the last
working version, then worked my way forward with a binary search  to
see in which revision those characters started appearing.

I finally located the revision, then eyeballed the changed files, and
presto, there it was --  extra lines after the closing "?>" php tag in
one of the files.

Now, how can this be prevented in the future?

I can configure my editor to automatically clean trailing whitespace
on each line before saving, but not blank lines after the closing
tag...

Even if I made it a habit of removing all closing "?>" tags, as many
people recommend, there will be times when this will be forgotten.

Here is an interesting post on the subject:
http://choosetheforce.blogspot.com/2008/05/should-you-close-that-php-tag.html

How do people deal with this major royal pain in the rear?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to