1,26 → 1,33 |
<?php |
// |
// +--------------------------------------------------------------------+ |
// | PEAR, the PHP Extension and Application Repository | |
// +--------------------------------------------------------------------+ |
// | Copyright (c) 1997-2004 The PHP Group | |
// +--------------------------------------------------------------------+ |
// | This source file is subject to version 3.0 of the PHP license, | |
// | that is bundled with this package in the file LICENSE, and is | |
// | available through the world-wide-web at the following url: | |
// | http://www.php.net/license/3_0.txt. | |
// | If you did not receive a copy of the PHP license and are unable to | |
// | obtain it through the world-wide-web, please send a note to | |
// | license@php.net so we can mail you a copy immediately. | |
// +--------------------------------------------------------------------+ |
// | Authors: Sterling Hughes <sterling@php.net> | |
// | Stig Bakken <ssb@php.net> | |
// | Tomas V.V.Cox <cox@idecnet.com> | |
// +--------------------------------------------------------------------+ |
// |
// $Id: PEAR.php,v 1.1 2005-03-30 08:50:19 jpm Exp $ |
// |
/** |
* PEAR, the PHP Extension and Application Repository |
* |
* PEAR class and PEAR_Error class |
* |
* PHP versions 4 and 5 |
* |
* LICENSE: This source file is subject to version 3.0 of the PHP license |
* that is available through the world-wide-web at the following URI: |
* http://www.php.net/license/3_0.txt. If you did not receive a copy of |
* the PHP License and are unable to obtain it through the web, please |
* send a note to license@php.net so we can mail you a copy immediately. |
* |
* @category pear |
* @package PEAR |
* @author Sterling Hughes <sterling@php.net> |
* @author Stig Bakken <ssb@php.net> |
* @author Tomas V.V.Cox <cox@idecnet.com> |
* @author Greg Beaver <cellog@php.net> |
* @copyright 1997-2006 The PHP Group |
* @license http://www.php.net/license/3_0.txt PHP License 3.0 |
* @version CVS: $Id: PEAR.php,v 1.2 2006-12-14 15:04:29 jp_milcent Exp $ |
* @link http://pear.php.net/package/PEAR |
* @since File available since Release 0.1 |
*/ |
|
/**#@+ |
* ERROR constants |
*/ |
define('PEAR_ERROR_RETURN', 1); |
define('PEAR_ERROR_PRINT', 2); |
define('PEAR_ERROR_TRIGGER', 4); |
31,6 → 38,7 |
* @deprecated |
*/ |
define('PEAR_ERROR_EXCEPTION', 32); |
/**#@-*/ |
define('PEAR_ZE2', (function_exists('version_compare') && |
version_compare(zend_version(), "2-dev", "ge"))); |
|
78,9 → 86,18 |
* IMPORTANT! To use the emulated destructors you need to create the |
* objects by reference: $obj =& new PEAR_child; |
* |
* @since PHP 4.0.2 |
* @author Stig Bakken <ssb@php.net> |
* @see http://pear.php.net/manual/ |
* @category pear |
* @package PEAR |
* @author Stig Bakken <ssb@php.net> |
* @author Tomas V.V. Cox <cox@idecnet.com> |
* @author Greg Beaver <cellog@php.net> |
* @copyright 1997-2006 The PHP Group |
* @license http://www.php.net/license/3_0.txt PHP License 3.0 |
* @version Release: 1.4.11 |
* @link http://pear.php.net/package/PEAR |
* @see PEAR_Error |
* @since Class available since PHP 4.0.2 |
* @link http://pear.php.net/manual/en/core.pear.php#core.pear.pear |
*/ |
class PEAR |
{ |
230,6 → 247,12 |
*/ |
function registerShutdownFunc($func, $args = array()) |
{ |
// if we are called statically, there is a potential |
// that no shutdown func is registered. Bug #6445 |
if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { |
register_shutdown_function("_PEAR_call_destructors"); |
$GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; |
} |
$GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args); |
} |
|
492,7 → 515,7 |
* @see PEAR::setErrorHandling |
* @since PHP 4.0.5 |
*/ |
function raiseError($message = null, |
function &raiseError($message = null, |
$code = null, |
$mode = null, |
$options = null, |
537,9 → 560,11 |
$ec = 'PEAR_Error'; |
} |
if ($skipmsg) { |
return new $ec($code, $mode, $options, $userinfo); |
$a = &new $ec($code, $mode, $options, $userinfo); |
return $a; |
} else { |
return new $ec($message, $code, $mode, $options, $userinfo); |
$a = &new $ec($message, $code, $mode, $options, $userinfo); |
return $a; |
} |
} |
|
553,14 → 578,16 |
* @param string $message |
* |
*/ |
function throwError($message = null, |
function &throwError($message = null, |
$code = null, |
$userinfo = null) |
{ |
if (isset($this) && is_a($this, 'PEAR')) { |
return $this->raiseError($message, $code, null, null, $userinfo); |
$a = &$this->raiseError($message, $code, null, null, $userinfo); |
return $a; |
} else { |
return PEAR::raiseError($message, $code, null, null, $userinfo); |
$a = &PEAR::raiseError($message, $code, null, null, $userinfo); |
return $a; |
} |
} |
|
769,7 → 796,23 |
} |
|
// }}} |
|
/** |
* Standard PEAR error class for PHP 4 |
* |
* This class is supserseded by {@link PEAR_Exception} in PHP 5 |
* |
* @category pear |
* @package PEAR |
* @author Stig Bakken <ssb@php.net> |
* @author Tomas V.V. Cox <cox@idecnet.com> |
* @author Gregory Beaver <cellog@php.net> |
* @copyright 1997-2006 The PHP Group |
* @license http://www.php.net/license/3_0.txt PHP License 3.0 |
* @version Release: 1.4.11 |
* @link http://pear.php.net/manual/en/core.pear.pear-error.php |
* @see PEAR::raiseError(), PEAR::throwError() |
* @since Class available since PHP 4.0.2 |
*/ |
class PEAR_Error |
{ |
// {{{ properties |
859,8 → 902,8 |
} |
} |
if ($this->mode & PEAR_ERROR_EXCEPTION) { |
trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_ErrorStack for exceptions", E_USER_WARNING); |
eval('$e = new Exception($this->message, $this->code);$e->PEAR_Error = $this;throw($e);'); |
trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING); |
eval('$e = new Exception($this->message, $this->code);throw($e);'); |
} |
} |
|
975,6 → 1018,9 |
*/ |
function getBacktrace($frame = null) |
{ |
if (defined('PEAR_IGNORE_BACKTRACE')) { |
return null; |
} |
if ($frame === null) { |
return $this->backtrace; |
} |