Req #51503 [Opn->Wfx]: pg_escape_string() mishandles \
| From: | yohgaki@php.net | Date: | Sat, 31 Mar 2012 06:04:27 +0000 |
| Subject: | Req #51503 [Opn->Wfx]: pg_escape_string() mishandles \ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-169077@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=51503&edit=1
ID: 51503
Updated by: yohgaki@php.net
Reported by: richard at on-the dot net
Summary: pg_escape_string() mishandles \
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: PostgreSQL related
Operating System: debian
PHP Version: 5.3.2
-Assigned To:
+Assigned To: yohgaki
Block user comment: N
Private report: N
New Comment:
It just doesn't care about server settings.
New pg_escape_literal()/pg_escape_identifier() does better escaping.
Previous Comments:
------------------------------------------------------------------------
[2010-04-07 23:08:37] richard at on-the dot net
Description:
------------
My understanding of pg_escape_string() is that it will escape only those characters that require
escaping by the postgresql database.
Using standard_conforming_strings=on in postgres (8.2.4) a "\" (backslash) character is
just a backslash character, not a special character requiring escaping. Therefore, I do not think
pg_escape_string('\') should return '\\' but rather '\'.
The only way I can see to enter a single backslash character is to use the E('\\') syntax
but I should not have do so.
Test script:
---------------
<?php
print pg_escape_string(' \ ');
?>
Expected result:
----------------
should return ' \ '
Actual result:
--------------
returns ' \\ '
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=51503&edit=1