We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1887
    • 50 Posts
    I have migrated to a new server and MODX Revo is working fine under v2.2 but when I run the /setup to upgrade to v2.5.2, I get a

    Fatal error: Call to a member function checkPolicy() on null in /var/www/URL/core/model/modx/modx.class.php on line 1881

    This is after /setup has confirmed that everything is ok. I have checked the config files to make sure the URLs are right and tried deleting the contents of /core/cache

    The full error message is:

    ( ! ) Fatal error: Call to a member function checkPolicy() on null in /var/www/URL/core/model/modx/modx.class.php on line 1881
    Call Stack
    # Time Memory Function Location
    1 0.0000 232296 {main}( ) .../index.php:0
    2 0.0019 563600 modInstallRequest->handle( ) .../index.php:101
    3 0.0037 639408 include( '/var/www/URL/setup/controllers/install.php' ) .../modinstallrequest.class.php:77
    4 0.0041 664440 modInstallRunner->run( ) .../install.php:19
    5 0.0041 664912 modInstallRunnerWeb->execute( ) .../modinstallrunner.class.php:36
    6 0.0326 2619104 modInstallVersion->install( ) .../modinstallrunnerweb.class.php:33
    7 0.0350 2743728 include_once( '/var/www/URL/setup/includes/upgrades/mysql/2.4.0-pl.php' ) .../modinstallversion.class.php:75
    8 0.1910 3164976 include( '/var/www/URL/setup/includes/upgrades/common/2.4-user-country-iso.php' ) .../2.4.0-pl.php:17
    9 0.1910 3165384 modX->runProcessor( ) .../2.4-user-country-iso.php:9
    10 0.1920 3390648 modProcessor->run( ) .../modx.class.php:1704
    11 0.1920 3390696 modCountryGetListProcessor->checkPermissions( ) .../modprocessor.class.php:161
    12 0.1921 3390840 modX->hasPermission( ) .../getlist.class.php:13

    What can I do to get it working? The site and manager are reporting a 500 error message.

    core/cache/error.log has:

    [2016-12-08 23:41:48] (ERROR @ /var/www/URL/core/model/modx/modx.class.php : 2323) Could not prepare context: web
    [2016-12-08 23:42:09] (ERROR @ /var/www/URL/core/xpdo/om/xpdoobject.class.php : 240) Error 42S22 executing statement:
    Array
    (
    [0] => 42S22
    [1] => 1054
    [2] => Unknown column 'modContext.name' in 'field list'
    )

    [2016-12-08 23:42:09] (ERROR @ /var/www/URL/core/model/modx/modx.class.php : 2323) Could not prepare context: mgr

    Kind regards

    James

    This question has been answered by voklee. See the first response.

      • 44195
      • 293 Posts
      I'm not sure what's causing it but it might be an idea to revert to your backup of 2.2, then try upgrading to 2.3, then 2.4, then 2.5 etc.

      See if it still happens on that first step.
        I'm lead developer at Digital Penguin Creative Studio in Hong Kong. https://www.digitalpenguin.hk
        Check out the MODX tutorial series on my blog at https://www.hkwebdeveloper.com
        • 3749
        • 24,544 Posts
        It appears that you tried to make too big a jump in MODX versions and skipped over the major releases.

        Murray's suggestion is the best option, but if it's not possible, this might help: http://bobsguides.com/blog.html/2016/06/27/missing-db-fields-(unknown-column)/
          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
          • 1887
          • 50 Posts
          Thanks Murray and Bob. Will do just that.

          Kind regards

          James
            • 38783
            • 571 Posts
            I had this problem last weekend upgrading two sites from version 2.2.15. The solution was provided by Bert Oost here https://github.com/modxcms/revolution/issues/12764. You need to delete the "name" field you have created after you have upgraded or you end up with multiple contexts in the Manager.
              If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

              email: [email protected] | website: https://andytough.com
            • discuss.answer
              • 39827
              • 42 Posts
              Thnx people the solution of Bert worked great. https://github.com/modxcms/revolution/issues/12764
              I went from 2.2.15 to 2.5.4

              But i did not remove the 'name' field in the modx_context table as AndyTough says.
              I just put their names in the field like you get when you do a clean 2.5.+ install. 'Website' and 'Manager'
              Guess that is not a problem in the futer or will it? (the name column is default in 2.5.+ installs)