本文整理汇总了PHP中JError::addToStack方法的典型用法代码示例。如果您正苦于以下问题:PHP JError::addToStack方法的具体用法?PHP JError::addToStack怎么用?PHP JError::addToStack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JError
的用法示例。
在下文中一共展示了JError::addToStack方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAddToStack
/**
* @covers JError::addToStack
*/
public function testAddToStack()
{
// Remove the following lines when the framework is fixed.
//$this->markTestSkipped('The framework is currently broken. Skipping this test.');
JErrorInspector::manipulateStack(array('value1', 'value2', 'value3'));
$exception = new JException('This is the error message', 1056, 'error');
JError::addToStack($exception);
$stack = JErrorInspector::inspectStack();
$this->assertThat($stack[3], $this->identicalTo($exception), 'The exception did not get properly added to the stack');
JErrorInspector::manipulateStack(array());
}
示例2: __construct
/**
* Constructor
* - used to set up the error with all needed error details.
*
* @param string $msg The error message
* @param string $code The error code from the application
* @param integer $level The error level (use the PHP constants E_ALL, E_NOTICE etc.).
* @param string $info Optional: The additional error information.
* @param boolean $backtrace True if backtrace information is to be collected
*
* @since 11.1
*
* @deprecated 12.1
*/
public function __construct($msg, $code = 0, $level = null, $info = null, $backtrace = false)
{
JLog::add('JException is deprecated.', JLog::WARNING, 'deprecated');
$this->level = $level;
$this->code = $code;
$this->message = $msg;
if ($info != null) {
$this->info = $info;
}
if ($backtrace && function_exists('debug_backtrace')) {
$this->backtrace = debug_backtrace();
for ($i = count($this->backtrace) - 1; $i >= 0; --$i) {
++$i;
if (isset($this->backtrace[$i]['file'])) {
$this->file = $this->backtrace[$i]['file'];
}
if (isset($this->backtrace[$i]['line'])) {
$this->line = $this->backtrace[$i]['line'];
}
if (isset($this->backtrace[$i]['class'])) {
$this->class = $this->backtrace[$i]['class'];
}
if (isset($this->backtrace[$i]['function'])) {
$this->function = $this->backtrace[$i]['function'];
}
if (isset($this->backtrace[$i]['type'])) {
$this->type = $this->backtrace[$i]['type'];
}
$this->args = false;
if (isset($this->backtrace[$i]['args'])) {
$this->args = $this->backtrace[$i]['args'];
}
break;
}
}
// Store exception for debugging purposes!
JError::addToStack($this);
parent::__construct($msg, (int) $code);
}
示例3: cleanBogusError
protected function cleanBogusError()
{
$errors = array();
while (($error = JError::getError(true)) !== false) {
if (!($error->get('code') == 1 && $error->get('level') == 2 && $error->get('message') == JText::_('JLIB_INSTALLER_ERROR_NOTFINDXMLSETUPFILE'))) {
$errors[] = $error;
}
}
foreach ($errors as $error) {
JError::addToStack($error);
}
$app =& JFactory::getApplication();
$enqueued_messages = $app->get('_messageQueue');
$other_messages = array();
if (!empty($enqueued_messages) && is_array($enqueued_messages)) {
foreach ($enqueued_messages as $enqueued_message) {
if (!($enqueued_message['message'] == JText::_('JLIB_INSTALLER_ERROR_NOTFINDXMLSETUPFILE') && $enqueued_message['type']) == 'error') {
$other_messages[] = $enqueued_message;
}
}
}
$app->set('_messageQueue', $other_messages);
}