Commit 3dc61041 authored by Ghada El-Zoghbi's avatar Ghada El-Zoghbi Committed by Robert Lyon
Browse files

Bug 1832803: Check for empty string before passing it to DOMDocument

If an empty string is passed to the DOMDocument, a warning is
generated. Avoid the warning by checking for an empty string.

Sponsored by The Australian National University

behatnotneeded

Change-Id: I4bd3982de81f6db97601a1dbe5232d344e87ca81
parent f6930a74
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1172,12 +1172,15 @@ class ArtefactTypeComment extends ArtefactType {


    /*
     * Removes the classes from the text of the comment thst could interfere
     * Removes the classes from the text of the comment that could interfere
     * with the comment display
     * @param string $comment the text content of the comment
     */
    public static function remove_comments_classes($comment) {

        if (empty($comment)) {
            return "";
        }
        $dom = new DOMDocument();
        $dom->preserveWhiteSpace = false;
        $dom->formatOutput = true;