/** * Start error logging. * * A call to this function will begin a new error logging context. Every call must have * a corresponding call to end(). */ public static function begin() { // Check whether the error access functions are present if (!function_exists('libxml_use_internal_errors')) { return; } if (count(self::$errorStack) === 0) { // No error logging is currently in progress. Initialize it. self::$xmlErrorState = libxml_use_internal_errors(TRUE); libxml_clear_errors(); } else { /* We have already started error logging. Append the current errors to the * list of errors in this level. */ self::addErrors(); } // Add a new level to the error stack self::$errorStack[] = array(); }