We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21054
    • 78 Posts
    I know shorner had the same issue, but the solution involved a re-install and re-adding chunks, TVs, etc.

    This site is very large, and doing this would take a long, long time. Is there any other solution that doesn’t require me to do a full re-install?

    The difference between my problem and shorner’s is that I can still get into manager.

    This is very disturbing considering today was our "Go Live" date... and I woke up to this horrible error!!!

    -------

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »
     
    PHP error debug
      Error: 	Invalid argument supplied for foreach()	 
      Error type/ Nr.: 	Warning - 2	 
      File: 	/home/herimaine/public_html/manager/includes/document.parser.class.inc.php	 
      Line: 	1210	 
      Line 1210 source: 	foreach ($this->documentMap as $mapEntry) { 	 
     
    Parser timing
      MySQL: 	0.0052 s	(4 Requests)
      PHP: 	0.0354 s	 
      Total: 	0.0406 s	 
      • 4172
      • 5,888 Posts
      hm... what is the content of $this->documentMap at this time?

      you can try to make
      print_r($this->documentMap);


      before line 1210.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 4172
        • 5,888 Posts
        perhaps this can help:

            function getParentIds($id, $height = 10, $parents = array ())
            {
                $parentId = 0;
                if (is_array($this->documentMap) && count($this->documentMap) > 0)
                {
                    foreach ($this->documentMap as $mapEntry)
                    {
                        $parentId = array_search($id, $mapEntry);
                        if ($parentId)
                        {
                            $parentKey = array_search($parentId, $this->documentListing);
                            if (!$parentKey)
                            {
                                $parentKey = "$parentId";
                            }
                            $parents[$parentKey] = $parentId;
                            break;
                        }
                    }
                }
            
                $height--;
                if ($parentId && $height)
                {
                    $parents = $parents+$this->getParentIds($parentId, $height, $parents);
                }
                return $parents;
            }
            
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 1095
          • 2 Posts
          Hi Bruno

          I’m working with Nelson on the problem... have put a debug line in like you suggested, but unfortunately it doesn’t give us any output on the page... (I guess because the page is not printing any output as it’s dying before that point.)

          The subroutine you posted, not clear what you want us to try with that?

          Ali
            • 4172
            • 5,888 Posts
            seems to me there is a script (plugin?) which calls the function $modx->getParentIds.

            But may be $this->documentMap is empty or not an array at this time.

            so we try with

            if (is_array($this->documentMap) && count($this->documentMap) > 0)
                    {


            to skip this loop if this is the case.

            you can also try to deactivate plugins.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 21054
              • 78 Posts
              okay... here is an error log that suspiciously points to that exact same file:

              from a few months ago...

              [10-Aug-2009 22:40:29] PHP Parse error:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/herimaine/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code on line 95
              [10-Aug-2009 22:41:24] PHP Parse error:  syntax error, unexpected T_STRING, expecting ']' in /home/herimaine/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code on line 98
              [10-Aug-2009 22:43:08] PHP Parse error:  syntax error, unexpected T_STRING, expecting ']' in /home/herimaine/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code on line 97
              [10-Aug-2009 22:56:26] PHP Parse error:  syntax error, unexpected '[', expecting '(' in /home/herimaine/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code on line 21
              [10-Aug-2009 22:57:00] PHP Parse error:  syntax error, unexpected '[', expecting '(' in /home/herimaine/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code on line 21
              [10-Aug-2009 22:58:03] PHP Parse error:  syntax error, unexpected '[', expecting '(' in /home/herimaine/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code on line 21
              [10-Aug-2009 22:58:39] PHP Parse error:  syntax error, unexpected '{' in /home/herimaine/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code on line 21
              


              and recently...

              [11-Nov-2009 05:23:45] PHP Warning:  include_once(/home/herimaine/public_html/manager//includes/document.parser.class.inc.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /home/herimaine/public_html/index.php on line 112
              [11-Nov-2009 05:23:45] PHP Warning:  include_once() [<a href='function.include'>function.include</a>]: Failed opening '/home/herimaine/public_html/manager//includes/document.parser.class.inc.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/herimaine/public_html/index.php on line 112
              [11-Nov-2009 05:23:45] PHP Fatal error:  Class 'DocumentParser' not found in /home/herimaine/public_html/index.php on line 113
              


              see the double slash?
                • 21054
                • 78 Posts
                This issue was "resolved" when I logged into the manager and cleared the cache.

                So I’m guessing the cache was corrupt?

                This is a bit scary though, because it doesn’t really explain why it happened (and I’m lucky that I could enter into Manager in the first place to do this)

                Does anyone recommend a way to prevent this from happening in the future (and in the process, put a client’s mind at ease?) smiley

                -Nel
                  • 3749
                  • 24,544 Posts
                  Did this happen after an upgrade of the site (i.e. new MODx version)? If so, running setup in upgrade mode should have cleared the cache and straightened out any other problems.

                  I usually clear the cache manually in the Manager after any significant change to the site just to be sure.

                  Your browser cache/cookies can also be a problem sometimes after an upgrade.

                  You can assure the client that a corrupted cache is very very rare in the normal operation of a MODx site and easily cured by clearing the cache in the Manager.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 21054
                    • 78 Posts
                    Quote from: BobRay at Nov 11, 2009, 07:54 AM

                    Did this happen after an upgrade of the site (i.e. new MODx version)? If so, running setup in upgrade mode should have cleared the cache and straightened out any other problems.

                    I usually clear the cache manually in the Manager after any significant change to the site just to be sure.

                    Your browser cache/cookies can also be a problem sometimes after an upgrade.

                    You can assure the client that a corrupted cache is very very rare in the normal operation of a MODx site and easily cured by clearing the cache in the Manager.

                    Hi,

                    Nope, this is a 0.9.3.6 install that we’ve been building running since January this year. (I’m a bit reluctant to upgrade to 1.0.2 since it is such a large site now with many updated and customised snippets)

                    I’ve just told my client that it is a rare occurrence... with instructions of how to do clear it smiley

                    It was just such bad luck/timing that it happened the day before we went live!

                      • 3749
                      • 24,544 Posts
                      Any idea what you were doing that might have corrupted the cache? Closing the browser window during a save or being logged in and doing work as the same Manager in different session at the same time are the only things I can think of and I’m not sure either would do that.
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting