art1c0 / mooha

Automatically exported from code.google.com/p/mooha
0 stars 0 forks source link

mysql password with a '/' in it will make mooha fail. #46

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. set a MySQL  password with a '/' in it
2. watch error logs
3. try to connect to your server

It provokes : 
  [02-Oct-2011 00:09:52] PHP Notice:  Undefined index: user in /var/www/example.net/mooha/inc/MoohaServer.php on line 127
  [02-Oct-2011 00:09:52] PHP Notice:  Undefined index: pass in /var/www/example.net/mooha/inc/MoohaServer.php on line 128
  [02-Oct-2011 00:09:52] 
  [02-Oct-2011 00:09:52] PHP Warning:  mysql_connect(): Unknown MySQL server host 'mooha' (1) in /var/www/example.net/mooha/inc/MoohaServer.php on line 138

Why ?

in MoohaServer.php parse_url() receives 
"mysql://mooha:mypasswordwitha/inside@localhost/mooha" as an argument but 
outputs nothing cause it gets confused with two many slashes.

Quick fix: remove the slash in the password.

I suppose that same happens inserting ':'  inside password or username. Maybe 
consider using directly username/password/host/db_name from config, without 
concatenating them to a string ($db_url) that will be them exploded into the 
same parts in MoohaServer.php (failing in some cases).

Original issue reported on code.google.com by joce...@crapouillou.net on 1 Oct 2011 at 10:29