Skip to content

[3.0] Drop the placeholders when flushing the board move stack - #9435

Open
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/board-move-placeholder
Open

[3.0] Drop the placeholders when flushing the board move stack#9435
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/board-move-placeholder

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Admin → Boards and Categories → Move draws one link per place the board could go.
While walking the tree, the "after this board" link is held back on a stack until that
board's children have been listed. A board inside the subtree being moved has no links
of its own, so null goes onto the stack in its place, purely to keep the stack as deep
as the tree:

array_push($stack, !empty(…['move_links']) ? array_shift(…['move_links']) : null);

Popping already skips those (if (($temp = array_pop($stack)) != null)). Flushing what is
left at the end of the category does not, so the placeholders go straight into
move_links and reach the template:

<a href="" class="move_links" title=""><span class="main_icons select_" title=""></span></a>

plus two warnings per placeholder, because ManageBoards.template.php reads child_level
off the first entry and href off each one:

2: Trying to access array offset on null  —  ManageBoards.template.php:84
2: Trying to access array offset on null  —  ManageBoards.template.php:88
What it looks like

Moving a top-level board that has children is where it bites. On this tree:

General Discussion
    Child Board
        Grandchild
        Second Top Board
            Placeholder

"Move" on General Discussion offered four destinations, and three of them were the dead
links above — one real choice left on the page.

Checked

array_filter() on the stack before it is flushed. Every move= on that tree, before and
after:

board being moved links before of those, dead links after
General Discussion 4 3 1
Child Board 5 2 3
Grandchild 9 0 9
Second Top Board 8 1 7
Placeholder 9 0 9

Every surviving link is the same one it was before — only the empty ones go. Then actually
moved a board through the UI to confirm the links still work, and the error log stayed
empty across the lot.

Issues References (Fixes|Related|Closes)

n/a

Moving a board offers one link per place it could go. While walking the
tree the "after this board" link is held back on a stack until the
board's children have been listed, and a board inside the subtree being
moved has no links of its own, so null goes on the stack in its place
just to keep the stack as deep as the tree.

Popping already skips those. Flushing what is left at the end of the
category did not, so the nulls reached the template and came out as:

	<a href="" class="move_links" title=""><span class="main_icons select_"></span></a>

with two warnings behind them, since ManageBoards.template.php reads
child_level off the first entry and href off each one.

Moving a top-level board that has children is where it shows. On a forum
whose last board is nested three deep, "Move" on the first board offered
four destinations and three of them were these, leaving one real choice
on the page.

Signed-off-by: Mathias Alberts <mathiaspapealbert@hotmail.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 6 milestone Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants