#24383 [Com]: Differences between string escaping
| From: | marcot at tabini dot ca | Date: | Sun, 29 Jun 2003 13:27:05 +0000 |
| Subject: | #24383 [Com]: Differences between string escaping | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-42717@lists.php.net to get a copy of this message | ||
ID: 24383
Comment by: marcot at tabini dot ca
Reported By: baglan at ankara dot edu dot tr
Status: Open
Bug Type: Unknown/Other Function
Operating System: Win32/Linux/OpenBSD
PHP Version: 4.3.1
New Comment:
Works fine on my Linux system. You probably have magic_quotes_runtime
on, and the string is escaped twice.
Previous Comments:
------------------------------------------------------------------------
[2003-06-29 08:01:08] baglan at ankara dot edu dot tr
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 this bug report at http://bugs.php.net/?id=24383&edit=1