473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how can white space enter a text file?


This is one of the more bizarre things I've seen in a while.

We've a function called getListOfAllDatabaseTables that does about what
you'd expect. It lives in a file called getListOfAllDatabaseTables.php.
The file is included when the function needs to be called. The function
is called when users are adding in new information. Most of the time, if
a user fills in a form to (say for instance) create a new weblog post,
the user would hit "Submit" and then the action of adding that
information to the database would occur before the next page loads
(before any HTML is sent to the user's browser).

Suddenly, yesterday, when testing the development site, I started
getting errors when adding new material "Cannot send headers, output
already started in getListOfAllDatabaseTables.php". So I open up
getListOfAllDatabaseTables.php and, sure enough, there is a single white
space that has suddenly been added to the end of the file, outside of
the closing ?tag. I delete the white space and thus fix the problem.

I want to know who is to blame for this so I look at the files history
in Subversion. Turns out, no one has edited this file since it was first
checked in back in November.

The whole site is under Subversion. We use Springloops.com which has a
nice auto-deploy feature. No one has FTP access to the site. No one has
SSH access to the site, except root. Really, the only way a white space
could appear in that file is if someone ssh to the server, logged in as
root, opened that file, added a white space, and then closed it without
making any other change.

Which does not seem likely. There are only two people with the root
password to the server, myself, and one other programmer. Neither of us
had any reason to touch that file, nor do either of us have any memory
of touching that file yesterday.

Any other way a white space can suddenly appear at the end of a file?

Jun 27 '08 #1
3 2473
On Fri, 06 Jun 2008 00:02:28 +0200, Lawrence Krubner
<la******@krubner.comwrote:
>
This is one of the more bizarre things I've seen in a while.

We've a function called getListOfAllDatabaseTables that does about what
you'd expect. It lives in a file called getListOfAllDatabaseTables.php.
The file is included when the function needs to be called. The function
is called when users are adding in new information. Most of the time, if
a user fills in a form to (say for instance) create a new weblog post,
the user would hit "Submit" and then the action of adding that
information to the database would occur before the next page loads
(before any HTML is sent to the user's browser).

Suddenly, yesterday, when testing the development site, I started
getting errors when adding new material "Cannot send headers, output
already started in getListOfAllDatabaseTables.php". So I open up
getListOfAllDatabaseTables.php and, sure enough, there is a single white
space that has suddenly been added to the end of the file, outside of
the closing ?tag. I delete the white space and thus fix the problem.

I want to know who is to blame for this so I look at the files history
in Subversion. Turns out, no one has edited this file since it was first
checked in back in November.

The whole site is under Subversion. We use Springloops.com which has a
nice auto-deploy feature. No one has FTP access to the site. No one has
SSH access to the site, except root. Really, the only way a white space
could appear in that file is if someone ssh to the server, logged in as
root, opened that file, added a white space, and then closed it without
making any other change.

Which does not seem likely. There are only two people with the root
password to the server, myself, and one other programmer. Neither of us
had any reason to touch that file, nor do either of us have any memory
of touching that file yesterday.

Any other way a white space can suddenly appear at the end of a file?
That's no PHP question, but at least some process has had to do something
to the file, or the servers configuration. Usually, in these cases, it WAS
a user, just not someone willing to own up to it. I'd check the time the
file was last changed (which you probably can't get as you changed it
back), and compare them to other logs. Then again, it could just be a
simple configuration change on the server, making the problem only visible
now (output buffering and the like).

The answer to the question 'what could do that?' is actually: almost
anything. There is no way for use to tell you without full logs & root
access to your server, and even then it's probably untracable.
--
Rik Wasmus
....spamrun finished
Jun 27 '08 #2
Rik Wasmus wrote:
On Fri, 06 Jun 2008 00:02:28 +0200, Lawrence Krubner
<la******@krubner.comwrote:
>>
Any other way a white space can suddenly appear at the end of a file?

That's no PHP question, but at least some process has had to do
something to the file, or the servers configuration. Usually, in these
cases, it WAS a user, just not someone willing to own up to it. I'd
check the time the file was last changed (which you probably can't get
as you changed it back), and compare them to other logs. Then again, it
could just be a simple configuration change on the server, making the
problem only visible now (output buffering and the like).

The answer to the question 'what could do that?' is actually: almost
anything. There is no way for use to tell you without full logs & root
access to your server, and even then it's probably untracable.

Like the time all my carefully spaced output blocks - space padded to
get everything to line up - suddenly blew up.

The 'Hairy Programmer' eventually admitted that he had run a 'replace
every three spaces by tabs' on the source code to make it small enough
as the PDP-11 was running out of disk space..

Jun 27 '08 #3
On Jun 5, 11:02 pm, Lawrence Krubner <lawre...@krubner.comwrote:
>
"Cannot send headers, output
already started in getListOfAllDatabaseTables.php".
<snip>
>
Which does not seem likely. There are only two people with the root
password to the server, myself, and one other programmer. Neither of us
had any reason to touch that file, nor do either of us have any memory
of touching that file yesterday.

Any other way a white space can suddenly appear at the end of a file?
Conjecturing about what caused this is futile - it could be lots of
different things - and there's nothing substantial in your post to
base a hypothesis on.

But you can prevent the same thing from recurring **regardles of the
cause** by employing a style requirement that the closing '?>' is
omitted from include files.

C.
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: \Dandy\ Randy | last post by:
Hello everyone. I have been following misc posts, as well as reading several FAQ's on this issue, unfortunatley I cannot locate a solution. I am hoping that someone will be able to provide me with...
2
by: Malcolm Dew-Jones | last post by:
I am looking at xslt 1.0 and trying to understand if empty text nodes are supposed to be stripped or not as the default behaviour. 3.4 starts by listing rules for when white space is not stripped...
2
by: Jerry Sievers | last post by:
tried to avoid using PRE in the page markup and instead used DIV CLASS=foo and assigned the white-space pre property to it. have some reports already that text is not showing as preformatted. ...
0
by: Mark Moore | last post by:
I'm trying to layout a couple text input fields and their corresponding labels without using a table. When I was trying to debug my understanding of CSS, I was *very* surprised to see that span's...
1
by: Amar | last post by:
I have a web form with several fields. Depending on user selection in one combo box, i populate a text box and a check box in one line. For example if the user selects 2 years, then i show the...
3
by: Prince | last post by:
I have some <RequiredFieldValidator> on my page and everything works fine except that there are lots of white spaces between the web server controls that are being validated. I've set the Display...
12
by: snow | last post by:
Hi All, I noticed if file path has a white space, for example "C:\my document \test.txt", the function File.Exists(filePath) always return false in release mode. How could I make this function...
17
by: JWest46088 | last post by:
I am making a program that asks the user to enter some information and then enters it into a text file, but I can't figure out how to read a whole line with spaces in it. When the user enters a line...
2
by: Jibran | last post by:
I need some help with extra spaces in HTML form. There is a big white space appearing at the center of the HTML form that I am designing even though there is no <br> tags been used: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.