PHP 4.0 Bug #7630 Updated: ereg_replace or preg_replace
| From: | stas@php.net | Date: | Sun, 05 Nov 2000 11:37:41 +0000 |
| Subject: | PHP 4.0 Bug #7630 Updated: ereg_replace or preg_replace | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37173@lists.php.net to get a copy of this message | ||
ID: 7630
Updated by: stas
Reported By: bmonro@ccbill.com
Status: Closed
Bug Type: Unknown/Other Function
Assigned To:
Comments:
1. Turn off magic_quotes in your php.ini
2. To enter backslash into regular expression, double it. Like this: "\\\\". Yes, I know
this is ugly, that's how escaping works.
3. Please do not use bug database to ask PHP questions. Use it if you are *sure* there's a bug.
For PHP questions, there's php-general@lists.php.net.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-03 17:57:05] bmonro@ccbill.com
I have an HTML text input field generated by my php code:
print "<input type=text name=varname>";
the script is accepting the input just fine.
I then need to pass the variable into a mysql database query.
This is where it barfs.
it is putting backslashes before any single quotes i put in the text field. So I tried using
ereg_replace and preg_replace to replace the backslash with nothing (i.e. empty string). but to no
avail
here is what happens:
if I type this in the input box:
login_id = 'username'
it sends this to the mysql query:
login_id = 'username'
ereg_replace and preg_replace are both getting messed up on the backslash.
PLEASE HELP!
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7630