@$obj =& new $classname;
if (!$obj) {
- return new DB_Error(DB_ERROR_NOT_FOUND);
+ return PEAR::raiseError(DB_ERROR_NOT_FOUND,
+ null, null, null, null, 'DB_Error', true);
}
return $obj;
}
if (!$obj) {
- return new DB_Error(DB_ERROR_NOT_FOUND);
+ return PEAR::raiseError(DB_ERROR_NOT_FOUND,
+ null, null, null, null, 'DB_Error', true);
}
if (is_array($options)) {
function isError($value)
{
return (is_object($value) &&
- (get_class($value) == 'db_error' ||
- is_subclass_of($value, 'db_error')));
+ (get_class($value) == 'db_error' ||
+ is_subclass_of($value, 'db_error')));
}
/**
* @param $userinfo If you need to pass along for example debug
* information, this parameter is meant for that.
*
+ * @param $error_class The returned error object will be instantiated
+ * from this class, if specified.
+ *
* @return object a PEAR error object
*
* @see PEAR::setErrorHandling
function &raiseError($message = null, $code = null, $mode = null,
$options = null, $userinfo = null,
- $error_class = null)
+ $error_class = null, $skipmsg = false)
{
if ($mode === null) {
if (isset($this) && isset($this->_default_error_mode)) {
} else {
$ec = 'PEAR_Error';
}
- return new $ec($message, $code, $mode, $options, $userinfo);
+ if ($skipmsg) {
+ return new $ec($code, $mode, $options, $userinfo);
+ } else {
+ return new $ec($message, $code, $mode, $options, $userinfo);
+ }
}
// }}}
mode=callback(function): errorhandler function called, obj=[pear_error: message="test error" code=-42 mode=callback callback=errorhandler prefix="" prepend="" append="" info=""]
mode=callback(method): errorhandler method called, obj=[pear_error: message="test error" code=-42 mode=callback callback=errorclass::errorhandler prefix="" prepend="" append="" info=""]
mode=print&trigger: test error<br>
-<b>Notice</b>: test error in <b>/usr/local/lib/php/PEAR.php</b> on line <b>399</b><br>
+<b>Notice</b>: test error in <b>/usr/local/lib/php/PEAR.php</b> on line <b>413</b><br>
[pear_error: message="test error" code=-42 mode=print|trigger level=notice prefix="" prepend="" append="" info=""]
mode=trigger: <br>
-<b>Notice</b>: test error in <b>/usr/local/lib/php/PEAR.php</b> on line <b>399</b><br>
+<b>Notice</b>: test error in <b>/usr/local/lib/php/PEAR.php</b> on line <b>413</b><br>
[pear_error: message="test error" code=-42 mode=trigger level=notice prefix="" prepend="" append="" info=""]
mode=trigger,level=notice: <br>
-<b>Notice</b>: test error in <b>/usr/local/lib/php/PEAR.php</b> on line <b>399</b><br>
+<b>Notice</b>: test error in <b>/usr/local/lib/php/PEAR.php</b> on line <b>413</b><br>
[pear_error: message="test error" code=-42 mode=trigger level=notice prefix="" prepend="" append="" info=""]
mode=trigger,level=warning: <br>
-<b>Warning</b>: test error in <b>/usr/local/lib/php/PEAR.php</b> on line <b>399</b><br>
+<b>Warning</b>: test error in <b>/usr/local/lib/php/PEAR.php</b> on line <b>413</b><br>
[pear_error: message="test error" code=-42 mode=trigger level=warning prefix="" prepend="" append="" info=""]
mode=trigger,level=error: <br>
-<b>Fatal error</b>: test error in <b>/usr/local/lib/php/PEAR.php</b> on line <b>399</b><br>
+<b>Fatal error</b>: test error in <b>/usr/local/lib/php/PEAR.php</b> on line <b>413</b><br>