Moodle

SCORM Launch URL's been cut short

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.9.5
  • Fix Version/s: 2.0
  • Component/s: SCORM
  • Labels:
    None
  • Environment:
    MySQL 5.1., Ubuntu 9.04
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

I have identified an issue due to the size of the database field used to store the HREF value for a SCORM SCO.

In my test case the launchurl in the IMSMANIFEST.XML for my course was 272 characters, and was getting truncated when Moodle parsed and stored this.

This is due to the field "launch" in mdl_scorm_scoes been defined as varchar(255)

The XSD definitions (imscp_rootv1p1p2.xsd) define that this attribute can be up to 2000 characters:

<xsd:attributeGroup name="attr.href">
<xsd:attribute name="href" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:anyURI">
<xsd:maxLength value="2000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:attributeGroup>

The fix is to change the table definition to be varchar(2000) if using MySQL 5.03 or later, earlier versions only allow a max field size of 255:

"Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions. The effective maximum length of a VARCHAR in MySQL 5.0.3 and later is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used. "
Copied from http://dev.mysql.com/doc/refman/5.0/en/char.html

Alternative that may work prior to MySQL 5.03 is to convert field to TEXT but have not tested.

Activity

Hide
Dan Marsden added a comment -

adding our DB guru to this. - Moodle 2.0 requires mysql 5.0.25 so we can use a varchar 2000 but I'm not sure about our other dbs - Eloy - what type should we change this field to in Moodle 2.0?

thanks!

Show
Dan Marsden added a comment - adding our DB guru to this. - Moodle 2.0 requires mysql 5.0.25 so we can use a varchar 2000 but I'm not sure about our other dbs - Eloy - what type should we change this field to in Moodle 2.0? thanks!
Hide
Dan Marsden added a comment -

caught up with Eloy today - current Moodle db guidelines use a varchar max of 256 - this will change (probably in a 2.x release) to convert all Text(small) to Varchar(4000)

in the meantime we can change to TEXT (small) - I'll commit this to 2.0 sometime soon.

Show
Dan Marsden added a comment - caught up with Eloy today - current Moodle db guidelines use a varchar max of 256 - this will change (probably in a 2.x release) to convert all Text(small) to Varchar(4000) in the meantime we can change to TEXT (small) - I'll commit this to 2.0 sometime soon.
Hide
Dan Marsden added a comment -

fix now in HEAD - db changes don't usually go into Stable releases so closing this off. - thanks for the report!

Show
Dan Marsden added a comment - fix now in HEAD - db changes don't usually go into Stable releases so closing this off. - thanks for the report!

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: