Adding an empty string as a comment generates a warning

Bug #1832803 reported by Ghada El-Zoghbi on 2019-06-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Ghada El-Zoghbi
18.04
Medium
Unassigned
18.10
Medium
Unassigned
19.04
Medium
Unassigned
19.10
Medium
Ghada El-Zoghbi

Bug Description

Mahara: 19.04.0
OS: Linux 16.04
DB: Postgres
Browser: FF

When entering a comment which does not have any text but includes an uploaded file, the following warning is generated:

[WAR] bd (artefact/comment/lib.php:1184) DOMDocument::loadHTML(): Empty string supplied as input
Call stack (most recent first):

    log_message("DOMDocument::loadHTML(): Empty string supplied as ...", 8, true, true, "/var/www/mahara/htdocs/artefact/commen...", 1184) at /var/www/mahara/htdocs/lib/errors.php:520
    error(2, "DOMDocument::loadHTML(): Empty string supplied as ...", "/var/www/mahara/htdocs/artefact/commen...", 1184, array(size 2)) at Unknown:0
    DOMDocument->loadHTML("", 8196) at /var/www/mahara/htdocs/artefact/comment/lib.php:1184
    ArtefactTypeComment::remove_comments_classes("") at /var/www/mahara/htdocs/artefact/comment/lib.php:1637
    add_feedback_form_submit(object(Pieform), array(size 8)) at /var/www/mahara/htdocs/lib/pieforms/pieform.php:544
    Pieform->__construct(array(size 9)) at /var/www/mahara/htdocs/lib/pieforms/pieform.php:166
    Pieform::process(array(size 9)) at /var/www/mahara/htdocs/lib/mahara.php:5400
    pieform(array(size 9)) at /var/www/mahara/htdocs/view/view.php:266

To reproduce:
* Create a view with a comment section
* View the page and enter a comment
* Upload a file for the comment and leave the content empty.
* Save
* Refresh page
* The above warning appears

Expected: no warning should appear.

Changed in mahara:
assignee: nobody → Ghada El-Zoghbi (ghada-z)
Mahara Bot (dev-mahara) wrote :

Patch for "18.04_STABLE" branch: https://reviews.mahara.org/10083

Mahara Bot (dev-mahara) wrote :

Patch for "18.10_STABLE" branch: https://reviews.mahara.org/10084

Mahara Bot (dev-mahara) wrote :

Patch for "19.04_STABLE" branch: https://reviews.mahara.org/10085

Reviewed: https://reviews.mahara.org/10083
Committed: https://git.mahara.org/mahara/mahara/commit/0283745692d9e23991fda19f52ecb410226f7603
Submitter: Robert Lyon (<email address hidden>)
Branch: 18.04_STABLE

commit 0283745692d9e23991fda19f52ecb410226f7603
Author: Ghada El-Zoghbi <email address hidden>
Date: Fri Jun 14 14:53:11 2019 +1000

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

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/10084
Committed: https://git.mahara.org/mahara/mahara/commit/3dc610416ce06b76c8b4e6d11d27eeba6a7ed0ee
Submitter: Robert Lyon (<email address hidden>)
Branch: 18.10_STABLE

commit 3dc610416ce06b76c8b4e6d11d27eeba6a7ed0ee
Author: Ghada El-Zoghbi <email address hidden>
Date: Fri Jun 14 14:53:11 2019 +1000

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

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/10085
Committed: https://git.mahara.org/mahara/mahara/commit/251b026fb7751bb84446cefbce3a0f94cc389253
Submitter: Robert Lyon (<email address hidden>)
Branch: 19.04_STABLE

commit 251b026fb7751bb84446cefbce3a0f94cc389253
Author: Ghada El-Zoghbi <email address hidden>
Date: Fri Jun 14 14:53:11 2019 +1000

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

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/10079
Committed: https://git.mahara.org/mahara/mahara/commit/323d7493f5b419f4e6f74f00b43bbe50b261c57c
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 323d7493f5b419f4e6f74f00b43bbe50b261c57c
Author: Ghada El-Zoghbi <email address hidden>
Date: Fri Jun 14 14:53:11 2019 +1000

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

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers