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

Bug #8735 $auth->addUser() method fails with File container
Submitted: 2006-09-19 10:24 UTC
From: tuupola Assigned: aashley
Status: Closed Package: Auth (version 1.3.2)
PHP Version: 4.4.2 OS: Solaris 10
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 22 + 24 = ?

 
 [2006-09-19 10:24 UTC] tuupola (Mika Tuupola)
Description: ------------ Starting from Auth 1.3.1 the addUser() method fails to add new users into passwd file. This is caused by line 170 in Auth/Container/File.php. Call to addUser() is made on a copy of $pw_obj. Thus the next call to save() is made on a different object which does not have the added user. -cut- $res = call_user_func_array(array($pw_obj, 'addUser'), $params); -cut- Passing by reference fixes the problem: -cut- $res = call_user_func_array(array(&$pw_obj, 'addUser'), $params); -cut- See it live at: http://www.appelsiini.net/~tuupola/test/auth_132_adduser.php http://www.appelsiini.net/~tuupola/test/auth_132_adduser.phps http://www.appelsiini.net/~tuupola/test/auth_132_adduser.txt Test script: --------------- <?php require_once 'Auth.php'; $a = new Auth('File', '.htpasswd', 'displayLogin'); $a->removeUser('username'); print '<pre>'; readfile('.htpasswd'); print "-- cut --\n"; $a->addUser('username', 'password', 'additional'); readfile('.htpasswd'); print '</pre>'; ?> Expected result: ---------------- test:fcfKBtvEwG4g.:test -- cut -- test:fcfKBtvEwG4g.:test username:eLh9x1r7U3Tzo:additional Actual result: -------------- test:fcfKBtvEwG4g.:test -- cut -- test:fcfKBtvEwG4g.:test

Comments

 [2006-09-20 02:11 UTC] aashley at php dot net (Adam Ashley)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.