In pagelib.php in function set_pagelayout, there is debugging information which is extremely helpful to developers - otherwise if you call the function and it doesn't work, you never find out why.
Unfortunately the debugging information has been commented out. Is there a good reason for this, or would be it be possible to uncomment it?
Note: It would be even more helpful if the text also added 'Note: Constructing a Moodle form will set the page layout. Try moving this set call before any form constructor.'
Sam, assigning to you because I think this is your area; if you think this is a good change but you don't have time for it, I'm happy to make a patch and submit a PULL request, so assign back to me in that case.