2018-03-17, 07:48 AM
After upgrading our forum software from MyBB 1.8.14 to 1.8.15, a couple of members noticed that embedded YouTube videos were no longer playable, and displayed an error message when the play arrow was clicked.
Digging around a bit, I was able to resolve this problem by moving lines 500 to 509 of inc/class_parser.php to just prior to the call to $this->mycode_auto_url on line 453 of the same file. I am not very familiar with the MyBB code, so this may have unintended consequences, but so far everything seems to be OK. Have tested on a vanilla install and confirmed the same problem with same solution.
Emphasising my lack of familiarity with the code, here's (kind of roughly/vaguely and potentially imprecisely) why I think this solution works: the code to convert the video BBCode into an embedded video - the moved lines - expects a bare URL, whereas the code to auto-generate a link out of a bare URL - $this->mycode_auto_url - converts bare URLs to links. Shifting the former code so that it occurs prior to the latter code makes sure a bare URL is passed as expected.
Digging around a bit, I was able to resolve this problem by moving lines 500 to 509 of inc/class_parser.php to just prior to the call to $this->mycode_auto_url on line 453 of the same file. I am not very familiar with the MyBB code, so this may have unintended consequences, but so far everything seems to be OK. Have tested on a vanilla install and confirmed the same problem with same solution.
Emphasising my lack of familiarity with the code, here's (kind of roughly/vaguely and potentially imprecisely) why I think this solution works: the code to convert the video BBCode into an embedded video - the moved lines - expects a bare URL, whereas the code to auto-generate a link out of a bare URL - $this->mycode_auto_url - converts bare URLs to links. Shifting the former code so that it occurs prior to the latter code makes sure a bare URL is passed as expected.