From:             hugo at 1key dot nl
Operating system: Debian 4.0
PHP version:      5.2.9
PHP Bug Type:     MySQL related
Bug description:  Access denied with double quotes

Description:
------------
<?php
mysql_connect("localhost", "user_name", "p...@ssw'ord") or die
(mysql_error());
/* Gives this error:
-- Access denied for user 'user_name'@'localhost' (using password: YES) */
?>

please note the special characters in the password. When you try to
connect using this command you get the error even though you can connect
using phpmyadmin, commandline mysql etc.

When you change the double quotes to single quotes the problem is solved.
It might be of interest to those used to set strings in double quotes.

<?php
mysql_connect('localhost', 'user_name', 'p...@ssw\'ord') or die
(mysql_error()); 
// Works perfectly 
?>

It is not really a bug, or at least i can easily work around it, but I was
not allowed to submit it as a usernote and got the message i should report
a bug..

Reproduce code:
---------------
---
>From manual page: function.mysql-connect
---
<?php
mysql_connect("localhost", "user_name", "p...@ssw'ord") or die
mysql_error());
/* Gives this error:
-- Access denied for user 'user_name'@'localhost' (using password: YES) 
*/ 
?>


Expected result:
----------------
A connection to the database

Actual result:
--------------
Access denied for user 'user_name'@'localhost' (using password: YES)


-- 
Edit bug report at http://bugs.php.net/?id=47606&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47606&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47606&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47606&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47606&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47606&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47606&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47606&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47606&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47606&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47606&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47606&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47606&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47606&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47606&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47606&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47606&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47606&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47606&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47606&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47606&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47606&r=mysqlcfg

Reply via email to