NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Check files for extra space/line after ?> tag


Joined: 10 Jan 2007
Posts: 3
Reply with quote
I would very much like to see an option that can scan all my project files to see if one of these files has an extra space or enter attached at the end of a file after the php closing tag (?>)

We all know the problem that sometimes php returns an error in where it detects that 'the output was already started'. Most of the times it has to do with an extra space at the end of a php file.

I have a LOT of php files and sometimes there is indeed an extra space/return after the closing tag. It would be a timesaving function that detects and repairs such files.

Do you think this is a thing that can be implemented inside phped ?
View user's profileFind all posts by starbbsSend private message
Veteran

Joined: 26 Dec 2006
Posts: 253
Location: Phoenix, AZ
Reply with quote
Or even just an option to outright automatically remove any trailing blank lines. I've seen this in other editors, such as BBEdit.
View user's profileFind all posts by bobwilliamsSend private messageVisit poster's website


Joined: 06 Feb 2007
Posts: 8
Reply with quote
Great idea ! Add my vote to this.
View user's profileFind all posts by ryanjhawkinsSend private message
Veteran

Joined: 26 Dec 2006
Posts: 253
Location: Phoenix, AZ
Reply with quote
I was going to post that for now, you can clean your files up with the Find in Files feature by searching for the following regular expression:

(?m)\n+\Z

and replacing it with an empty string. However, when I tried to verify it, I found that PhpED's search engine seems to have a couple of issues.

The first is that it seems to treat every line of your file as its own independent search string even when you include the multi-line modifier. Put another way, it treats the above expression as though it were:

\n+$

which is completely different. (And of note, the \Z modifier should work globally even without the m switch, which means that the original expression tries twice to hit the end of the file versus the end of the line.)

The second problem, and this is probably related to the first, it doesn't seem to be able to find line feeds, using \r or \n. Thus, for the problem at hand, the IDE's search features would appear too limited to be of help. Sorry!
View user's profileFind all posts by bobwilliamsSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8351
Reply with quote
you may want to check www.php.net/pcre to see regexp syntax we support.
I agreed with the rest, we don't support multi-line search-replaces, including regexp-based.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Check files for extra space/line after ?> tag
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