Edit report at https://bugs.php.net/bug.php?id=51503&edit=1
ID: 51503 Updated by: [email protected] 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
