Thank you for responding to my requests for assistance. Actually, the $dbh is the db handler object as stated in other PHP/PDO examples $this->dbh = new PDO(...), that wasn't the area of issue, however "the problem NOT being the problem..." was correct. The issue with the code was subsequently one of the last bindParam() calls. The error message, "Catchable Fatal Error: Object of class stdClass could not be converted to string in <File> on line <line>." was behaving exactly as it should. The variable $this->userObj->hwi_ispi sent to the bindParam() was in fact an object not a string. The change in PHP 5.2 which prevents magic conversion of object to string puked at me with the error message mentioned on the line in which PDO was actually taking my bound variables and attempting to execute the statement. PDOStatement::execute() failed when it could not magically convert the object to string (or insert an object when it expected a string or integer?) This is where references to "__toStrint()" comes into play. Without testing this, my assumption is that an earlier version of PHP would have converted the object to string, and the string to an integer representation, completing the code execution but inserting invalid data to my database? If it even got that far, would PDO have puked because the bindParam() for $hwi_ispi was typed as PDO::PARAM_INT? My next question now lies herein with PDOStatement::bindParam()...how do we get PDO to respond a little smarter on a bindParam() failure? Apparently each PDOStatement::bindParam() needs an error check on it? if(!PDOStatement::bindParam()) throw new MyException("bindparam failed", 9999); (this doesn't seam to fail if the data-type isn't what was expected, based on PDO::PARAM_xxx) So it looks like it is my responsibility to verify the variable is what I said it is, before I do my PDOStatement::bindParam() on it. I have since "fixed" my code to do a data-type check on the variable being bound, and low and behold it works now. I realize that many of these questions are rhetorical, and many do not NEED to be answered. However, if I have misrepresented something or if I am completely off base with my understanding of PDO please comment. My goal here is to provide more documentation for the "Catchable Fatal Error:" for which I have fought so hard to resolve. Max H. Thayer Software Developer Center for High-Throughput Structural Biology Hauptman-Woodward Medical Research Inst. 700 Ellicott St. Buffalo, NY 14203 Phone: 716-898-8637 Fax: 716-898-8660 http://www.chtsb.org http://www.hwi.buffalo.edu -----Original Message----- From: Niel Archer [mailto:Niel Archer] On Behalf Of Niel Archer Sent: Monday, June 25, 2007 11:40 AM To: php-db@xxxxxxxxxxxxx Subject: Re: Catchable fatal error: Object of class stdClass could not be converted to string in <filename> on line <line> Hi Seeing as no-one else has replied to this, I'll make a comment. First off let me state I don't use PDO so I am not familiar with it. It would appear to me that your "problem" line is NOT the problem. It is only where the error is reported from. That line is a call to an object method, so the problem is in that method. As you haven't supplied the code for that method, no one is able to help. > A point of note is that my $dbh is being created in my class constructor > as a private. The method that is calling the prepare and execute > statements is a public. I don't thing I'm trying to do anything new or > exotic, I don't think I'm trying to convert the object to a string, just > execute the query statement.... Probably not relevant, although it likely would be better to assign by reference. $prep_users =& $this->dbh->prepare($sql_users); The main problem is we don't know what your $dbh is. We can guess it's a database handle, but that really doesn't tell us anything useful, like how it is constructed, and what the method you try calling is trying to do We need to see the code for the method: $prep_users->execute(); as that is where the error is occurring, and possibly the constructor and prepare methods also. Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ################### ORIGINAL MESSAGE ################# //code snip of public function insertUser() $begin = $this->dbh->beginTransaction(); if (!$begin) throw new HWIException(ERR0023,23); $outdc = ""; $outliid = ""; $prep_users = $this->dbh->prepare($sql_users); if (!$prep_users) { $msg = $this->dbh->errorInfo(); throw new HWIException(ERR0021 . " " . $msg[2], 21); } $prep_users->bindParam(':username', $this->userObj->hwi_username, PDO::PARAM_STR, 16); $prep_users->bindParam(':title', $this->userObj->hwi_title, PDO::PARAM_STR, 4); $prep_users->bindParam(':firstname', $this->userObj->hwi_firstname, PDO::PARAM_STR, 30); $prep_users->bindParam(':midinit', $this->userObj->hwi_midinit, PDO::PARAM_STR, 1); $prep_users->bindParam(':lastname', $this->userObj->hwi_lastname, PDO::PARAM_STR, 45); $prep_users->bindParam(':priphone', $this->userObj->hwi_priphone, PDO::PARAM_STR, 30); $prep_users->bindParam(':priext', $this->userObj->hwi_priext, PDO::PARAM_STR, 10); $prep_users->bindParam(':secphone', $this->userObj->hwi_secphone, PDO::PARAM_STR, 30); $prep_users->bindParam(':secext', $this->userObj->hwi_secext, PDO::PARAM_STR, 10); $prep_users->bindParam(':fax', $this->userObj->hwi_fax, PDO::PARAM_STR, 30); $prep_users->bindParam(':isPI', $this->userObj->hwi_ispi, PDO::PARAM_INT); $prep_users->bindParam(':date_returned', $outdc, PDO::PARAM_STR); $prep_users->bindParam(':liid', $outliid, PDO::PARAM_STR); ##################### PROBLEM LINE OF CODE ################### $exec = $prep_users->execute(); ############################################################ ##### if(!$exec) { $msg = $prep_users->errorInfo(); throw new HWIException(ERR0022 . " " . $msg[2], 22); } ************************************************************ **** USAGE test.php ************************************************************ **** $userobject->username = 'mysuername'; $userobject->lastname = 'mylastname'; // continue on w/ each property as described in the bindParam statements in the insertUser() method. //class MyUser extends PDO (I started out extending PDO, changed to code to debug it by creating a $dbh object in the constructor, and switched back to extending PDO. Nothing works. $userObj = new MyUser($userObject); $userObj->insertUser(); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php