/** * chechs, if the exception was allready thrown in the stack. * returns TRUE, if the exception was allready thrown. * * die recursion können wir an dieser stelle nicht über den backtrace prüfen. * bei ungecachten ausgaben wird bei typo3 mit int_script gearbeidet, * wodurch der stack auch bei mehrfacher rekursion immer gleich ist, * also die methode nur ein mal auftaucht. * * @param string $actionName * @param Exception $e * @param tx_rnbase_configurations $configurations * @return boolean */ private function checkExceptionRecursion($action, Exception $e, tx_rnbase_configurations $configurations, $type = 'error') { static $calls = 0, $trace = array(); // konfiguration für die maximale anzahl an durchläufen holen. $maxCalls = $configurations->getInt('recursionCheck.maxCalls'); $maxCalls = $maxCalls ? $maxCalls : 50; $maxThrows = $configurations->getInt('recursionCheck.maxThrows'); $maxThrows = $maxThrows ? $maxThrows : 1; // bei mehr als 50 exception calls, müssen wir davon ausgehen, // das ein kritischer fehler vorliegt if (++$calls > $maxCalls) { tx_rnbase_util_Logger::fatal('Too much recursion in "' . get_class($this) . '"' . ' That should not have happened.' . ' It looks as if there is a problem with a faulty configuration.', 'rn_base'); return TRUE; } // else // ansonsten setzen wir eine art stack aus action, errorcode und config zusammen. $code = $e->getCode(); // das typoscript wir bei jedem plugin aufruf neu generiert // und unterscheidet sich demnach. // wenn es zu einer rekursion kommt, ist das ts allerdings immer gleich! // (abgesehen von unaufgelösten referenzen) $configKey = md5(serialize($configurations->getConfigArray())); if (empty($trace[$type])) { $trace[$type] = array(); } if (empty($trace[$type][$action])) { $trace[$type][$action] = array(); } if (empty($trace[$type][$action][$code])) { $trace[$type][$action][$code] = array(); } if (empty($trace[$type][$action][$code][$configKey])) { $trace[$type][$action][$code][$configKey] = 0; } $trace[$type][$action][$code][$configKey]++; if (isset($trace[$type][$action][$code][$configKey]) && $trace[$type][$action][$code][$configKey] > $maxThrows) { return TRUE; } return FALSE; }