ID: 32750
User updated by: master-bx at users dot sourceforge dot net
Reported By: master-bx at users dot sourceforge dot net
-Status: Open
+Status: Closed
Bug Type: PostgreSQL related
Operating System: Windows XP SP2
PHP Version: 5.0.4
New Comment:
done
Previous Comments:
------------------------------------------------------------------------
[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] [EMAIL PROTECTED]
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?
------------------------------------------------------------------------
[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);
?>
------------------------------------------------------------------------
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