We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24374
    • 322 Posts
    I upgraded from 2.5.0 to 2.5.1, and was getting just a blank white screen when I click on a resource to edit it. Also, the home page had a folder icon on it instead of just a page icon (it's not a container and has no children). I reverted to 2.5.0, and everything is back to normal.
      • 3749
      • 24,544 Posts
      I've seen similar weirdness from a leftover browser cookie after an upgrade.
        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
        • 52545
        • 1 Posts
        I updated from 2.5.0 to 2.5.1 and can not create/edit a resource, too:

        Fatal error: Call to a member function get() on array in /domain.com/httpdocs/manager/controllers/default/resource/resource.class.php on line 152

            /**
             * Fire any pre-render events
             * @return array|bool|string
             */
            public function firePreRenderEvents() {
                $resourceId = !empty($this->resource) ? $this->resource->get('id') : (!empty($this->scriptProperties['id']) ? $this->scriptProperties['id'] : 0);
                $properties = array(
                    'id' => $resourceId,
                    'mode' => !empty($resourceId) ? modSystemEvent::MODE_UPD : modSystemEvent::MODE_NEW,
                );
                if (!empty($resourceId)) {
                    $properties['resource'] =& $this->resource;
                }
                $onDocFormPrerender = $this->modx->invokeEvent('OnDocFormPrerender',$properties);
                if (is_array($onDocFormPrerender)) {
                    $onDocFormPrerender = implode('',$onDocFormPrerender);
                }
                $this->setPlaceholder('onDocFormPrerender',$onDocFormPrerender);
                return $onDocFormPrerender;
            }
        


        2.5.0 is working fine as always.
          • 3749
          • 24,544 Posts
          This is a bandaid solution (if it even works -- the odds are that some other use of $this->resource will still throw an error), but you might try changing this line:


          $resourceId = !empty($this->resource) ? $this->resource->get('id') : (!empty($this->scriptProperties['id']) ? $this->scriptProperties['id'] : 0);


          to this:

          $resourceId = ((!empty($this->resource)) && ($this->resource instanceof modResource)) ? $this->resource->get('id') : (!empty($this->scriptProperties['id']) ? $this->scriptProperties['id'] : 0);
          


          I think what's happening is that $this->resource is not empty, but is also not a modResource object.
            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
            • 52534
            • 13 Posts
            We found that TinyMCE was the culprit, switched over to "TinyMCE Rich Text Editor" extra and it fixed the problem.
              Front End Designer + Developer for Eternity
              • 27708 MODX Staff
              • 2,502 Posts
              TinyMCE is the source of the issue for <2.5.0 to 2.5.1 blank resources or silent 500s. There is a one line fix to continue to use TinyMCE which is to remove line 231 from core/components/tinymce/tinymce.class.php

              $this->config['resource'] = $this->config['resource']->toArray();


              TinyMCE has not been actively maintained since 2012. We'll see if someone can push the patch and we can re-release it and put it back up, however, we do need to ensure people are choosing to use maintained Extras for upcoming projects. We've temporarily blocked access to download it.
                Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                • 3749
                • 24,544 Posts
                Jay,

                donshakespeare's TinymceWrapper loads the current version of TinyMCE from CDN. It is very well maintained, is updated often, and has an active support thread here.
                  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
                  • 24374
                  • 322 Posts
                  Quote from: BobRay at Jul 25, 2016, 11:31 PM
                  Jay,

                  donshakespeare's TinymceWrapper loads the current version of TinyMCE from CDN. It is very well maintained, is updated often, and has an active support thread here.

                  I've tried both TinymceWrapper and TinyMCE Rich Text Editor, and neither of these allow me to use the full array of capabilities I get with the older TinyMCE plugin, including easily using my custom user.css styles for the editing area, and all the advanced HTML access in various tool palettes. I've also tried Redactor, and it falls far short as well.
                    • 24374
                    • 322 Posts
                    Quote from: smashingred at Jul 25, 2016, 03:41 PM
                    There is a one line fix to continue to use TinyMCE which is to remove line 231 from core/components/tinymce/tinymce.class.php

                    $this->config['resource'] = $this->config['resource']->toArray();

                    Thanks, that fixes it for me.
                      • 33977
                      • 2 Posts
                      Instead of a blank page, I've got the error message below. Thanks Jay, that fixes it for me as well.

                      Fatal error: Uncaught Error: Call to a member function get() on array in /manager/controllers/default/resource/resource.class.php:152 Stack trace: #0 /core/model/modx/modmanagercontroller.class.php(158): ResourceManagerController->firePreRenderEvents() #1 /core/model/modx/modmanagerresponse.class.php(74): modManagerController->render() #2 /core/model/modx/modmanagerrequest.class.php(180): modManagerResponse->outputContent(Array) #3 /core/model/modx/modmanagerrequest.class.php(128): modManagerRequest->prepareResponse() #4 /manager/index.php(62): modManagerRequest->handleRequest() #5 {main} thrown in /manager/controllers/default/resource/resource.class.php on line 152