We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4499
    • 34 Posts
    Hosting Platform: IMP (IIS 6, MySQL 5.0.45, PHP 5.2.4) running MODx 0.9.6
    IIS Configured to use PHP via ISAPI, with MODx running in a virtual directory inside a PHP Enabled Site.

    I have just registered over at fly spray but I am wondering if this is a bug, or just a configuration error first off before I submit it there.

    Basically what happens is that if I login into a site and then go to http://domain/modx it returns an error when trying to add my username into the active user database. If however I go to http://domain/modx/index.php?id=1 this does not occur, only if http://domain/modx or http://domain/modx/index.php are called.

    Same thing happens when I click on home before I applied the work around below.

    The error - I can’t get the exact error now but its the same as this one that I found during a google search of the site, even if its not in English for the rest of the thread.

    Execution of a query to the database failed - Incorrect integer value: ’NULL’ for column ’id’ at row 1 ≫
    SQL: REPLACE INTO `modx`.`modx_active_users` (internalKey, username, lasthit, action, id, ip) values(-4, ’testuser’, ’1182298302’, ’998’, ’NULL’, ’192.168.1.203’)

    This query only fails when its called from a page where no ID exists, thus generating a NULL field.
    However if I go into the database itself, there are several null values allowed, the table itself allows null values and I can manually set this to null if I so choose.

    I have done a temporary workaround - by setting the default document for the site to be index.php?id=1 in IIS.
      • 22303 MODX Staff
      • 10,725 Posts
      Looks to be a bug in the assets/snippets/weblogin/weblogin.processor.inc.php indeed, but one that will likely only rear it’s ugly head if you are in an environment with the new MySQL STRICT sql_mode options enabled. In any case, it is a bug and needs to be squashed. If you wouldn’t mind using that new flyspray account to add this officially, we’ll get it knocked out and committed for 0.9.6.1 release.

      To fix it, turn off the strict SQL options, OR change the line in that file that looks like this (@ line 381):
                  $sql = "REPLACE INTO $dbase.`".$table_prefix."active_users` (internalKey, username, lasthit, action, id, ip) values(-".$_SESSION['webInternalKey'].", '".$_SESSION['webShortname']."', '".$lasthittime."', '".$a."', '".$itemid."', '$ip')";

      to:
                  $sql = "REPLACE INTO $dbase.`".$table_prefix."active_users` (internalKey, username, lasthit, action, id, ip) values(-".$_SESSION['webInternalKey'].", '".$_SESSION['webShortname']."', '".$lasthittime."', '".$a."', ".$itemid.", '$ip')";

      Notice the removal of the single quotes around the $itemid used in the values() portion of the REPLACE statement.

      Cheers!
        • 4499
        • 34 Posts
        Logged - http://modxcms.com/bugs/task/959

        Referenced back to this thread as well.
          • 6939
          • 4 Posts
          hi,

          Same issue as above. FIXED - see post 7 of this thread

          I am running 0.96
          mySql server 5
          apache 2.2 with php5apache2_2.dll

          I have already made the change to weblogin.processor.inc.php, and also tried forcing with:
          if ($itemId == null)
          $itemId = 1;

          When no user is logged in, no problems

          When there is a user logged in, clicking on the Wayfinder link ’home’ brings up the invalid itemId error.
          All the other links work fine.
            • 6939
            • 4 Posts
            To generate this output I replaced resource[’linktext’] with resource[’link’] in WayFinder function renderRow()

            Page on initial load - everything works fine:

            * http://localhost:801/modx/

            Welcome to mySiteInteractive

            LoginForm
            User:
            Password:
            Remember me:

            Forget Password?

            Login as user with access to Community HomePage - id=2:

            * http://localhost:801/modx/
            * /modx/index.php?id=2

            Welcome to mySiteInteractive
            LoginForm
            Logout

            now clicking on the ’Home’ link generates the error that is the subject of this thread.
            logging out makes the ’Home’ link work again

            I can see how this could be because of a value within the data for the user... however [see previous post] I have already removed the quotes and forced the itemId....In fact if I quote out the REPLACE INTO line in weblogin.processor.inc.php, as mentioned (after logging in) there is no change in behaviour....

            Ill go a hunting in the core...
            OR
            Might just force resource[’link’] == [(site_url)] to [(site_url)].’index.php?id=1 in wayfinder.inc, though they’re not logically the same itll work for my purpose...

            This is my first and a halfth day with modx... Id love some help...
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: Caledai at Oct 03, 2007, 10:32 PM

              Logged - http://modxcms.com/bugs/task/959

              Referenced back to this thread as well.
              Sorry, I fixed this in SVN before the bug was posted, so you won’t see it listed by FS# in the changelog. You can update to the latest version from SVN, disable the strict SQL mode in the MySQL server configuration, or wait until I finish testing the latest version of TinyMCE being included so I can release the official 0.9.6.1 version of MODx.
                • 6939
                • 4 Posts
                [glow=purple,2,300]Ah ha...[/glow]

                the REPLACE INTO happens also in weblogin.inc.php line 108

                didnt check if necessary to change both.

                smiley


                Hi, cheers for the reply.... openG
                read somewhere on the forum that SVN wasnt open.... obviously old post.
                Have you considered putting a "relevent to:" [drop down list of versions] field in the posts???
                below subject...