We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14730
    • 34 Posts
    I get the following error when visiting my site or the manager:
    Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/content/o/p/e/openresidence/html/core/model/modx/modx.class.php on line 2749
    Fatal error: Class 'modContext_' not found in /home/content/o/p/e/openresidence/html/core/xpdo/xpdo.class.php on line 537


    I was working with a FormIt hook I made, one I used many times before. It’s purpose is to grab select fields and turn them into placeholders.

    A couple of minutes earlier I changed a syslink to a document by changing the document class.
    I visited the page and worked in the manager afterwards, but maybe that’s causing the error.

    Any idea? Can I back-track it somehow?

    Thanks for the help!
    Here are my stats:

    Web Server:
    PHP 5.x (don’t know how it’s running)
    Apache
    Linux

    Database:
    MySQL 5.0

    MODx:
    Version: Revolution 2.0.0-pl rev7212
    Plugins: formit; getpage; getresources; ie6nomore; if; taglister

    Browser/Client:
    FF 3.6 on WinXP
    Safari 4.1 on MacOS 10.4.11
      • 3749
      • 24,544 Posts
      Does your FormIt hook access that resource? If so, that’s probably the problem. You could certainly turn that resource back into a Symlink by reverting that field. I’m guessing that Symlinks have other fields that are not set properly for them to be regular resources.

      If not, did you change the Formit hook code?
        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
        • 14730
        • 34 Posts
        Does your FormIt hook access that resource?
        Nope, the hook is in it’s parent and FormIt reloads that parent.

        I’m guessing that Symlinks have other fields that are not set properly for them to be regular resources.
        I checked the database, it looked fine, but can I just remove the line to be sure?
        Same for the hook, can I edit my template (remove the hook from FormIt) directly in the database without consequences?

        did you change the Formit hook code?
        Nope

        Maybe I should have cleared the cache. Can I do that manually?

        Do you have any idea what happens on those lines, what should be merged, or what array that 2nd Argument should hold?
          • 3749
          • 24,544 Posts
          Quote from: Jorik at Sep 29, 2010, 09:37 AM

          Does your FormIt hook access that resource?
          Nope, the hook is in it’s parent and FormIt reloads that parent.

          I’m guessing that Symlinks have other fields that are not set properly for them to be regular resources.
          I checked the database, it looked fine, but can I just remove the line to be sure?
          Same for the hook, can I edit my template (remove the hook from FormIt) directly in the database without consequences?

          did you change the Formit hook code?
          Nope

          Maybe I should have cleared the cache. Can I do that manually?

          Do you have any idea what happens on those lines, what should be merged, or what array that 2nd Argument should hold?


          It’s almost never a good idea to alter the DB directly, especially when you have a problem. You should do your best to revert the Symlink back to a Symlink (just undoing the changes you made). There’s no need to delete the hook snippet -- just removing the name from the FormIt tag will make sure it never executes.

          Never mess with the core code except for debugging, and then only with a good backup or a version control system in place.

          You can clear the cache manually by deleting everything in core/cache/ except for the index.php file. You should also clear your browser cache and cookies at the same time.

          If that doesn’t work post the code from your hook snippet. I’m guessing that it’s missing one or more sanity checks.
            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
            • 14730
            • 34 Posts
            I might have been unclear: I had the same error when accessing the manager. So no access anymore.

            Now that I cleared the cache (deleted all but index.html, including folders) I get white pages (empty source) everywhere; even if the page didn’t exists in the past.
            Only /manager gives the following error:
            Parse error: syntax error, unexpected $end in /home/content/o/p/e/openresidence/html/core/xpdo/xpdo.class.php on line 989


            I checked the db for the hook snippet:
            $listing = $hook->getValue('listing');
            $area = $hook->getValue('area');
            $type = $hook->getValue('propertytype');
            $bedrooms = $hook->getValue('bedrooms');
            $bathrooms = $hook->getValue('bathrooms');
            $price = $hook->getValue('price');
            $bedroomsoperator = $hook->getValue('bedroomsoperator');
            $bathroomsoperator = $hook->getValue('bathroomsoperator');
            $priceoperator = $hook->getValue('priceoperator');
            
            $modx->setPlaceholder('fi.listing',$listing);
            $modx->setPlaceholder('fi.area',$area);
            $modx->setPlaceholder('fi.propertytype',$type);
            $modx->setPlaceholder('fi.bedrooms',$bedrooms);
            $modx->setPlaceholder('fi.bathrooms',$bathrooms);
            $modx->setPlaceholder('fi.price',$price);
            $modx->setPlaceholder('fi.bedroomsoperator',$bedroomsoperator);
            $modx->setPlaceholder('fi.bathroomsoperator',$bathroomsoperator);
            $modx->setPlaceholder('fi.priceoperator',$priceoperator);
            
            return true;
            It’s not that exiting. You even helped me with it on a different board!
            It’s designed to grab the choice made in a drop-down menu. Maybe FormIt can do it itself as well...

            I can give you the form as well, but it did work fine in the past.
            The thing is, I was deleting a lot of content to make things work smoothly as they did a week ago. So it all worked in the past.
            removing the name from the FormIt tag will make sure it never executes
            That’s what I ment, but I have to do that in the db. You advised against that...
            If you think it’s worth the try, I just edit the "snippet field" with phpMyAdmin. I won’t break it, right?
            revert the Symlink back to a Symlink
            If you think reverting the symlink back into it’s original state might solve it, I would have to do that in the db as well.
            Can you tell me what the class_key for a symlink is? That’s what I’ve changed into "modDocument".

            Anyways, since I’m moving from one server to another, my final resort would be to download the db to excel and start copy pasting stuff...
            So no pressure on my side; but it would be nice if I can just move it.
              • 3749
              • 24,544 Posts
              Sorry, I missed that you can’t log in to the Manager.

              The hook is clearly harmless, so there’s no point in messing with that, IMO.

              The class_key should be modSymLink and the type field should be reference for a Symlink.

              First, though, I would take a look at xpdo.class.php referred to in the error message. Make sure it is over 2,000 lines long and that there’s nothing fishy looking around line 989.

              The most likely cause of the error is a truncated xpdo.class.php file.
                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
                • 14730
                • 34 Posts
                You nailed it! Line 989 is the last line of the file.
                Can I just replace it with the original? I got my original download laying around here somewhere...

                I just wondering now, what could have caused this error? How can half a file suddenly disappear?
                Any clues?
                  • 3749
                  • 24,544 Posts
                  Quote from: Jorik at Sep 30, 2010, 10:06 PM

                  You nailed it! Line 989 is the last line of the file.
                  Can I just replace it with the original? I got my original download laying around here somewhere...

                  I just wondering now, what could have caused this error? How can half a file suddenly disappear?
                  Any clues?

                  You should be able to just copy the original over it (assuming it’s from the same version of MODx).

                  As for how it happened, it’s a wild guess, but I think maybe the file was truncated in the original transfer but happened to still be valid PHP. The problem didn’t show up until you ran something that wanted to use the missing part of the file.
                    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
                    • 14730
                    • 34 Posts
                    You should be able to just copy the original over it
                    Did it, and it worked. Thanks a lot for the help!

                    edit: I am missing the ?> line in the document. Is that normal, an error in everyone’s version, or am I still missing stuff?
                    nevermind, found the answer here: http://modxcms.com/forums/index.php/topic,53049.0.html