Restore error reporting.

@param bool $clear
551167
public static function restore($clear = true)
    {
        if ($clear) {
            libxml_clear_errors();
        }

        libxml_use_internal_errors(self::$internalErrors);
        libxml_disable_entity_loader(self::$disableEntities);
    }
120473
public function restore()
    {
        $state = $this->store->get($this->id);

        if ($state == '') {
            return;
        }

        $data = @unserialize($state); // suppress unserializable error

        $this->restoreCheckType($data);
        $this->restoreCheckContents($data);
        $this->restoreCheckContentsType($data);

        $this->id = $data['id'];
        $this->items = [];

        foreach ($data['items'] as $itemArr) {
            $this->items[] = new CartItem($itemArr);
        }
    }
1298676
public function Results($Reset = FALSE) {
      if (!is_array($this->_ValidationResults) || $Reset)
         $this->_ValidationResults = array();
      
      return $this->_ValidationResults;
   }
935721
function reset($Ensure = false)
    {
        if ($Ensure !== true) {
            throw new \Exception ("You must pass true to this function, otherwise it won't work.");
            return;
        }

        $res = true;
        $res = $res and $this->Roles->resetAssignments ( true );
        $res = $res and $this->Roles->reset ( true );
		$res = $res and $this->Permissions->reset ( true );
		$res = $res and $this->Users->resetAssignments ( true );

		return $res;
	}
509660
public function restore()
    {
        if ($this->intStoredErrorLevel !== null) {
            if ($this->intStoredErrorLevel != -1) {
                error_reporting($this->intStoredErrorLevel);
            }
            restore_error_handler();
            $this->intStoredErrorLevel = null;
        }
    }
1046861
public function reset()
    {
        $this->added        = array();
        $this->deleted      = array();
        $this->replaced     = array();
        $this->ignored      = array();
        $this->isOverridden = false;
    }
1109500
public function flush(string $errorMessage): void
    {
        if (! $this->hasErrors()) {
            return;
        }

        $exception = $this->resolveException($errorMessage, $this);

        $this->clearErrors();

        throw $exception;
    }
815617
public function setQuiet($bool)
    {
        $this->quiet = $bool;
        if ($this->quiet) {
            $this->failonerror = false;
        }
    }
634356
private static function restoreIni()
    {
        foreach (self::$origIniSettings as $settingName => $settingValue) {
            switch ($settingName) {
                case 'error_reporting':
                    error_reporting($settingValue);
                    break;
                default:
                    ini_set($settingName, $settingValue);
            }
        }
    }
1309511
public function errors($reset = true)
    {
        $errors = $this->_errors;
        if ($reset) {
            $this->_errors = array();
        }

        return $errors;
    }
1125469
public function clearExpired()
    {
        if (! $this->enabled) {
            return;
        }
        $error = false;

        set_error_handler(function () use (&$error) {
            $error = true;
        }, E_WARNING);
        foreach (glob($this->getPath() . '/*.dat') as $file) {
            if (filemtime($file) < time()) {
                unlink($file);
            }
        }
        restore_error_handler();

        return ! $error;
    }
225319
public function logging( $log = false )
    {
        if ( $log !== false ) {
            if ( ! ini_get('log_errors') ) {
                ini_set('log_errors', true);
            }
            if ( ! ini_get('error_log') ) {
                ini_set('error_log', $log);
            }
        }
    }
5902
public function updateErrorBox($form, $result, $errors)
    {
        if (($form->isSubmitted() && $result !== true) || count($errors) > 0) {
            if (is_string($result)) {
                $this->addError(new Error(
                    Error::GENERAL_ERROR,
                    $result
                ));
            } else if (count($errors) > 0) {
                foreach ($errors as $error) {
                    $this->addError($error);
                }
            } else {
                $this->addError(new Error(
                    Error::UNKNOWN_ERROR,
                    ''
                ));
            }
        }
    }
1130080
protected function cleanup_error_handler()
    {
        restore_error_handler();

        if ($this->last_error !== null) {
            throw new \ErrorException(
                $this->last_error['errstr'],
                0,
                $this->last_error['errno'],
                $this->last_error['errfile'],
                $this->last_error['errline']
            );
        }
    }
533056
public function reset($default = true)
    {
        foreach($this->_data as $state) {
            $this->set($state->name, $default ? $state->default : null);
        }

        return $this;
    }
247984
protected function restoreErrorContext()
    {
        if (!Mage::getStoreConfigFlag('system/cron/enableErrorLog')) {
            return;
        }

        restore_error_handler();
        foreach ($this->errorSettingsBackup as $key => $value) {
            ini_set($key, $value);
        }
    }
309113
public function clear($result)
    {
        $invalid = array();
        $this->get_versions();

        if (isset($result['$cached'])) {
            foreach ((array)$result['$cached'] as $collection => $ver) {
                if (!isset($this->versions[$collection]) || $ver != $this->versions[$collection]) {
                    $this->put_version($collection, $ver);
                    $invalid[$collection] = true;
                    // Hack to make admin.settings affect other api.settings
                    // TODO: figure out how to do this on the server side
                    if ($collection === 'admin.settings') {
                        foreach ((array)$this->versions as $vcoll => $vv) {
                            if (preg_match('/\.settings$/', $vcoll)) {
                                $invalid[$vcoll] = true;
                            }
                        }
                    }
                }
            }
        }
        if (!empty($invalid)) {
            $this->clear_indexes($invalid);
        }
    }