Skip to content

Division by 0 #886

Closed
Closed
@taophp

Description

@taophp

I just import a docx and tried to export it to odt using PHPWord. At some point, I get this error:
PHP Warning: Division by zero in .../vendor/phpoffice/phpword/src/PhpWord/Writer/ODText/Style/Paragraph.php on line 40.
I investigated so the fact is that the document had a paragraph style where the getSpaceBefore method return the string "0", instead of NULL as expected. Indeed, this document is still valid for any text processor I tested, so it must be also for PHPWord.
I think the code could be improved using PHP transtyping feature to solve this issue. Simply replace is_null by ==0.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions