- if (preg_match("/{$this->_uniqHash}(.*?){$this->_uniqHash}/sx", $text, $m)) {
- if (!ini_get('display_errors') || (!$this->_prevDisplayErrors && ini_get('display_errors') == $this->_magic)) {
- // Display_errors:
- // 1. disabled manually after the library initialization, or
- // 2. was initially disabled and is not changed
- $text = str_replace($m[0], '', $text); // strip whole error message
- } else {
- $text = str_replace($this->_uniqHash, '', $text);
+ $wasFatalError = false;
+ if (preg_match_all("/{$this->_uniqHash}(.*?){$this->_uniqHash}/sx", $text, $m)) {
+ // Display_errors:
+ // 1. disabled manually after the library initialization, or
+ // 2. was initially disabled and is not changed
+ $needRemoveErrorMessages = !ini_get('display_errors') || (!$this->_prevDisplayErrors && ini_get('display_errors') == $this->_magic);
+ foreach ($m[0] as $error) {
+ if (preg_match('/\bFatal error(<.*?>)?:/i', $error)) {
+ $wasFatalError = true;
+ }
+ if ($needRemoveErrorMessages) {
+ $text = str_replace($error, '', $text); // strip the whole error message
+ } else {
+ $text = str_replace($this->_uniqHash, '', $text);
+ }