Discussion:
\r\n in data breaks php
Marc Fromm
2014-03-27 20:58:24 UTC
Permalink
Server1:
CENTOS 6.4
Postgresql-8.4
PHP 5.3

Server2:
RHEL 5.2
Postgresql-8.1
PHP 5.1

Bother servers serve the same php pages that connect to a postgresql database. Both servers have magic quotes turned off.

I have a problem with carriage returns in the database. They are stored fine but when selected in a query there is a problem. The twist is the problem only happens on the server2. Any record with a carriage return, when selected by a php page, does not display any of the fields values in the form that the data should populate. All the boxes are empty. If I manually remove the carriage returns through phpPgAdmin then the form does display all the field data.

Since the same code works on server1 but not on sever2, I must assume the problem is a configuration issue. Not sure if it's with PHP or postgresql.

Any insight is most welcomed.

Marc
Marc Fromm
2014-03-28 14:56:00 UTC
Permalink
\r\n is what displays in the logs on the linux server where the code breaks.

-----Original Message-----
From: Jeffry Killen [mailto:***@prodigy.net]
Sent: Thursday, March 27, 2014 7:27 PM
To: Marc Fromm
Subject: Re: [PHP] \r\n in data breaks php
Post by Marc Fromm
CENTOS 6.4
Postgresql-8.4
PHP 5.3
RHEL 5.2
Postgresql-8.1
PHP 5.1
Bother servers serve the same php pages that connect to a postgresql
database. Both servers have magic quotes turned off.
I have a problem with carriage returns in the database. They are
stored fine but when selected in a query there is a problem. The twist
is the problem only happens on the server2. Any record with a carriage
return, when selected by a php page, does not display any of the
fields values in the form that the data should populate. All the boxes
are empty. If I manually remove the carriage returns through
phpPgAdmin then the form does display all the field data.
Since the same code works on server1 but not on sever2, I must assume
the problem is a configuration issue. Not sure if it's with PHP or
postgresql.
Any insight is most welcomed.
Marc
In your subject line you have \r\n which, I assume is a Windows style line break. When I do html of Windows in the context of <pre> tags, for instance, I use \n\r to create a line break.
Other wise I suppose you are aware that unix line breaks are \n. This may not make a difference in your situation but it also may be worth consideration.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...