Skip to content

Commit

Permalink
Fix issue Attempt to modify property "links" on false #623
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Apr 1, 2024
1 parent ad7b27a commit 5586bbb
Showing 1 changed file with 36 additions and 34 deletions.
70 changes: 36 additions & 34 deletions framework/library/astroid/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,42 +418,44 @@ public static function getMenuLinks() {
$parentstack = array();
while ($i < count($type->links)) {
$link = $type->links[$i];
$tmp_link = new \stdClass();
$tmp_link->id = $link->value;
$tmp_link->text = $link->text;
$tmp_link->level = $link->level;
$tmp_link->type = $link->type;
$tmp_link->language = $link->language;
$tmp_link->links = array();
if ($tmp_link->level === 1) {
if (!empty($parentstack)) {
array_pop($parentstack);
if ($link->level !== 0) {
$tmp_link = new \stdClass();
$tmp_link->id = $link->value;
$tmp_link->text = $link->text;
$tmp_link->level = $link->level;
$tmp_link->type = $link->type;
$tmp_link->language = $link->language;
$tmp_link->links = array();
if ($tmp_link->level === 1) {
if (!empty($parentstack)) {
array_pop($parentstack);
}
$menutype->links[] = $tmp_link;
$parentstack[] = end($menutype->links);
} elseif ($prevlevel < $tmp_link->level) {
$parent = end($parentstack);
$parent->links[] = $tmp_link;
$parentstack[] = end($parent->links);
} elseif ($prevlevel == $tmp_link->level) {
if (!empty($parentstack)) {
array_pop($parentstack);
}
$parent = end($parentstack);
$parent->links[] = $tmp_link;
$parentstack[] = end($parent->links);
} else {
if (!empty($parentstack)) {
array_pop($parentstack);
}
if (!empty($parentstack)) {
array_pop($parentstack);
}
$parent = end($parentstack);
$parent->links[] = $tmp_link;
$parentstack[] = end($parent->links);
}
$menutype->links[] = $tmp_link;
$parentstack[] = end($menutype->links);
} elseif ($prevlevel < $tmp_link->level) {
$parent = end($parentstack);
$parent->links[] = $tmp_link;
$parentstack[] = end($parent->links);
} elseif ($prevlevel == $tmp_link->level) {
if (!empty($parentstack)) {
array_pop($parentstack);
}
$parent = end($parentstack);
$parent->links[] = $tmp_link;
$parentstack[] = end($parent->links);
} else {
if (!empty($parentstack)) {
array_pop($parentstack);
}
if (!empty($parentstack)) {
array_pop($parentstack);
}
$parent = end($parentstack);
$parent->links[] = $tmp_link;
$parentstack[] = end($parent->links);
$prevlevel = $tmp_link->level;
}
$prevlevel = $tmp_link->level;
$i++;
}
$menus[] = $menutype;
Expand Down

1 comment on commit 5586bbb

@RedesMexico
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done the 36 additions and 34 deletions of the Helper.php file, however the error remains the same.

Please sign in to comment.