mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #55594
[Bug 1843210] Re: Cannot add comments in a page
Workaround below.
This will be required if your libxml is stuck on 2.7.6 and below, if possible the easier fix would be to update to a PHP release which has 2.7.7. If that's not possible the changes below should workaround the issue by using an older method which avoids using the 2.7.7 feature.
You can check your version with
php -i | grep libxml
File location: /artefact/comment/lib.php
/*
* public_html/artefact/comment/lib.php
* 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;
-- $dom->loadHTML($comment, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
++ $dom->loadHTML($comment);
$xpath = new DOMXPath($dom);
$expression = "//div[contains(@class,'modal-
docked')]|//div[contains(@class,'modal')]|//div[contains(@class,'modal-
dialog')]|//div[contains(@class,'modal-lg')]";
foreach ($xpath->evaluate($expression) as $section) {
$section->removeAttribute('class');
}
++ return preg_replace('/^<!DOCTYPE.+?>/', '', str_replace( array('<html>', '</html>', '<body>', '</body>'), array('', '', '', ''), $dom->saveHTML()));
-- return $dom->saveHTML();
}
Note that
return preg_replace('~<(?:!DOCTYPE|/?(?:html|body))[^>]*>\s*~i', '', $dom->saveHTML());
should work too (slightly shorter version of the above but I've not tested this).
** Changed in: mahara
Status: Confirmed => In Progress
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1843210
Title:
Cannot add comments in a page
Status in Mahara:
In Progress
Bug description:
Hi,
When I added a comment by clicking the "Comment" button in a page, all
the contents of my comments were gone and just an empty comment was
shown (See the attached screenshot).
I edited and added some text again to this empty comment, it still did
not work. It seems that the comments cannot be saved.
I also tried to setup new sites for testing, tested both versions
19.04.0 and 19.04.01, the problem is still there.
My server environment:
Red Hat (RHEL) 6.10
Apache 2.4.39
PHP 7.2.19
MariaDB 10.2.16
Would you please help to check?
Thanks.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1843210/+subscriptions
References