Dienstag, 1. Dezember 2009

How to change saved passwords in Eclipse Subversion Team Provider

If you're working with Eclipse and the Subversion team provider for version control you probably make use of the "Save password" option, when browsing the repository and synchronizing (everything else is more than annoying as every little action requires to type in the password).

However, this works fine unless you have to change your SVN password very often. In my case the SVN password is changed every month due to rather strict security policies in a company I work for.

Flushing Eclipse's password caches doesn't work and finally you end up typing in the new password for every SVN action again – or removing the SVN location and setting up the project(s) again. But that's simply annoying if you are dealing with multiple large projects.

The solution is pretty simple. First you have to remove the according password from the password manager:



So far it's pretty evident. The second, less obvious step is to also delete the auth cache of Subversion itself. The auth cache can typically be found in $HOME/.subversion/auth. Remove the directory (but consider this will delete all other saved passwords for SVN, too).



Then restart Eclipse and try to access the SVN repository. Eclipse will now prompt you for the password again. Check "Save password" and choose "Local repository" from the select box below. Eclipse will probably ask you twice for the new password. Don't be confused, it will save the password anyway.

That's it basically.

Donnerstag, 12. November 2009

Zend_Tool troubles PHPUnit

Zend_Tool is a great utility. In fact it gives me hope and I'm looking forward to the day PHP developers can talk to spoiled Ruby kids on equal terms when it comes to rapid development ;-)

But until then there are still some issues to struggle with.

An example: I tried to set up a new project with Zend_Tool but it refused to work and confronted me with the following error.

Fatal error: Cannot redeclare class phpunit_framework_testsuite_dataprovider in /Users/andreas/WebStack/PHP-5.3.0/PEAR/PHPUnit/Framework/TestSuite/DataProvider.php on line 65

Call Stack:
0.0007     707528   1. {main}() /Users/andreas/WebStack/PHP-5.3.0/bin/zf.php:0
0.0008     707528   2. zf_main() /Users/andreas/WebStack/PHP-5.3.0/bin/zf.php:23
0.0067    1519280   3. zf_run() /Users/andreas/WebStack/PHP-5.3.0/bin/zf.php:36
0.0068    1519496   4. Zend_Tool_Framework_Client_Console::main() /Users/andreas/WebStack/PHP-5.3.0/bin/zf.php:214
0.0068    1520776   5. Zend_Tool_Framework_Client_Abstract->dispatch() /Users/andreas/WebStack/PHP-5.3.0/lib/ZendFramework-1.9-svn/Zend/Tool/Framework/Client/Console.php:96
0.0068    1520776   6. Zend_Tool_Framework_Client_Abstract->initialize() /Users/andreas/WebStack/PHP-5.3.0/lib/ZendFramework-1.9-svn/Zend/Tool/Framework/Client/Abstract.php:209
0.0095    1774360   7. Zend_Tool_Framework_Loader_Abstract->load() /Users/andreas/WebStack/PHP-5.3.0/lib/ZendFramework-1.9-svn/Zend/Tool/Framework/Client/Abstract.php:118
0.3263    2390528   8. include_once('/Users/andreas/WebStack/PHP-5.3.0/PEAR/PHPUnit/Framework/TestSuite/DataProvider.php') /Users/andreas/WebStack/PHP-5.3.0/lib/ZendFramework-1.9-svn/Zend/Tool/Framework/Loader/Abstract.php:90

After a little investigation I found out what the trouble is:
  1. Zend_Tool_Framework_Loader_IncludePathLoader attempts to include_once() all files named like XYZProvider.php. This also covers PHPUnit's DataProvider.php.
  2. In DataProvider.php PHPUnit/Framework.php is require_once()'ed.
  3. Framework.php contains a back reference to DataProvider.php using a require() statement and thus causing the trouble.
There are some solutions on the web suggesting to "fix" the problem either in Zend Framework or in PHPUnit. I personally don't like to modify code in third party libraries unless it is absolutely necessary. Luckily it isn't: As Zend_Tool_Framework_Loader_IncludePathLoader skips symlinks it is easy to work around. Move PHPUnit out of your include_path and replace with a symlink to the new location.

For instance (this is how it worked on my system; PEAR is in include_path):
# cd ~/WebStack/PHP/PEAR/
# mv PHPUnit/ ..
# ln -s ~/WebStack/PHPUnit/ ~/WebStack/PHP/PEAR/PHPUnit
And voila, there you go!

andreas@wonderlustking-2:~/WebStack/PHP/PEAR # zf show version
Zend Framework Version: 1.9.5