Are you aware of any phpBB forum where posting stopped working recently?

You can talk about almost anything that you want to on this board.

Moderator: Moderators

Post Reply
nitro2k01
Posts: 252
Joined: Sat Aug 28, 2010 9:01 am

Are you aware of any phpBB forum where posting stopped working recently?

Post by nitro2k01 »

I recently wanted to check up on some old forums I'm a member of. I noticed that I couldn't post on the GBADev forum because the field for entering the message was non-functional. The issue turns out to be that a missing space in the textarea tag prevents it from rendering correctly:

Code: Select all

        \/- We need a space here between the tag name and attribute.
<textareaname="message" id="message" rows="15" cols="76" ...
The same kind of error happens in other places as well, for example in the last post field, where the space between "by" and the name is eaten, even though this doesn't affect functionality in this case.

I managed to still make a post by using dev tools and restoring the message field.

After that a few things happened:
  • I talked to Krom, who's going to look into upgrading phpBB
  • Dwedit (who's also active here) made a userscript for Tampermonkey which I improved slightly, included below.
  • I noticed that the same bug happened on Ben Hecks's forum as well.
The last point made me realize it probably wasn't a problem with GBADev specifically, but a problem with some combination of newer PHP versions and older phpBB versions. Since I assume people here are above average likelihood to participate in various forums, I'd be curious to know whether anyone is aware of any other forum which is affected by this same problem. If so it may be a catch 22 situation, since the only way you could tell the administrator about the issue might be through the forum itself, but that's not possible due to the bug... Then the userscript might be a simple way to relay the message.

Code: Select all

// ==UserScript==
// @name         Fix GBADEV forum
// @namespace    http://www.dwedit.org/
// @version      0.2
// @description  Fix invalid HTML tag for the posting textarea
// @author       Dwedit
// @author       nitro2k01
// @match        https://forum.gbadev.org/*
// @match        https://forums.benheck.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    //Code to replace an HTML tag name
    //https://stackoverflow.com/questions/15086677/replace-specific-tag-name-javascript
    function changeTag(el, newTagName = "div") { var newEl = document.createElement(newTagName); [...el.children].forEach(o => newEl.appendChild(o)); [...el.attributes].forEach(o => newEl.attributes.setNamedItem(o.cloneNode())); el.parentNode.replaceChild(newEl, el); return newEl; }
    var elements = document.getElementsByTagName("textareaname=\"message\"");
    if (elements !== undefined && elements.length > 0)
    {
        var element = elements[0];
        element.setAttribute("name","message");
        // Preserve the message for edit/preview. Trim the string to get rid of annoying whitespace at the end of the string.
        var message=element.innerHTML.trim();
        var newEl=changeTag(element, "textarea");
        newEl.innerHTML=message;
    }
})();
brizzo
Site Admin
Posts: 34
Joined: Mon Feb 03, 2014 1:08 am

Re: Are you aware of any phpBB forum where posting stopped working recently?

Post by brizzo »

Thanks for sharing this. Looking at those forums, they are both running phpBB 3.2.x which is for older, no longer supported versions of PHP. Applying updates to phpBB is honestly a major pain and why many forums end up out of date...

But I am unsure what would cause this issue for them; I cannot think of a reason why spaces would be removed from template files being processed.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Are you aware of any phpBB forum where posting stopped working recently?

Post by Dwedit »

Thanks for fixing my userscript! I couldn't think of a good way to fix the edit/preview function.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Post Reply