Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Blog
    • Labels:
    • Testing Instructions:
      Hide

      Test steps

      1. Create a new blog entry
      2. Fill-in the subject field, add a content and submit
      3. Make sure the entry is created
      4. Create a new blog entry
      5. Use Firebug to remove the 'maxlength' attribute from the subject field
      6. Make sure you cannot save the entry if the subject exceeds 128 characters
      7. Repeat those steps with Javascript disabled in your browser
      Show
      Test steps Create a new blog entry Fill-in the subject field, add a content and submit Make sure the entry is created Create a new blog entry Use Firebug to remove the 'maxlength' attribute from the subject field Make sure you cannot save the entry if the subject exceeds 128 characters Repeat those steps with Javascript disabled in your browser
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-33885-master
    • Rank:
      41987

      Description

      When posting a blog with a really long title, you get this error.

      Debug info: Data too long for column 'subject' at row 1
      INSERT INTO mdl_post (userid,subject,summary,rating,attachment,publishstate,courseid,groupid,module,moduleid,coursemoduleid,content,format,uniquehash,lastmodified,created,usermodified) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
      [array (
      0 => '3',
      1 => 'adsfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfadsfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfadsfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf',
      2 => NULL,
      3 => 0,
      4 => NULL,
      5 => 'site',
      6 => 2,
      7 => 0,
      8 => 'blog',
      9 => 0,
      10 => 0,
      11 => NULL,
      12 => 1,
      13 => '',
      14 => 1340176615,
      15 => 1340176615,
      16 => NULL,
      )]
      Error code: dmlwriteexception
      Stack trace:
      line 410 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 948 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 990 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      line 356 of /blog/locallib.php: call to mysqli_native_moodle_database->insert_record()
      line 186 of /blog/edit.php: call to blog_entry->add()

        Issue Links

          Activity

          Hide
          Jason Fowler added a comment -

          I think that while the problem lies in the database (the text entered is too big for the column) the actual solution would be a sanity check on the input text, restricting the length of the title

          Show
          Jason Fowler added a comment - I think that while the problem lies in the database (the text entered is too big for the column) the actual solution would be a sanity check on the input text, restricting the length of the title
          Hide
          Jason Fowler added a comment -

          Estimated time to fix: 14 hours

          Show
          Jason Fowler added a comment - Estimated time to fix: 14 hours
          Hide
          Jason Fowler added a comment -

          Well, that was a much more simple fix that I had envisioned - I was thinking of Javascript validation and all the extra stuff that goes with it... but I must say, I prefer your fix, short and sweet. Looks good

          Show
          Jason Fowler added a comment - Well, that was a much more simple fix that I had envisioned - I was thinking of Javascript validation and all the extra stuff that goes with it... but I must say, I prefer your fix, short and sweet. Looks good
          Hide
          Frédéric Massart added a comment -

          Ah ah, yeah I was lucky on that one :-P! Thanks Jason!

          Show
          Frédéric Massart added a comment - Ah ah, yeah I was lucky on that one :-P! Thanks Jason!
          Hide
          Dan Poltawski added a comment -

          Integrated, thanks Fred.

          Personally, I'm not a fan of those textfield length limits because they stop characters being typed. Rather I think its better to get the message and then reconsider your title. But thats just me, and we do what you've done elsewhere

          Show
          Dan Poltawski added a comment - Integrated, thanks Fred. Personally, I'm not a fan of those textfield length limits because they stop characters being typed. Rather I think its better to get the message and then reconsider your title. But thats just me, and we do what you've done elsewhere
          Hide
          Rajesh Taneja added a comment -

          Works Great
          Thanks for fixing this, Fred.

          Show
          Rajesh Taneja added a comment - Works Great Thanks for fixing this, Fred.
          Hide
          Dan Poltawski added a comment -

          Congratulations!

          You've made it into the weekly release!

          Thanks for your contribution - here are some random drummers to keep you inspired for the next week!
          http://www.youtube.com/watch?v=_QhpHUmVCmY

          Show
          Dan Poltawski added a comment - Congratulations! You've made it into the weekly release! Thanks for your contribution - here are some random drummers to keep you inspired for the next week! http://www.youtube.com/watch?v=_QhpHUmVCmY

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: