PHP 5 is such a wonder. i got a chance to use it when the host i'm using changed their PHP version to PHP 5.2.4 recently. before that, i'd been trying to write code compatible with both versions of PHP, and couldn't use exceptions and the like. coming from a background of C++, you might understand a few of the reasons i like PHP 5. anyway, since the host i was using changed their PHP version, i threw out the backward-compatibility and rewrote all my classes to use PHP 5 syntax - which reminds me of C++. of course, this came to bite me in the rear - twice already, and i may still have a few more bites before i'm done.
specifically, for one thing, i started using access modifiers. unfortunately, there was this little bit of my code that required me to access a data member from one class to another. using the old syntax, that was no problem, but when i changed to PHP 5, i automatically made all data members private - which caused an access error, since one class needed access to another's internals. anyway, that was quickly resolved and relatively minor. from my C++ heritage, the concept of destructors is quite cool - objects that 'know' how to clean themselves up when they die make life easy. when rewriting my code for PHP 5, i automatically started using destructors - i mean, let the database connection close itself when it goes out of scope - or shouldn't it? herein lies the problem: i wrapped sessions also and also provided a destructor - that cleaned up the session when the session object went out of scope! of course, i was high on PHP 5 and didn't quite realize that that would defeat the purpose of the session itself - why use sessions that would simply clean themselves up when the current script terminates? it took me quite some time to figure out why i couldn't log in - because the password was correct and when i looked at the access logs on my machine, i saw that i was redirected from the login page to the dashboard and back to the login page. besides, when i tried the wrong password, i got a different error message. d-uh!