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

Adding or editing post produces "ERROR: invalid input syntax for integer: "Object id #XXX"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.6.3, 1.7
    • Component/s: Forum
    • Labels:
      None
    • Environment:
      Slackware, Apache 2.2.3, PHP 5.1.6, Moodle 1.6.1+, post.php revision 1.94.2.6
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_16_STABLE, MOODLE_17_STABLE

      Description

      I have noticed an error message when adding or updating a post to the site news. The message was:

      ERROR: invalid input syntax for integer: "Object id #246"
      SELECT type FROM mdl_forum WHERE id = 'Object id #246'

      IMHO there is a bug in the mod/forum/post.php. I have patched it as follows:

      $ cvs diff post.php
      Index: post.php
      ===================================================================
      RCS file: /cvsroot/moodle/moodle/mod/forum/post.php,v
      retrieving revision 1.94.2.6
      diff -c -r1.94.2.6 post.php

          • post.php 31 Jul 2006 10:04:18 -0000 1.94.2.6
          • post.php 11 Sep 2006 15:01:51 -0000
            ***************
          • 136,142 ****

      $message = '';

      ! if (get_field('forum', 'type', 'id', $forum) == 'news' && !$oldpost->parent) {
      $updatediscussion = new object;
      $updatediscussion->id = $oldpost->discussion;
      if (empty($post->timestartdisabled)) {
      — 136,142 ----

      $message = '';

      ! if (get_field('forum', 'type', 'id', $forum->id) == 'news' && !$oldpost->parent) {
      $updatediscussion = new object;
      $updatediscussion->id = $oldpost->discussion;
      if (empty($post->timestartdisabled))

      { *************** *** 274,280 **** }

      $newstopic = false;
      ! if (get_field('forum', 'type', 'id', $forum) == 'news')

      { $newstopic = true; }
      if ($newstopic && empty($post->timestartdisabled)) { --- 274,280 ---- }

      $newstopic = false;
      ! if (get_field('forum', 'type', 'id', $forum->id) == 'news') { $newstopic = true; }

      if ($newstopic && empty($post->timestartdisabled)) {

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Oct/06