Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #11495 Connect with password fails
Submitted: 2007-07-01 09:57 UTC Modified: 2008-05-03 15:23 UTC
From: wuermchen Assigned: itrebal
Status: Closed Package: Net_MPD (version 1.0.1)
PHP Version: 5.2.0 OS: Linux / Debian Etch
Roadmaps: (Not assigned)    
Subscription  


 [2007-07-01 09:57 UTC] wuermchen (Steffen Wurm)
Description: ------------ If you are using a password on the initial connect(), you get an exception (error). Test script: --------------- <?php include_once '/usr/share/php/Net/MPD.php'; $passwd_ok = 'mefoo'; $mpd = new Net_MPD('127.0.0.1',6600, $passwd_ok); $mpd->Common->connect(); ?> Expected result: ---------------- Nothing. The Script just connects - there should not appear any output. The password is ok. root@Buechse:/usr/share/php/Net/MPD# grep pass /etc/mpd.conf password "mefoo@read,add,control,admin" Actual result: -------------- Line 109 in the Common.php throws an exception and aborts the script. The problem is a wrong compare. connect() checks if there is a password given. Then it runs the command $this->runCommand('password', ...) and checks the returned value. The returned value is TRUE, if the password is OK. This is compared with an error-code (ACK_PASSWORD / 4) but with a '=='. So: if (TRUE == 4) { throw... } In any case he will throw an error-msg. Using '===' should help.

Comments

 [2008-05-03 15:23 UTC] itrebal (Graham Christensen)
Fixed.