[3.0] Load the SplitTopics template for the page that needs it - #9476
Merged
live627 merged 1 commit intoAug 11, 2026
Merged
Conversation
The ternary was inverted, so every HTML request got the Xml template and the ask/select sub-templates were never there - clicking Split Topic under a post answered "Unable to load the ask sub-template". Two more faults sat behind that one, which is why they went unnoticed: - num_messages comes back from COUNT(*) as a string and messages_per_page comes from modSettings, so PageIndex's typed int parameters rejected both and the select-posts screen was a 500. - $split2_first_msg and $split2_last_msg were never initialised. The second query returns nothing when the messages have already moved, which is what a resubmitted split looks like, and getMsgMemberID() then got null. That is exactly the case the sanity check below it was written to catch, so start them at 0 and let it. Signed-off-by: Mathias Papenbrock <mathiaspapealbert@hotmail.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Splitting a topic does not work at all on
release-3.0. Clicking Split Topic under any post gives "Unable to load the ask sub-template", because the ternary inTopicSplit::execute()is inverted:An HTML request has no
xml, so it loads Xml; the XMLHttp request loads SplitTopics. 2.1 hasif (!isset($_REQUEST['xml'])) loadTemplate('SplitTopics');, which is the other way round.Because nothing could get past that, two more faults were sitting behind it:
num_messagesarrives fromCOUNT(*)as a string, andmessages_per_pagecomes frommodSettings, so both were rejected byPageIndex::__construct()'s typedintparameters.Display.phpalready casts the same setting at its ownPageIndexcall.$split2_first_msg/$split2_last_msgare only assigned inside a loop over a query that returns nothing once the messages have moved to the new topic - which is what pressing Split a second time, or using the back button, looks like.Board::getMsgMemberID()then receivednull. The "No database changes yet, so let's double check" test a few lines further down exists to catch exactly this, so these now start at 0 and it does; the page is the intendedcant_find_messageserror instead of a fatal.How to test
On
release-3.0, open any topic with more than one post and click Split Topic in a post's More… menu.Verified on MySQL; the change is not SQL.
Issues References (Fixes|Related|Closes)
Found while sweeping the topic display for the #7933 split.