Database connection in class.global.inc.php

A place to discuss the testing process in beta cycles or against SVN for the CMS Made Simple CORE package.
Locked
gnud

Database connection in class.global.inc.php

Post by gnud »

I originally came here to report a bug in the latest release, but after checking SVN I found it was fixed. Good work!

However, I can't say the fix looks too good.
In cmsObject::getDb(), there is (naturally) a check to see if the connection to the database failed.
It reads

Code: Select all

if (!$dbinstance || (TRUE == empty($dbinstance->_connectionID) && TRUE == empty($dbinstance->connectionId)))
			{
				var_dump($dbinstance);
				die("Database Connection failed");
			}
The condition accesses a private variable. I suggest you instead keep the return value from $dbinstance->Connect(), and check that. Alternatively, use the $dbinstance->IsConnected() method.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Database connection in class.global.inc.php

Post by Ted »

Point taken.  I've changed it to use the IsConnected() method instead.  Thanks!
Locked

Return to “[locked] Quality Assurance”