- $error['type'] = $pearError->getType();
- $error['user_info'] = $pearError->getUserInfo();
- $error['to_string'] = $pearError->toString();
- if (function_exists('mysql_error') &&
+ $error['type'] = $pearError->getType();
+ $error['user_info'] = $pearError->getUserInfo();
+ $error['to_string'] = $pearError->toString();
+
+ // We access connection info via _DB_DATAOBJECT instead
+ // of, e.g., calling getDatabaseConnection(), so that we
+ // can avoid infinite loops.
+ global $_DB_DATAOBJECT;
+
+ if (!isset($_DB_DATAOBJECT['CONFIG']['database'])) {
+ // we haven't setup sql, so it's not our sql error...
+ }
+ elseif (preg_match('/^mysql:/', $_DB_DATAOBJECT['CONFIG']['database']) &&