Re: db-connections and destructors (bug?)

From: Date: Sun, 15 Jul 2001 15:43:00 +0000
Subject: Re: db-connections and destructors (bug?)
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-791@lists.php.net to get a copy of this message
Erik Hjortsberg wrote: > > There seems to be some kind of bug with mysql-connections and the > shutdown-function in php 4.0.5 (which is used by PEAR's destructor > function). Apparently the connection is broken, although it is not clear how. > I'm trying to do a management-system for database-objects where the changes > made to the objects may be sent to the database at the end of script > execution (thereby avoiding a lot of single "update..."-statements). > The problem is that all queries at that time seems to abort the script > without returning a Error-object. It appears as if the mysql_query() > function just silently dies. Since there can be no output at > script-execution end one must put debug info in the session. > All of you probably know that we put a "@" in front of the php function to avoid the php error message. Sometimes it's difficult to track strange errors. I recomend the use of something like that at the top of the code: <?php error_reporting (E_ALL); // this function will handle all errors reported by PHP function php_error_handler ($errno, $errstr, $errfile, $errline) { print ("In $errfile, line: $errline\n<br>$errstr"); } set_error_handler ('php_error_handler'); // this function will catch errors generated by Pear, // transform it to PHP errors and trigger them to the php_error_handler function pear_error_handler ($err_obj) { $error_string = $err_obj->getMessage()."\n".$error_obj->getDebugInfo(); trigger_error ($error_string, E_USER_ERROR); } require 'DB.php'; PEAR::setErrorHandling (PEAR_ERROR_CALLBACK, 'pear_error_handler'); // rest of the code ... ?> Perhaps if you try this, with luck you could get more info about the real error. Tomas V.V.Cox

« previous php.pear.dev (#791) next »