Skip to content

Commit

Permalink
Workaround for trace infinity loop in exception handling
Browse files Browse the repository at this point in the history
I copied the workaround from macopedia#54 because the pr is not yet splitted and i needed the functionality.
  • Loading branch information
marvinhinz authored Dec 19, 2019
1 parent 3261a0c commit 101afb8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions magmi/inc/magmi_engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,11 @@ public function getExceptionTrace($tk, &$traces)
{
$this->_excid++;
$trstr = "";
//FIXME: infinity loop in M2
//todo: improve infinity loop handling in M2
$counter = 0;
foreach ($traces as $trace) {
if (isset($trace["file"])) {
$fname = str_replace(dirname(dirname(__FILE__)), "", $trace["file"]);
$fname = str_replace(dirname(__DIR__), "", $trace["file"]);
$trstr .= $fname . ":" . (isset($trace["line"]) ? $trace["line"] : "?") . " - ";
if (isset($trace["class"])) {
$trstr .= $trace["class"] . "->";
Expand All @@ -407,6 +408,10 @@ public function getExceptionTrace($tk, &$traces)
$trstr .= "\n";
}
}
// simple max trace depth fix
if (++$counter % 20) {
break;
}
}
if (!isset($this->_exceptions[$tk])) {
$this->_exceptions[$tk] = array(0,$this->_excid);
Expand Down

0 comments on commit 101afb8

Please sign in to comment.