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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.1
    • 1.6.3, 1.7
    • Forum
    • None
    • Slackware, Apache 2.2.3, PHP 5.1.6, Moodle 1.6.1+, post.php revision 1.94.2.6
    • PostgreSQL
    • MOODLE_16_STABLE
    • 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)) {

      Attachments

        Activity

          People

            vyshane Vy-Shane Sin Fat
            mudrd8mz David Mudrák (@mudrd8mz)
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10/Oct/06