Skip to content

First footnote displays as a black line with no number #2634

@jacksleight

Description

@jacksleight

Describe the bug and add attachments

When adding footnotes the first one always displays as a black line with no number in the resulting OOXML document.

This is definitely the footnote and not a duplication of the short dividing line above it, if you open the document in Word and then delete the footnote reference the black line disappears from the footer, and adding a new footnote at the same position works correctly:

Screenshot 2024-07-22 at 18 02 45

Example Document

Expected behavior

The first footnote should display correctly with the right text and number:

Screenshot 2024-07-22 at 18 05 38

Steps to reproduce

Here's the test code I'm using:

$word = new PhpWord();

$section = $word->addSection();

$textrun = $section->addTextRun();
$textrun->addText('Some text');

$fn1 = $textrun->addFootnote();
$fn1->addText('First footnote');

$textrun->addText('some more text');

$fn2 = $textrun->addFootnote();
$fn2->addText('Second footnote')

$word->save('...', 'Word2007';;

PHPWord version(s) where the bug happened

1.2.0

PHP version(s) where the bug happened

8.3.9

Priority

  • I want to crowdfund the bug fix (with @algora-io) and fund a community developer.
  • I want to pay the bug fix and fund a maintainer for that. (Contact @Progi1984)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions