Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17539 программистов и 1878 роботов. Сейчас ищут 1732 программиста ...

PEAR_ErrorStack::push

Вернуться к: PEAR_ErrorStack

PEAR_ErrorStack::push

PEAR_ErrorStack::push() – Add an error to the stack

Synopsis

require_once 'PEAR/ErrorStack.php';

PEAR_Error|array PEAR_ErrorStack::push ( integer $code , string $level = 'error' , array $params = array() , string $msg = false , array $repackage = false , array $backtrace = false )

As of PEAR 1.3.2, PEAR_ErrorStack no longer instantiates and returns an Exception object in PHP5. Code that relies upon this behavior will break.

If the message generator exists, it is called with 2 parameters.

  • the current Error Stack object

  • an array that is in the same format as an error. Available indices are 'code', 'package', 'time', 'params', 'level', and 'context'

Next, if the error should contain context information, this is handled by the context grabbing method. Finally, the error is pushed onto the proper error stack

Parameter

integer $code

Package-specific error code

string $level

Error level. This is NOT spell-checked

array $params

associative array of error parameters

string $msg

Error message, or a portion of it if the message is to be generated

array $repackage

If this error re-packages an error pushed by another package, place the array returned from pop() in this parameter

array $backtrace

Protected parameter: use this to pass in the http://www.php.net/manual-lookup.php?pattern=debug_backtrace that should be used to find error context.

Return value

returns if compatibility mode is on, a PEAR_Error is also thrown. If the class Exception exists, then one is returned to allow code like:

<?php 1      throw ($stack->
push
(MY_ERROR_CODE, 'error', array('username' => 'grob'))); ?>

The errorData property of the exception class will be set to the array that would normally be returned. If a PEAR_Error is returned, the userinfo property is set to the array

Otherwise, an array is returned in this format:

<?php 1      array( 2         'code' => $code, 3         'params' => $params, 4         'package' => $this->_package, 5         'level' => $level, 6         'time' =>
time
(), 7         'context' => $context, 8         'message' => $msg, 9      //['repackage' => $err] repackaged error array 10     ); ?>

Throws

No exceptions thrown.

Note

This function can not be called statically.



Вернуться к: PEAR_ErrorStack

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware