mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 18:36:42 +02:00
MDL-42519 qformat_xml: Correctly export questions containing ]]>
This commit is contained in:
parent
981f06fad5
commit
46e4c35aa9
2 changed files with 38 additions and 0 deletions
|
@ -1055,6 +1055,10 @@ class qformat_xml extends qformat_default {
|
|||
*/
|
||||
public function xml_escape($string) {
|
||||
if (!empty($string) && htmlspecialchars($string) != $string) {
|
||||
// If the string contains something that looks like the end
|
||||
// of a CDATA section, then we need to avoid errors by splitting
|
||||
// the string between two CDATA sections.
|
||||
$string = str_replace(']]>', ']]]]><![CDATA[>', $string);
|
||||
return "<![CDATA[{$string}]]>";
|
||||
} else {
|
||||
return $string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue