We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21255
    • 215 Posts
    This version of document.parser.inc.php fixes some issues in MODx which were published on yesterday.
    Please update your current 0.9.1 MODx installations as soon a possible.


    How to patch
    Open manager/includes/document.parser.class.inc.php in your favourite text editor and replace the function "getDocumentIdentifier" with the code below.

      function getDocumentIdentifier($method) {
        // function to test the query and find the retrieval method
        $docIdentifier= $this->config['site_start'];
        switch($method) {
          case "alias" :
            $docIdentifier= $this->db->escape($_REQUEST['q']);
          break;
          case "id" :
            if(!is_numeric($_REQUEST['id'])) {
              $this->messageQuit("ID passed in request is NaN!");
            } else {
              $docIdentifier= intval($_REQUEST['id']);
            }
          break;
          default :
          break;
        }
        return $docIdentifier;
      }
    

      • 15159
      • 93 Posts
      I must have missed it. What exactly was the security issue? Repatching all the paches into the parser is not something I look forward to.
        • 21255
        • 215 Posts
        I am a non windows user myself (but recoded it to DOS CR/LF as the original one is ;-)

        Since the document.parser.class.inc.php you posted includes a bunch of other changes slated for the next release
        Oupsie, please see updated posting on top.
          • 31337
          • 258 Posts
          Groovy! Thanks again for the quick catch.
            • 31337
            • 258 Posts
            Quote from: jwtyler at Apr 15, 2006, 05:21 PM

            I must have missed it. What exactly was the security issue? Repatching all the paches into the parser is not something I look forward to.

            No need to do that. Just replace the one function above.
              • 30223
              • 1,010 Posts
              Nice one, thank you.

              Can anyone tell me where the message "ID passed in request is NaN!" will find a place in the language file? It will be in there at some stage won’t it? I’d like to make that update in an international installation without hardcoding the mesage in the parser class.

              Oh, and a small coding question. Does the
              default :
                    break;
              

              server any purpose? In my simple brain it doesn’t make any difference to the flow if you leave it out so why is it there? Am I missing something?

              • I think the default case is required. And thank you for pointing out the messages should probably go in the language files... can you log that in our Bug (and Support/Feature request tracker), please?
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 21902
                  • 11 Posts
                  if user type ./index.php?id=24blablabla in address field then it’s get error message about NaN resource.

                  May’be this code right? User get only 404 page.
                  /*cut*/
                       if(!is_numeric($_REQUEST['id'])) {
                        $docIdentifier= 0;
                  /*paste*/
                  

                  • I just set it to return to the home page. No fuss, no bother.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 2545
                      • 15 Posts
                      On special version for free.fr (ModX v0.9.O_Free_Edition), this bug exist ?

                      This discussion is closed to further replies. Keep calm and carry on.