Details
Description
When the imsmanifest.xml contains & sign in CDATA section (e.g. prerequisites with & operator), it will be imported as & into the database.
It is occurred because all occurrences of single '&' signs are replaced with '&' in the scormlib.php (line 467) before xml parsing:
$pattern = '/&(?!\w
{2,6}/';
$replacement = '&';
$xmltext = preg_replace($pattern, $replacement, $xmltext);
It is problem when the & sign is in CDATA section.
The possible solution is to remove the 3 lines above. I tested the SCORM import with the following situations (removed 3 lines above):
- The '&' sign was escaped as '&' in the XML: Text was successfully imported, single '&' sign was written into the database.
- The '&' sign was in CDATA section: Texts was successfully imported, single '&' sign was written into the database.
- Single '&' sign in the XML (without escape or CDATA): XML error thrown (XML error: XML_ERR_NAME_REQUIRED). It is correct, because & signs must be escaped (or be in CDATA section) in XML.
So, if there is no another situation, I thought, the 3 lines can be removed. Is there other known situation?