#24383 [NEW]: Differences between string escaping
| From: | baglan at ankara dot edu dot tr | Date: | Sun, 29 Jun 2003 13:01:08 +0000 |
| Subject: | #24383 [NEW]: Differences between string escaping | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-42716@lists.php.net to get a copy of this message | ||
From: baglan at ankara dot edu dot tr
Operating system: Win32/Linux/OpenBSD
PHP version: 4.3.1
PHP Bug Type: Unknown/Other Function
Bug description: Differences between string escaping
Description:
------------
I write and test PHP scripts on WinXP with Apache 1.3.x and pre-compiled
PHP 4.3.2. Sites where I host my pages are Linux and OpenBSD running
Apache 1.3.x and PHP 4.3.1. In both cases I use MySQL. Both PHP
installations have the same configuration except for the file paths.
Program I wrote stores HTML pages in database so the text in SQL statement
has to be escaped. Under WinXP I have to write code like this:
$string = "'".addslashes($string)."'";
Under Linux and OpenBSD installations when I run the same code I get the
string escaped TWICE. I presume that the string is escaped again during
concantenation.
Reproduce code:
---------------
$string = '<IMG SRC="http://example.com/Arrow.gif">';
$string = "'".addslashes($string)."'";
// Under WinXP I get:
// <IMG SRC=\"http://example.com/Arrow.gif\">
// Under Linux & OpenBSD I get
// <IMG SRC=\\\"http://example.com/Arrow.gif\\\">
--
Edit bug report at http://bugs.php.net/?id=24383&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=24383&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=24383&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24383&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24383&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24383&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24383&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24383&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24383&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24383&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24383&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24383&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24383&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24383&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24383&r=gnused