Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-39422

module names should not allow names to be entered beyond 255 characters

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.3
    • Fix Version/s: 2.3.7, 2.4.4
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      Hide

      Sample text [STRING-A]
      "This is a really really really long string which you would think would never ever be used but in actual fact is longer than moodle supports in some fields. Rather than accept this string we should stop it, as its over 255 characters in length, its nearly 260"

      1. Go to a new course as teacher
      2. Using the inline editing button (pencil icon), try to change the title of the news forum to the STRING-A
      3. VERIFY: it won't accept the whole string.
      4. VERIFY: the shortened string is saved without db error
      5. FOR EVERY activity/resource EXCEPT forum, workshop & label
      6. Set the name as the STRING-A
      7. VERIFY: the string is not accepted, with a warning about the length of the string
      8. VERIFY: a shortened string is accepted
      Show
      Sample text [STRING-A] "This is a really really really long string which you would think would never ever be used but in actual fact is longer than moodle supports in some fields. Rather than accept this string we should stop it, as its over 255 characters in length, its nearly 260" Go to a new course as teacher Using the inline editing button (pencil icon), try to change the title of the news forum to the STRING-A VERIFY: it won't accept the whole string. VERIFY: the shortened string is saved without db error FOR EVERY activity/resource EXCEPT forum, workshop & label Set the name as the STRING-A VERIFY: the string is not accepted, with a warning about the length of the string VERIFY: a shortened string is accepted
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull Master Branch:
      MDL-39422-master

      Description

      At our University there are some lecturer who add resources with Names longer than 255 chars.
      The URL is: https://mymoodle..../course/modedit.php?add=resource&type=&course=123&section=1&return=0&sr=0

      Now my request is: Is it possible to change <input size="48" name="name" type="text" onblur="validate_mod_resource_mod_form_name(this)" onchange="validate_mod_resource_mod_form_name(this)" id="id_name">

      to something like

      <input size="48" maxlengt="255" name="name" type="text" onblur="validate_mod_resource_mod_form_name(this)" onchange="validate_mod_resource_mod_form_name(this)" id="id_name">

      If the names length is longer as 255 chars there´s follogwing error shown:

      Debug info: ERROR: value too long for type character varying(255)
      INSERT INTO mdl_resource (name,display,filterfiles,course,revision,intro,introformat,timemodified,displayoptions) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING id
      [array (
      'name' => 'bjjbjdsbvjdsbvjdsbvjdsbvjkdsbvjdvbsdkvbdjsvbjdvbsdjvbjsdbvjkdbvjdsbvjdsbvkjsdbvjdsbvksjdbvsdkvbjdsbvjdsvbjssdvjdsvjsdbvjdsbvsbbdjvbjsdbvjbdsjvbdsjbvkdsdjvbdjsbdjsbdvkbjvjskjdbvjksdjbvksdvdjsbkjbjvjsbkdjbvjskjdbjvsjkjdbvsjdkjbvvvvvvvvvvvvvvvvvvvvvjddddddddddddddddddddddddddddddddddddddddddddddskkkkkkkkkkkkkkkkkkkkkkkkskskskskskskskksskkkskdbjdbcbscdbscjbcjksbcsdjbckjbcksdcbjdcbkjsbdjbcksjbdcksdjbcksjbcjdksjdbcjskdjbcjbsjdbcskcbkjbkjsbcjcbsjcbsjcbkjcbsdckjbscjbscsjb',
      'display' => '5',
      'filterfiles' => '0',
      'course' => '648',
      'revision' => 1,
      'intro' => '',
      'introformat' => '1',
      'timemodified' => 1367309963,
      'displayoptions' => 'a:2:

      {s:8:"showsize";i:1;s:8:"showtype";i:1;}

      ',
      )]
      Error code: dmlwriteexception
      Stack trace:
      line 429 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 248 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      line 857 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      line 909 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
      line 97 of /mod/resource/lib.php: call to pgsql_native_moodle_database->insert_record()
      line 449 of /course/modedit.php: call to resource_add_instance()

      Thanks,
      Benjamin Droemer
      Ulm University

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                poltawski Dan Poltawski
                Reporter:
                beni_x91 Benjamin Droemer
                Integrator:
                Sam Hemelryk
                Tester:
                Andrew Davis
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/May/13