#32750 [Csd->Bgs]: pg_escape_string removes some backslashes

From: Date: Thu, 21 Apr 2005 21:32:41 +0000
Subject: #32750 [Csd->Bgs]: pg_escape_string removes some backslashes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78023@lists.php.net to get a copy of this message
ID: 32750 Updated by: tony2001@php.net Reported By: master-bx at users dot sourceforge dot net -Status: Closed +Status: Bogus Bug Type: PostgreSQL related Operating System: Windows XP SP2 PHP Version: 5.0.4 New Comment: No bug -> bogus. Previous Comments: ------------------------------------------------------------------------ [2005-04-21 23:31:36] master-bx at users dot sourceforge dot net done ------------------------------------------------------------------------ [2005-04-21 23:31:10] master-bx at users dot sourceforge dot net The bug can be closed, my mistake. variable must be first set to static an then defined. that caused the error. nevertheless thanks for help. ------------------------------------------------------------------------ [2005-04-21 20:22:47] master-bx at users dot sourceforge dot net yes, here is my mysql testing code: <?php function sql_escape($var) { if(!isset($mq_gpc)) { $mq_gpc = ini_get('magic_quotes_gpc'); static $mq_gpc; } if(!empty($mq_gpc)) { stripslashes($var); } return <>($var); } ?> <> = mysql(i)_real_escape_string or pg_escape_string mysql works, mysqli and pg not, but i found a typo in a function that uses this one. i will go on testing ... ------------------------------------------------------------------------ [2005-04-21 14:38:12] sniper@php.net Have you read this manual page very carefully: http://www.php.net/mysql_real_escape_string Especially the part about magic_quotes..(the example too) ------------------------------------------------------------------------ [2005-04-20 23:16:14] master-bx at users dot sourceforge dot net Parse error: syntax error, unexpected $end in ***\Apache2\htdocs\test.php on line 6 So my example has been wrong, sorry. Tried it with '\ \\ \\\\' and got the following: string(6) '\ \ \\' string(10) '\\ \\ \\\\' So it does well, but ... to better describe my problem: mysql_real_escape_string does it another way, because it handles POST-data correct for database-storage. pg_escape_string and mysqli_real_escape_string are cutting some \ and i don't get the data stored like the input cames from POST. do you understand it now or need a larger example? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/32750 -- Edit this bug report at http://bugs.php.net/?id=32750&edit=1

« previous php.bugs (#78023) next »