|Anonymous | Login | Signup for a new account||2017-12-18 11:48 EST|
|My View | View Issues | Change Log | Roadmap | Repositories | My Account|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005811||ATutor||Import Content||public||2017-09-25 12:02||2017-10-05 18:32|
|Target Version||2.2.3||Fixed in Version||2.2.3|
|Summary||0005811: Test question truncated on import CC w/ PHP7|
|Description||When importing a common cartridge with test questions, the question in is truncated to one letter using php 7.1.1. (could also be earlier versions of php7)|
|Steps To Reproduce||Import a common cartridge with test questions in it, or a QTI test or testbank, first using php5.6. then the same with php7.1.1.|
Examine the questions imported into the question bank.
|Tags||No tags attached.|
|Attached Files||Import_CC_-_Principle_1__Perceivable_imscc.zip [^] (505,514 bytes) 2017-10-04 17:45|
Also happens with QTI EXPORT/IMPORT
AT ~LINE 70 /mods/core/imsqti/classes/QTIParser.class.php
xml_parse($this->parser, $xml_data, TRUE);
The XML contains the question names when going in, coming out with only the first letter of the question.
From stack overflow
The problem I'm having occurs with the xml_parse() function in the ATutor QTI Parser
I'm hoping someone can point out what I'm missing, or perhaps come up with a work around for PHP 7.1.1.
I've found no documentation, or posts here, that suggest changes to the PHP xml_parse() function from 5.6 to 7.1, though the two versions seem to parse xml differently. The XML being parse appears below.
Specifically, for the question array in the examples, 5.6.30 returns an array of questions, like:
[question] => Array
 => graphic matching
 => LIKERT
 => multi choice question
 => Mutliple question
 => open ended
 => ordering
 => Simple match
 => true
While with php 7.1.1, all else being the same, it returns only the first letters from each of the array elements above, as a string.
[question] => gLmMooSt
The XML file is an IMS QTI 1.2.1 manifest, from a QTI test (i.e. quiz) package.
The element where the truncating occurs is the question title (the question itself), found in the following element, which returns as the first element in the array when using PHP5.6 ( => graphic matching), and return as the first letter, "g", in the question string when using PHP7.1.1 ([question] => gLmMooSt)
<mattext texttype="text/html">graphic matching</mattext>
The line where the problem occurs is:
I've issued a pull request - https://github.com/atutor/ATutor/pull/137 [^] to fix this problem. Please test and verify.
The change is at https://github.com/cindyli/ATutor/blob/411b0be88d657bf8d4f5a627c15b58d5411b391c/mods/_core/imsqti/classes/QTIParser.class.php#L34 [^]
It's because PHP7 has a much strict variable type validation. This $question variable was initiated as a string value ''. Before PHP7, when it's treated as an array in the code, PHP silently convert it to array. With PHP7, this variable is treated as a string throughout the class, which results in array values assigned to this variable are truncated to compose a string by only taking the first character from each array value.
Quite a hidden issue. Glad it's fixed and now we know more about PHP7. Cheers!
|Cindy Li: explicitely define $question as an array, rather than the string it was previously set to.|
|2017-09-25 12:02||greg||New Issue|
|2017-09-25 12:08||greg||Summary||Test quetion truncated on import CC => Test question truncated on import CC|
|2017-09-29 19:56||greg||Note Added: 0007658|
|2017-10-02 17:59||greg||Description Updated||View Revisions|
|2017-10-02 17:59||greg||Steps to Reproduce Updated||View Revisions|
|2017-10-03 18:06||greg||Summary||Test question truncated on import CC => Test question truncated on import CC w/ PHP7|
|2017-10-04 17:45||greg||File Added: Import_CC_-_Principle_1__Perceivable_imscc.zip|
|2017-10-04 17:48||greg||Description Updated||View Revisions|
|2017-10-04 17:56||greg||Note Added: 0007666|
|2017-10-04 17:58||greg||Note Added: 0007667|
|2017-10-05 16:14||cindy||Note Added: 0007668|
|2017-10-05 18:32||greg||SVN Revision#||=> 78acadf..f6749fa|
|2017-10-05 18:32||greg||Note Added: 0007670|
|2017-10-05 18:32||greg||Status||new => resolved|
|2017-10-05 18:32||greg||Fixed in Version||=> 2.2.3|
|2017-10-05 18:32||greg||Resolution||open => fixed|
|2017-10-05 18:32||greg||Assigned To||=> cindy|
|Copyright © 2000 - 2017 MantisBT Team|