ID: 32750 Updated by: [EMAIL PROTECTED] Reported By: master-bx at users dot sourceforge dot net -Status: Open +Status: Feedback Bug Type: PostgreSQL related Operating System: Windows XP SP2 PHP Version: 5.0.4 New Comment:
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) Previous Comments: ------------------------------------------------------------------------ [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? ------------------------------------------------------------------------ [2005-04-20 17:06:09] [EMAIL PROTECTED] Please paste the exact output of this script: <?php $var = '\ \\ \\\'; var_dump($var); $test = pg_escape_string($var); var_dump($test); ?> ------------------------------------------------------------------------ [2005-04-20 11:36:45] master-bx at users dot sourceforge dot net $var outputs \ \\ \\\ before and after it, and $test doesn't get an extra \ in most of my tests. ------------------------------------------------------------------------ [2005-04-20 09:16:16] [EMAIL PROTECTED] Isn't the expected result supposed to be: '\\ \\\\ \\\\\\' What does var_dump($var); output before and after doing pg_escape_string() ? ------------------------------------------------------------------------ [2005-04-18 21:42:37] master-bx at users dot sourceforge dot net Description: ------------ Some backslashes are lost after using that function, same bug seems to be in mysqli_real_escape_string. Another function (mysql_real_escape_string) does well, if this is not a bug please give me a solution to fix this. Thank you, hajo @ bxcp.com Reproduce code: --------------- $var = '\ \\ \\\'; $test = pg_escape_string($var); echo $test; Expected result: ---------------- '\ \\ \\\' Actual result: -------------- ' \ \\' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32750&edit=1