#24383 [Opn->Bgs]: Differences between string escaping
| From: | derick@php.net | Date: | Sun, 29 Jun 2003 13:49:31 +0000 |
| Subject: | #24383 [Opn->Bgs]: Differences between string escaping | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-42718@lists.php.net to get a copy of this message | ||
ID: 24383
Updated by: derick@php.net
Reported By: baglan at ankara dot edu dot tr
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Win32/Linux/OpenBSD
PHP Version: 4.3.1
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
See comment by Marco
Previous Comments:
------------------------------------------------------------------------
[2003-06-29 08:27:04] marcot at tabini dot ca
Works fine on my Linux system. You probably have magic_quotes_runtime
on, and the string is escaped twice.
------------------------------------------------------------------------
[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