mirror of
https://github.com/php/php-src.git
synced 2026-04-21 23:18:13 +02:00
* have DB.php use PEAR::raiseError in factory methods
This commit is contained in:
+6
-4
@@ -188,7 +188,8 @@ class DB
|
||||
@$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;
|
||||
@@ -235,7 +236,8 @@ class DB
|
||||
}
|
||||
|
||||
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)) {
|
||||
@@ -278,8 +280,8 @@ class DB
|
||||
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')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-2
@@ -252,6 +252,9 @@ class PEAR
|
||||
* @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
|
||||
@@ -261,7 +264,7 @@ class PEAR
|
||||
|
||||
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)) {
|
||||
@@ -305,7 +308,11 @@ class PEAR
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
@@ -113,16 +113,16 @@ mode=print: test error[pear_error: message="test error" code=-42 mode=print leve
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user