ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PEAR Class Reference
+ Inheritance diagram for PEAR:
+ Collaboration diagram for PEAR:

Public Member Functions

 PEAR ($error_class=null)
 Constructor.
 _PEAR ()
 Destructor (the emulated type of...).
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them.
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes.
 isError ($data, $code=null)
 Tell whether a value is a PEAR error.
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled.
 expectError ($code= '*')
 This method is used to tell which errors you expect to get.
 popExpect ()
 This method pops one element off the expected error codes stack.
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available.
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack.
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied.
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options.
 staticPushErrorHandling ($mode, $options=null)
 staticPopErrorHandling ()
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack.
 popErrorHandling ()
 Pop the last error handler used.
 loadExtension ($ext)
 OS independant PHP extension load.

Data Fields

 $_debug = false
 $_default_error_mode = null
 $_default_error_options = null
 $_default_error_handler = ''
 $_error_class = 'PEAR_Error'
 $_expected_errors = array()

Detailed Description

Definition at line 102 of file PEAR.php.

Member Function Documentation

PEAR::_checkDelExpect (   $error_code)

This method checks unsets an error code if available.

Parameters
mixederror code
Returns
bool true if the error code was unset, false otherwise private
Since
PHP 4.3.0

Definition at line 425 of file PEAR.php.

References $key.

Referenced by delExpect().

{
$deleted = false;
foreach ($this->_expected_errors AS $key => $error_array) {
if (in_array($error_code, $error_array)) {
unset($this->_expected_errors[$key][array_search($error_code, $error_array)]);
$deleted = true;
}
// clean up empty arrays
if (0 == count($this->_expected_errors[$key])) {
unset($this->_expected_errors[$key]);
}
}
return $deleted;
}

+ Here is the caller graph for this function:

PEAR::_PEAR ( )

Destructor (the emulated type of...).

Does nothing right now, but is included for forward compatibility, so subclass destructors should always call it.

See the note in the class desciption about output from destructors.

public

Returns
void

Definition at line 209 of file PEAR.php.

{
if ($this->_debug) {
printf("PEAR destructor called, class=%s\n", strtolower(get_class($this)));
}
}
PEAR::delExpect (   $error_code)

This method deletes all occurences of the specified element from the expected error codes stack.

Parameters
mixed$error_codeerror code that should be deleted
Returns
mixed list of error codes that were deleted or error public
Since
PHP 4.3.0

Definition at line 455 of file PEAR.php.

References $error, $key, _checkDelExpect(), elseif(), and raiseError().

{
$deleted = false;
if ((is_array($error_code) && (0 != count($error_code)))) {
// $error_code is a non-empty array here;
// we walk through it trying to unset all
// values
foreach($error_code as $key => $error) {
if ($this->_checkDelExpect($error)) {
$deleted = true;
} else {
$deleted = false;
}
}
return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
} elseif (!empty($error_code)) {
// $error_code comes alone, trying to unset it
if ($this->_checkDelExpect($error_code)) {
return true;
} else {
return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
}
} else {
// $error_code is empty
return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME
}
}

+ Here is the call graph for this function:

PEAR::expectError (   $code = '*')

This method is used to tell which errors you expect to get.

Expected errors are always returned with error mode PEAR_ERROR_RETURN. Expected error codes are stored in a stack, and this method pushes a new element onto it. The list of expected errors are in effect until they are popped off the stack with the popExpect() method.

Note that this method can not be called statically

Parameters
mixed$codea single error code or an array of error codes to expect
Returns
int the new depth of the "expected errors" stack public

Definition at line 390 of file PEAR.php.

References $_expected_errors.

Referenced by MDB2_Driver_oci8\nextID(), and MDB2_Driver_mysql\nextID().

{
if (is_array($code)) {
array_push($this->_expected_errors, $code);
} else {
array_push($this->_expected_errors, array($code));
}
return sizeof($this->_expected_errors);
}

+ Here is the caller graph for this function:

& PEAR::getStaticProperty (   $class,
  $var 
)

If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them.

Eg. in your method(s) do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); You MUST use a reference, or they will not persist!

public

Parameters
string$classThe calling classname, to prevent clashes
string$varThe variable to retrieve.
Returns
mixed A reference to the variable. If not set it will be auto initialised to NULL.

Definition at line 230 of file PEAR.php.

Referenced by _PEAR_call_destructors(), and PEAR_Error\PEAR_Error().

{
static $properties;
if (!isset($properties[$class])) {
$properties[$class] = array();
}
if (!array_key_exists($var, $properties[$class])) {
$properties[$class][$var] = null;
}
return $properties[$class][$var];
}

+ Here is the caller graph for this function:

PEAR::isError (   $data,
  $code = null 
)

Tell whether a value is a PEAR error.

Parameters
mixed$datathe value to test
int$codeif $data is an error object, return true only if $code is a string and $obj->getMessage() == $code or $code is an integer and $obj->getCode() == $code public
Returns
bool true if parameter is an error

Definition at line 279 of file PEAR.php.

References $data, and elseif().

Referenced by Base\__calcAbsoluteDeviation(), Base\__calcVariance(), MDB2_Driver_Common\__call(), ilBMFClient\__decodeResponse(), Base\__format(), ilBMFClient\__generate(), Base\__sumdiff(), MDB2_Driver_mysql\_affectedRows(), MDB2_Driver_oci8\_affectedRows(), MDB2_Driver_Datatype_Common\_baseConvertResult(), Spreadsheet_Excel_Writer_Parser\_condition(), Auth_Container_DB\_connect(), Auth_Container_MDB\_connect(), Auth_Container_MDB2\_connect(), Auth_Container_DBLite\_connect(), Spreadsheet_Excel_Writer_Parser\_convertRange2d(), Spreadsheet_Excel_Writer_Parser\_convertRange3d(), Spreadsheet_Excel_Writer_Parser\_convertRef2d(), Spreadsheet_Excel_Writer_Parser\_convertRef3d(), Log_mdb2\_createTable(), ilBMFBase\_decodeDIMEMessage(), MDB2_Driver_oci8\_doConnect(), MDB2_Driver_mysql\_doQuery(), MDB2_Driver_oci8\_doQuery(), MDB2_Driver_Common\_doQuery(), MDB2_Statement_oci8\_execute(), MDB2_Statement_mysql\_execute(), MDB2_Statement_Common\_execute(), Spreadsheet_Excel_Writer_Parser\_expression(), MDB2_Driver_Manager_Common\_fixIndexName(), MDB2_Driver_Manager_Common\_fixSequenceName(), Spreadsheet_Excel_Writer_Parser\_func(), MDB2_Driver_Datatype_Common\_getBLOBDeclaration(), MDB2_Driver_Datatype_Common\_getCLOBDeclaration(), MDB2_Result_oci8\_getColumnNames(), MDB2_Result_mysql\_getColumnNames(), MDB2_Driver_Manager_Common\_getCreateTableQuery(), MDB2_Driver_Datatype_Common\_getDeclaration(), MDB2_Driver_Datatype_Common\_getDeclarationOptions(), MDB2_Driver_Datatype_mysql\_getIntegerDeclaration(), MDB2_Driver_Datatype_Common\_getIntegerDeclaration(), Auth_Container_File\_load(), MDB2_Driver_Manager_oci8\_makeAutoincrement(), MDB2_Driver_Datatype_mysql\_mapNativeDatatype(), MDB2_Driver_Datatype_oci8\_mapNativeDatatype(), MDB2_Driver_Datatype_Common\_mapNativeDatatype(), ilBMFTransport_HTTP\_parseResponse(), Auth_Container_DB\_prepare(), Auth_Container_DBLite\_prepare(), Auth_Container_LDAP\_prepare(), Log_mdb2\_prepareStatement(), MDB2_Driver_Datatype_Common\_quoteDate(), MDB2_Driver_Datatype_Common\_quoteLOB(), MDB2_Driver_Datatype_Common\_quoteText(), MDB2_Driver_Datatype_Common\_quoteTime(), MDB2_Driver_Datatype_Common\_quoteTimestamp(), MDB2_Driver_Datatype_Common\_readFile(), MDB2_Driver_Datatype_oci8\_readLOB(), MDB2_Driver_Datatype_oci8\_retrieveLOB(), Spreadsheet_Excel_Writer_Workbook\_storeOLEFile(), Spreadsheet_Excel_Writer_Workbook\_storeWorkbook(), Spreadsheet_Excel_Writer_Parser\_term(), MDB2_Driver_Common\_wrapResult(), Base\absDev(), Auth_Container_File\addUser(), MDB2_Driver_Manager_mysql\alterTable(), MDB2_Driver_Manager_Common\alterTable(), MDB2_Extended\autoExecute(), MDB2_Extended\autoPrepare(), MDB2_Driver_mysql\beginTransaction(), MDB2_Statement_Common\bindParamArray(), MDB2_Statement_Common\bindValueArray(), MDB2_Extended\buildManipSQL(), ilBMFClient\call(), Base\center(), Auth_Container_File\changePassword(), MDB2_Driver_Datatype_Common\checkResultTypes(), Log_mail\close(), Spreadsheet_Excel_Writer_Workbook\close(), Base\coeffOfVariation(), MDB2_Driver_oci8\commit(), MDB2_Driver_mysql\commit(), MDB2_Driver_Datatype_Common\compareDefinition(), MDB2_Driver_Common\compareDefinition(), MDB2_Driver_Common\completeNestedTransaction(), MDB2_Driver_mysql\connect(), MDB2_Driver_oci8\connect(), MDB2\connect(), MDB2_Driver_Datatype_Common\convertResult(), MDB2_Driver_Datatype_Common\convertResultRow(), MDB2_Driver_Manager_Common\createConstraint(), MDB2_Driver_Manager_mysql\createConstraint(), MDB2_Driver_Manager_oci8\createDatabase(), MDB2_Driver_Manager_mysql\createDatabase(), MDB2_Driver_Manager_Common\createDatabase(), MDB2_Driver_Manager_mysql\createIndex(), MDB2_Driver_Manager_Common\createIndex(), MDB2_Driver_Manager_Common\createSequence(), MDB2_Driver_Manager_mysql\createSequence(), MDB2_Driver_Manager_mysql\createTable(), MDB2_Driver_Manager_Common\createTable(), MDB2_Iterator\current(), MDB2_Driver_Manager_Common\dropConstraint(), MDB2_Driver_Manager_mysql\dropConstraint(), MDB2_Driver_Manager_mysql\dropDatabase(), MDB2_Driver_Manager_oci8\dropDatabase(), MDB2_Driver_Manager_Common\dropDatabase(), MDB2_Driver_Manager_mysql\dropIndex(), MDB2_Driver_Manager_Common\dropIndex(), MDB2_Driver_Manager_Common\dropSequence(), MDB2_Driver_Manager_mysql\dropSequence(), MDB2_Driver_Manager_Common\dropTable(), MDB2\errorMessage(), HTML_Template_IT\errorMessage(), MDB2_Driver_mysql\escape(), MDB2_Driver_Common\exec(), MDB2_Extended\execParam(), MDB2_Statement_Common\execute(), MDB2_Extended\executeMultiple(), MDB2_Driver_Function_oci8\executeStoredProc(), MDB2_Driver_Function_mysql\executeStoredProc(), MDB2_Driver_Function_Common\executeStoredProc(), MDB2\factory(), MDB2_Result_Common\fetchAll(), MDB2_Result_Common\fetchCol(), ilAuthContainerMultiple\fetchData(), ilAuthContainerLDAP\fetchData(), Auth_Container_RADIUS\fetchData(), Auth_Container_Multiple\fetchData(), Auth_Container_SOAP\fetchData(), Auth_Container_SOAP5\fetchData(), Auth_Container_MDB\fetchData(), Auth_Container_MDB2\fetchData(), MDB2_Result_Common\fetchOne(), MDB2_Result_oci8\fetchRow(), MDB2_Result_mysql\fetchRow(), MDB2_BufferedResult_oci8\fetchRow(), MDB2_Statement_mysql\free(), Base\geometricMean(), ilBMFWSDL_Cache\get(), MDB2_Extended\getAfterID(), MDB2_Extended\getAll(), MDB2_Extended\getAssoc(), MDB2_Extended\getBeforeID(), MDB2_Extended\getCol(), MDB2_Result_Common\getColumnNames(), MDB2_Driver_Common\getConnection(), MDB2_Driver_Datatype_Common\getDeclaration(), MDB2_Driver_Common\getDeclaration(), MDB2_Driver_Manager_Common\getFieldDeclarationList(), MDB2_Extended\getOne(), MDB2_Extended\getRow(), MDB2_Driver_Reverse_Common\getSequenceDefinition(), MDB2_Driver_Reverse_oci8\getSequenceDefinition(), MDB2_Driver_mysql\getServerVersion(), MDB2_Driver_oci8\getServerVersion(), MDB2_Driver_Reverse_Common\getTableConstraintDefinition(), MDB2_Driver_Reverse_mysql\getTableConstraintDefinition(), MDB2_Driver_Reverse_oci8\getTableConstraintDefinition(), MDB2_Driver_Reverse_oci8\getTableFieldDefinition(), MDB2_Driver_Reverse_mysql\getTableFieldDefinition(), MDB2_Driver_Reverse_Common\getTableFieldDefinition(), MDB2_Driver_Reverse_Common\getTableIndexDefinition(), MDB2_Driver_Reverse_mysql\getTableIndexDefinition(), MDB2_Driver_Reverse_oci8\getTableIndexDefinition(), MDB2_Driver_Reverse_Common\getTriggerDefinition(), MDB2_Driver_Reverse_mysql\getTriggerDefinition(), MDB2_Driver_Reverse_oci8\getTriggerDefinition(), MDB2_Driver_Datatype_oci8\getTypeDeclaration(), MDB2_Driver_Datatype_mysql\getTypeDeclaration(), MDB2_Driver_Datatype_Common\getTypeDeclaration(), MDB2_Driver_Datatype_Common\getValidTypes(), MDB2_Driver_Function_Common\guid(), Base\harmonicMean(), ilBMFWSDL\ilBMFWSDL(), Base\interquartileMean(), Base\interquartileRange(), ilDB\isDbError(), Base\kurtosis(), MDB2_Extended\limitQuery(), MDB2_Driver_Manager_mysql\listDatabases(), MDB2_Driver_Manager_Common\listDatabases(), MDB2_Driver_Manager_mysql\listFunctions(), MDB2_Driver_Manager_Common\listFunctions(), MDB2_Driver_Manager_Common\listSequences(), MDB2_Driver_Manager_mysql\listSequences(), MDB2_Driver_Manager_Common\listTableConstraints(), MDB2_Driver_Manager_mysql\listTableConstraints(), MDB2_Driver_Manager_mysql\listTableFields(), MDB2_Driver_Manager_Common\listTableFields(), MDB2_Driver_Manager_mysql\listTableIndexes(), MDB2_Driver_Manager_Common\listTableIndexes(), MDB2_Driver_Manager_mysql\listTables(), MDB2_Driver_Manager_Common\listTables(), MDB2_Driver_Manager_mysql\listTableTriggers(), MDB2_Driver_Manager_Common\listTableTriggers(), MDB2_Driver_Manager_Common\listTableViews(), Auth_Container_File\listUsers(), MDB2_Driver_Manager_mysql\listUsers(), MDB2_Driver_Manager_Common\listUsers(), MDB2_Driver_Manager_Common\listViews(), MDB2_Driver_Manager_mysql\listViews(), MDB2_Driver_Common\loadModule(), ilDAVLocks\lockWithoutCheckingObj(), Log_mdb2\log(), MDB2_Driver_Datatype_Common\mapNativeDatatype(), MDB2_Driver_Datatype_Common\mapPrepareDatatype(), MDB2_Driver_Datatype_mysql\matchPattern(), MDB2_Driver_Datatype_Common\matchPattern(), Base\mean(), Base\median(), Base\midrange(), MDB2_Driver_oci8\nextID(), MDB2_Driver_mysql\nextID(), Log_mdb2\open(), ilBMFWSDL_Parser\parse(), Spreadsheet_Excel_Writer_Parser\parse(), MDB2_Driver_Datatype_oci8\patternEscapeString(), Base\percentile(), MDB2_Driver_oci8\prepare(), MDB2_Driver_mysql\prepare(), MDB2_Driver_Common\prepare(), Base\product(), Base\quartileDeviation(), Base\quartiles(), Base\quartileSkewnessCoefficient(), Base\quartileVariationCoefficient(), MDB2_Driver_Common\query(), MDB2_Driver_Datatype_Common\quote(), MDB2_Driver_Common\quote(), MDB2_Driver_Common\raiseError(), Base\range(), OLE\read(), Auth_Container_File\removeUser(), MDB2_Driver_mysql\replace(), MDB2_Driver_Common\replace(), MDB2_Driver_oci8\rollback(), MDB2_Driver_mysql\rollback(), Base\sampleCentralMoment(), Base\sampleRawMoment(), ilObjTest\saveManualFeedback(), ilObjTest\saveToDb(), ilBMFTransport_SMTP\send(), MDB2_Driver_mysql\setCharset(), Spreadsheet_Excel_Writer_Validator\setFormula1(), Spreadsheet_Excel_Writer_Validator\setFormula2(), MDB2\setOptions(), HTML_Template_IT\setOptions(), MDB2_Result_Common\setResultTypes(), Base\skewness(), SOAP_Attachment\SOAP_Attachment(), MDB2_Driver_oci8\standaloneExec(), MDB2_Driver_oci8\standaloneQuery(), MDB2_Driver_Common\standaloneQuery(), Base\stdErrorOfMean(), Base\stDev(), Base\stDevWithMean(), Base\studentize(), MDB2_Driver_Common\subSelect(), Base\sum(), Base\sum2(), MDB2_Driver_Reverse_Common\tableInfo(), MDB2_Driver_Reverse_mysql\tableInfo(), MDB2_Driver_Reverse_oci8\tableInfo(), Spreadsheet_Excel_Writer_Parser\toReversePolish(), MDB2_BufferedResult_mysql\valid(), Base\variance(), Spreadsheet_Excel_Writer_Worksheet\writeFormula(), MDB2_Driver_Datatype_oci8\writeLOBToFile(), and MDB2_Driver_Datatype_Common\writeLOBToFile().

{
if (is_a($data, 'PEAR_Error')) {
if (is_null($code)) {
return true;
} elseif (is_string($code)) {
return $data->getMessage() == $code;
} else {
return $data->getCode() == $code;
}
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PEAR::loadExtension (   $ext)

OS independant PHP extension load.

Remember to take care on the correct extension name for case sensitive OSes.

Parameters
string$extThe extension name
Returns
bool Success or not on the dl() call

Definition at line 745 of file PEAR.php.

References elseif().

Referenced by MDB2_Driver_oci8\_doConnect(), Auth_Container_SAP\Auth_Container_SAP(), and MDB2_Driver_mysql\connect().

{
if (!extension_loaded($ext)) {
// if either returns true dl() will produce a FATAL error, stop that
if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
return false;
}
if (OS_WINDOWS) {
$suffix = '.dll';
} elseif (PHP_OS == 'HP-UX') {
$suffix = '.sl';
} elseif (PHP_OS == 'AIX') {
$suffix = '.a';
} elseif (PHP_OS == 'OSX') {
$suffix = '.bundle';
} else {
$suffix = '.so';
}
return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PEAR::PEAR (   $error_class = null)

Constructor.

Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists.

Parameters
string$error_class(optional) which class to use for error objects, defaults to PEAR_Error. public
Returns
void

Definition at line 170 of file PEAR.php.

References $GLOBALS.

Referenced by Auth_RADIUS\Auth_RADIUS(), ilBMFBase_Object\ilBMFBase_Object(), ilErrorHandling\ilErrorHandling(), ilSetup\ilSetup(), and ilValidator\ilValidator().

{
$classname = strtolower(get_class($this));
if ($this->_debug) {
print "PEAR constructor called, class=$classname\n";
}
if ($error_class !== null) {
$this->_error_class = $error_class;
}
while ($classname && strcasecmp($classname, "pear")) {
$destructor = "_$classname";
if (method_exists($this, $destructor)) {
global $_PEAR_destructor_object_list;
$_PEAR_destructor_object_list[] = &$this;
if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
register_shutdown_function("_PEAR_call_destructors");
$GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
}
break;
} else {
$classname = get_parent_class($classname);
}
}
}

+ Here is the caller graph for this function:

PEAR::popErrorHandling ( )

Pop the last error handler used.

Returns
bool Always true
See Also
PEAR::pushErrorHandling

Definition at line 721 of file PEAR.php.

References $GLOBALS, and setErrorHandling().

{
$stack = &$GLOBALS['_PEAR_error_handler_stack'];
array_pop($stack);
list($mode, $options) = $stack[sizeof($stack) - 1];
array_pop($stack);
if (isset($this) && is_a($this, 'PEAR')) {
$this->setErrorHandling($mode, $options);
} else {
PEAR::setErrorHandling($mode, $options);
}
return true;
}

+ Here is the call graph for this function:

PEAR::popExpect ( )

This method pops one element off the expected error codes stack.

Returns
array the list of error codes that were popped

Definition at line 409 of file PEAR.php.

Referenced by MDB2_Driver_oci8\nextID(), and MDB2_Driver_mysql\nextID().

{
return array_pop($this->_expected_errors);
}

+ Here is the caller graph for this function:

PEAR::pushErrorHandling (   $mode,
  $options = null 
)

Push a new error handler on top of the error handler options stack.

With this you can easily override the actual error handler for some code and restore it later with popErrorHandling.

Parameters
mixed$mode(same as setErrorHandling)
mixed$options(same as setErrorHandling)
Returns
bool Always true
See Also
PEAR::setErrorHandling

Definition at line 690 of file PEAR.php.

References $_default_error_mode, $_default_error_options, $GLOBALS, and setErrorHandling().

{
$stack = &$GLOBALS['_PEAR_error_handler_stack'];
if (isset($this) && is_a($this, 'PEAR')) {
} else {
$def_mode = &$GLOBALS['_PEAR_default_error_mode'];
$def_options = &$GLOBALS['_PEAR_default_error_options'];
}
$stack[] = array($def_mode, $def_options);
if (isset($this) && is_a($this, 'PEAR')) {
$this->setErrorHandling($mode, $options);
} else {
PEAR::setErrorHandling($mode, $options);
}
$stack[] = array($mode, $options);
return true;
}

+ Here is the call graph for this function:

& PEAR::raiseError (   $message = null,
  $code = null,
  $mode = null,
  $options = null,
  $userinfo = null,
  $error_class = null,
  $skipmsg = false 
)

This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied.

If the $mode and $options parameters are not specified, the object's defaults are used.

Parameters
mixed$messagea text error message or a PEAR error object
int$codea numeric error code (it is up to your class to define these if you want to use codes)
int$modeOne of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
mixed$optionsIf $mode is PEAR_ERROR_TRIGGER, this parameter specifies the PHP-internal error level (one of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). If $mode is PEAR_ERROR_CALLBACK, this parameter specifies the callback function or method. In other error modes this parameter is ignored.
string$userinfoIf you need to pass along for example debug information, this parameter is meant for that.
string$error_classThe returned error object will be instantiated from this class, if specified.
bool$skipmsgIf true, raiseError will only pass error codes, the error message parameter will be dropped.

public

Returns
object a PEAR error object
See Also
PEAR::setErrorHandling
Since
PHP 4.0.5

Definition at line 524 of file PEAR.php.

References $_default_error_mode, $_default_error_options, $_error_class, $GLOBALS, elseif(), and PEAR_ERROR_RETURN.

Referenced by Base\__calcAbsoluteDeviation(), Base\__calcVariance(), Base\__sumabsdev(), Base\__sumdiff(), Spreadsheet_Excel_Writer_Parser\_cellToPackedRowcol(), Auth_Container_IMAP\_checkServer(), Auth_Container_KADM5\_checkServer(), Auth_Container_MDB\_connect(), Auth_Container_MDB2\_connect(), Auth_Container_DB\_connect(), Auth_Container_DBLite\_connect(), Auth_Container_LDAP\_connect(), Spreadsheet_Excel_Writer_Parser\_convert(), Spreadsheet_Excel_Writer_Parser\_convertRange2d(), Spreadsheet_Excel_Writer_Parser\_convertRange3d(), Spreadsheet_Excel_Writer_Parser\_convertRef2d(), Spreadsheet_Excel_Writer_Parser\_convertRef3d(), Spreadsheet_Excel_Writer_Parser\_convertString(), Spreadsheet_Excel_Writer_Parser\_fact(), SOAP_Attachment\_file2str(), Spreadsheet_Excel_Writer_Parser\_func(), Auth_Container_LDAP\_getBaseDN(), Spreadsheet_Excel_Writer_Parser\_getRefIndex(), Spreadsheet_Excel_Writer_Parser\_packExtRef(), Spreadsheet_Excel_Writer_Parser\_rangeToPackedRange(), OLE\_readPpsWks(), Spreadsheet_Excel_Writer_BIFFwriter\_setByteOrder(), Spreadsheet_Excel_Writer_Workbook\_storeOLEFile(), Spreadsheet_Excel_Writer_Workbook\_storeWorkbook(), Spreadsheet_Excel_Writer_Worksheet\_substituteCellref(), Base\_validate(), Auth_Container_SOAP5\_validateOptions(), Auth_Container_MDB2\addUser(), Auth_Container_MDB\addUser(), Auth_Container_DB\addUser(), Spreadsheet_Excel_Writer_Workbook\addWorksheet(), Auth_HTTP\assignData(), Auth_Container_Array\Auth_Container_Array(), Auth_Container_DB\Auth_Container_DB(), Auth_Container_DBLite\Auth_Container_DBLite(), Auth_Container_IMAP\Auth_Container_IMAP(), Auth_Container_KADM5\Auth_Container_KADM5(), Auth_Container_LDAP\Auth_Container_LDAP(), Auth_Container_MDB\Auth_Container_MDB(), Auth_Container_MDB2\Auth_Container_MDB2(), Auth_Container_Multiple\Auth_Container_Multiple(), Auth_Container_Pear\Auth_Container_Pear(), Auth_Container_RADIUS\Auth_Container_RADIUS(), Auth_Container_SAP\Auth_Container_SAP(), Auth_Container_SMBPasswd\Auth_Container_SMBPasswd(), Auth_Container_vpopmail\Auth_Container_vpopmail(), Base\calc(), Auth_Container_MDB2\changePassword(), Auth_Container_MDB\changePassword(), Auth_Container_DB\changePassword(), Auth_Container_LDAP\checkGroup(), Spreadsheet_Excel_Writer_Workbook\close(), Base\coeffOfVariation(), Net_Socket\connect(), Base\count(), delExpect(), Net_Socket\disconnect(), Net_Socket\enableCrypto(), Auth_Container_Vpopmaild\fetchData(), Auth_Container_SAP\fetchData(), Auth_Container_Pear\fetchData(), Auth_Container_SOAP5\fetchData(), Auth_Container_DBLite\fetchData(), Auth_Container_MDB\fetchData(), Auth_Container_MDB2\fetchData(), Auth_Container_DB\fetchData(), Auth_Container_LDAP\fetchData(), HTML_Template_IT\findBlocks(), Base\frequency(), Base\geometricMean(), HTML_Template_IT\get(), Base\getData(), HTML_Template_IT\getFile(), Net_Socket\gets(), Net_Socket\getStatus(), Base\harmonicMean(), OLE_PPS_File\init(), Base\interquartileMean(), Auth_Container_MDB2\listUsers(), Auth_Container_MDB\listUsers(), Auth_Container_DB\listUsers(), Auth_HTTP\login(), Base\max(), Base\median(), Base\min(), Base\mode(), HTML_Template_IT\parse(), Base\productN(), ilDB\raisePearError(), OLE\read(), Net_Socket\read(), Net_Socket\readAll(), Net_Socket\readByte(), Net_Socket\readInt(), Net_Socket\readIPAddress(), Net_Socket\readLine(), Net_Socket\readString(), Net_Socket\readWord(), Auth_Container_MDB2\removeUser(), Auth_Container_MDB\removeUser(), Auth_Container_DB\removeUser(), Base\sampleCentralMoment(), Base\sampleRawMoment(), OLE_PPS_Root\save(), Net_Socket\select(), Auth_RADIUS\send(), Net_Socket\setBlocking(), HTML_Template_IT\setCurrentBlock(), Spreadsheet_Excel_Writer_Workbook\setCustomColor(), Base\setData(), Base\setNullOption(), HTML_Template_IT\setOption(), Spreadsheet_Excel_Writer_Worksheet\setPrintScale(), Spreadsheet_Excel_Writer_Format\setTextRotation(), Net_Socket\setTimeout(), Net_Socket\setWriteBuffer(), Spreadsheet_Excel_Writer_Worksheet\setZoom(), SOAP_Attachment\SOAP_Attachment(), Base\studentize(), Base\sumN(), throwError(), HTML_Template_IT\touchBlock(), ilSetup\updateNewClient(), Net_Socket\write(), and Net_Socket\writeLine().

{
// The error is yet a PEAR error object
if (is_object($message)) {
$code = $message->getCode();
$userinfo = $message->getUserInfo();
$error_class = $message->getType();
$message->error_message_prefix = '';
$message = $message->getMessage();
}
if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
if ($exp[0] == "*" ||
(is_int(reset($exp)) && in_array($code, $exp)) ||
(is_string(reset($exp)) && in_array($message, $exp))) {
}
}
// No mode given, try global ones
if ($mode === null) {
// Class error handler
if (isset($this) && isset($this->_default_error_mode)) {
// Global error handler
} elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
$mode = $GLOBALS['_PEAR_default_error_mode'];
$options = $GLOBALS['_PEAR_default_error_options'];
}
}
if ($error_class !== null) {
$ec = $error_class;
} elseif (isset($this) && isset($this->_error_class)) {
} else {
$ec = 'PEAR_Error';
}
if (intval(PHP_VERSION) < 5) {
// little non-eval hack to fix bug #12147
include 'PEAR/FixPHP5PEARWarnings.php';
return $a;
}
if ($skipmsg) {
$a = new $ec($code, $mode, $options, $userinfo);
} else {
$a = new $ec($message, $code, $mode, $options, $userinfo);
}
return $a;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PEAR::registerShutdownFunc (   $func,
  $args = array() 
)

Use this function to register a shutdown method for static classes.

public

Parameters
mixed$funcThe function name (or array of class/method) to call
mixed$argsThe arguments to pass to the function
Returns
void

Definition at line 254 of file PEAR.php.

References $GLOBALS.

{
// 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);
}
PEAR::setErrorHandling (   $mode = null,
  $options = null 
)

Sets how errors generated by this object should be handled.

Can be invoked both in objects and statically. If called statically, setErrorHandling sets the default behaviour for all PEAR objects. If called in an object, setErrorHandling sets the default behaviour for that object.

Parameters
int$modeOne of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
mixed$optionsWhen $mode is PEAR_ERROR_TRIGGER, this is the error level (one of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).

When $mode is PEAR_ERROR_CALLBACK, this parameter is expected to be the callback function or method. A callback function is a string with the name of the function, a callback method is an array of two elements: the element at index 0 is the object, and the element at index 1 is the name of the method to call in the object.

When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is a printf format string used when printing the error message.

public

Returns
void
See Also
PEAR_ERROR_RETURN
PEAR_ERROR_PRINT
PEAR_ERROR_TRIGGER
PEAR_ERROR_DIE
PEAR_ERROR_CALLBACK
PEAR_ERROR_EXCEPTION
Since
PHP 4.0.5

Definition at line 335 of file PEAR.php.

References $_default_error_mode, $_default_error_options, $GLOBALS, PEAR_ERROR_CALLBACK, PEAR_ERROR_DIE, PEAR_ERROR_EXCEPTION, PEAR_ERROR_PRINT, PEAR_ERROR_RETURN, and PEAR_ERROR_TRIGGER.

Referenced by ilDB\connect(), ilDB\connectHost(), ilSetup\ilSetup(), ilValidator\ilValidator(), ilInitialisation\initILIAS(), ilUtil\is_email(), ilUnitUtil\performInitialisation(), popErrorHandling(), and pushErrorHandling().

{
if (isset($this) && is_a($this, 'PEAR')) {
} else {
$setmode = &$GLOBALS['_PEAR_default_error_mode'];
$setoptions = &$GLOBALS['_PEAR_default_error_options'];
}
switch ($mode) {
case null:
$setmode = $mode;
$setoptions = $options;
break;
$setmode = $mode;
// class/object method callback
if (is_callable($options)) {
$setoptions = $options;
} else {
trigger_error("invalid error callback", E_USER_WARNING);
}
break;
default:
trigger_error("invalid error mode", E_USER_WARNING);
break;
}
}

+ Here is the caller graph for this function:

PEAR::staticPopErrorHandling ( )

Definition at line 640 of file PEAR.php.

References $GLOBALS, PEAR_ERROR_CALLBACK, PEAR_ERROR_DIE, PEAR_ERROR_EXCEPTION, PEAR_ERROR_PRINT, PEAR_ERROR_RETURN, and PEAR_ERROR_TRIGGER.

{
$stack = &$GLOBALS['_PEAR_error_handler_stack'];
$setmode = &$GLOBALS['_PEAR_default_error_mode'];
$setoptions = &$GLOBALS['_PEAR_default_error_options'];
array_pop($stack);
list($mode, $options) = $stack[sizeof($stack) - 1];
array_pop($stack);
switch ($mode) {
case null:
$setmode = $mode;
$setoptions = $options;
break;
$setmode = $mode;
// class/object method callback
if (is_callable($options)) {
$setoptions = $options;
} else {
trigger_error("invalid error callback", E_USER_WARNING);
}
break;
default:
trigger_error("invalid error mode", E_USER_WARNING);
break;
}
return true;
}
PEAR::staticPushErrorHandling (   $mode,
  $options = null 
)

Definition at line 605 of file PEAR.php.

References $GLOBALS, PEAR_ERROR_CALLBACK, PEAR_ERROR_DIE, PEAR_ERROR_EXCEPTION, PEAR_ERROR_PRINT, PEAR_ERROR_RETURN, and PEAR_ERROR_TRIGGER.

{
$stack = &$GLOBALS['_PEAR_error_handler_stack'];
$def_mode = &$GLOBALS['_PEAR_default_error_mode'];
$def_options = &$GLOBALS['_PEAR_default_error_options'];
$stack[] = array($def_mode, $def_options);
switch ($mode) {
case null:
$def_mode = $mode;
$def_options = $options;
break;
$def_mode = $mode;
// class/object method callback
if (is_callable($options)) {
$def_options = $options;
} else {
trigger_error("invalid error callback", E_USER_WARNING);
}
break;
default:
trigger_error("invalid error mode", E_USER_WARNING);
break;
}
$stack[] = array($mode, $options);
return true;
}
& PEAR::throwError (   $message = null,
  $code = null,
  $userinfo = null 
)

Simpler form of raiseError with fewer options.

In most cases message, code and userinfo are enough.

Parameters
string$message

Definition at line 591 of file PEAR.php.

References raiseError().

Referenced by Auth\Auth(), ilValidator\isModeEnabled(), ilValidator\purgeObjects(), ilValidator\removeInvalidChilds(), ilValidator\removeInvalidReferences(), ilValidator\removeInvalidRolefolders(), ilValidator\restoreDeletedObjects(), ilValidator\restoreMissingObjects(), ilValidator\restoreReference(), ilValidator\restoreSubTrees(), ilValidator\restoreTrash(), ilValidator\restoreUnboundObjects(), and ilValidator\setMode().

{
if (isset($this) && is_a($this, 'PEAR')) {
$a = &$this->raiseError($message, $code, null, null, $userinfo);
return $a;
} else {
$a = &PEAR::raiseError($message, $code, null, null, $userinfo);
return $a;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

PEAR::$_debug = false

Definition at line 112 of file PEAR.php.

PEAR::$_default_error_handler = ''

Definition at line 138 of file PEAR.php.

PEAR::$_default_error_mode = null
PEAR::$_default_error_options = null
PEAR::$_error_class = 'PEAR_Error'

Definition at line 146 of file PEAR.php.

Referenced by raiseError().

PEAR::$_expected_errors = array()

Definition at line 154 of file PEAR.php.

Referenced by expectError().


The documentation for this class was generated from the following file: