Support » Plugin: footnotes » Footnotes numbered incorrectly

  • ResolvedPlugin Author Rumperuu

    (@rumperuu)


    Expected Result

    Footnotes will be numbered based on their appearance in the post.

    Actual Result

    The footnotes are instead numbered 1, 5, 2, 3, 4. The correct footnote text is displayed on number hover, but the footnotes in the bottom are doubly misordered as 1, 3, 4, 5, 2.

    Steps to Replicate

    Bizarrely, the only time I’ve encountered this issue was when I was making a minimal working example for a previous bug report. The numbering works fine on all the real posts I’ve ever used footnotes on, but on this page (and, as far as I can tell, only on this page) they render incorrectly.

    The post HTML is as follows:

    
    This is a footnote.((This is footnote 1. Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.))
    
    This is a footnote.((This is footnote 2. Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.))
    
    This is a footnote.((This is footnote 3. Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.))
    
    This is a footnote.((This is footnote 4. Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.))
    
    This is a footnote.((This is footnote 5. Dicta quas esse enim aut tempore corporis nobis. Quaerat dolorem repellat quo qui quam ducimus mollitia nulla. Perferendis blanditiis voluptatem laudantium et ut ea illo veritatis.))
    

    Testing Performed

    • this happens on both Posts and Pages
    • this happens when I make a new Post using the same code
    • this is independent of whether the footnotes include any links
    • if the text of all the footnotes is the same and the ‘merge identical footnotes’ option is enabled, then the notes correctly merge but are still displayed in the text in the 1, 5, 2, 3, 4 order.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor pewgeuges

    (@pewgeuges)

    Hi @rumperuu,

    Thank you very much! You are a star. Thank you for the test page and the detailed bug report. This is a very nasty, incomprehensible (to me) bug in Footnotes that was unknown until now, at least to me but I don’t doubt that we’re all in the same position. I didn’t even suspect something like this to be possible, as I don’t see any way in the code how this malfunctioning could be generated.

    Trying to narrow the bug down, and suspecting like you that it could be a pattern-related problem, I’ve (quickly) randomized the content. Adding a footnote before made the bug disapppear, removing it made it reappear. So I’ve shortened the content to 3 foottnotes, where the bug still happens, always the last footnote as the second one. Then I noticed that the bug goes away if the first footnote is ‘short enough.’ This derived example identifies even ‘the letter that it takes adding or removing’ for the bug to happen or not:

    https://ibb.co/y50271C (with the bug)

    https://ibb.co/TwJ0jdb (without the bug)

    As already mentioned, due to the random text (meant to speed up the process) this test does not qualify for archiving, and these screenshots are only available for 1 week.

    All Footnotes users and we will be grateful if you can fix this bug that makes the plugin really unreliable, and add anything else like the parser needed for the URL wrap algorithm (your first topic). I’ll register you for commit access, and you are joining Pea (Patrizia Lutz) (@misfist) as a committer, and of course you are added to the contributors list (parsed from the readme, so updated on the WordPress platform with next release).

    Thank you and Welcome to developing the Footnotes plugin!

    • This reply was modified 8 months ago by pewgeuges.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    The bug was already in the last pre-existing v1.6.6. After a new test series, I started worrying that I introduced this bug. But trying v1.6.6, it produces the same bug except that the step length is 29 characters, while in current v2.5.3 it is 38 characters; depending on the length of the first footnote, the second footnote is moved down the list, one position every 38 characters in this example:

    https://ibb.co/RQCWgPQ
    https://ibb.co/1XnT73W
    https://ibb.co/18CzqDw
    https://ibb.co/Np4W7c1

    I suspect that the algorithm is not robust enough and needs to be rewritten. Pea @misfist is good at modularizing. If she had written the plugin sure it would work.

    Wondering why this bug had never ever come up before AFAIK, I now fear it went unnoticed, given the affected part is the numbering, while the footnotes are in the right place.

    But I never saw the numbering disturbed, even when the first footnote was pretty long.

    Thanks again Ben for discovering and bringing this up.

    I don’t understand how the bug happens. So I guess that attempting to rewrite the algorithm doesn’t make sense on my end…

    • This reply was modified 8 months ago by pewgeuges.
    • This reply was modified 8 months ago by pewgeuges.
    • This reply was modified 8 months ago by pewgeuges.
    Plugin Author Lol Zimmerli

    (@lolzim)

    I reproduced it:
    https://footnotes.lzi.ch/index.php/2021/02/08/test-1-5/

    Now I will try to find out the reason. KYIT.

    Plugin Contributor pewgeuges

    (@pewgeuges)

    @lolzim, @rumperuu,

    Now that the CSS issue is being settled I’m committed to help investigate the numbering bug. As mentioned, it depends on the length of the first footnote. The news is that it depends also on the length of the text preceding the first footnote.

    With a short text before the first footnote,the bug is there:

    https://ibb.co/pPzWXtM

    With a longer text, the bug goes away:

    https://ibb.co/vw7XtYS

    But so far that seems like all we know.

    Plugin Author Lol Zimmerli

    (@lolzim)

    Hi @rumperuu,

    It will be fixed in 2.5.5. Thanks for the report!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Footnotes numbered incorrectly’ is closed to new replies.