We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22629
    • 194 Posts
    I’ve just installed MODx 0.9.6.2-rc2, and got this error:

    Fatal error: Call to undefined method DocumentParser::mapPath() in /srv/www/htdocs/sanctree/manager/includes/document.parser.class.inc.php(769) : eval()’d code on line 20

    Has mapPath() disappeared from the API? I’ve used it in practically every snippet, module and plugin I’ve ever written.
    It worked in 0.9.6.2-rc1. IMHO you shouldn’t remove such a vital function in an API within -rc releases - it’s going to be a major task for me to change this particular bit of code, having spent the last 3 months building on 0.9.6.2-rc1.

    Is there an alternative way of finding the MODx path without hard-coding, or reading the config file in every snippet etc?
      Andy Shellam | www.networkmail.eu | @Pandy06269 @NetworkMail

      modx Revolution 2.2.6
      Windows 2012 | IIS 8 | php 5.4.11 | MySQL 5.5.29

      Content-Managed Websites Built on MODX
      • 22629
      • 194 Posts
      For the time being of rolled back to 0.9.6.2-rc1 until I find out more about what’s going on with this.
        Andy Shellam | www.networkmail.eu | @Pandy06269 @NetworkMail

        modx Revolution 2.2.6
        Windows 2012 | IIS 8 | php 5.4.11 | MySQL 5.5.29

        Content-Managed Websites Built on MODX
      • Not sure why you were using that function, but the mapPath() function was incorrect and rather than fix it and leave many different ways to get to the paths, it is recommended that you use the constants defined for these paths:

        MODX_BASE_PATH
        MODX_BASE_URL
        MODX_SITE_URL
        MODX_MANAGER_PATH
        MODX_MANAGER_URL

        or the config equivalents:

        $modx->config[’base_path’]
        $modx->config[’base_url’]
        $modx->config[’site_url’]
        $modx->config[’manager_path’]
        $modx->config[’manager_url’]

        which can also be used in tags:

        [(base_path)]
        [(base_url)]
        [(site_url)]
        [(manager_path)]
        [(manager_url)]

        I’ve written a lot of components for MODx and never been even tempted to use mapPath(). It probably should not have been just removed (bit hasty), but it would help you transition to Revolution more easily if you went ahead and modified your use of mapPath with the configuration variables or constants above; these will always be available and always accurate. This change will allow us to solve some long-standing issues in making the manager easier to get working on more environments.
          • 22629
          • 194 Posts
          Quote from: OpenGeek at Aug 07, 2008, 10:58 PM

          Not sure why you were using that function, but the mapPath() function was incorrect and rather than fix it and leave many different ways to get to the paths, it is recommended that you use the constants defined for these paths:

          Mainly because it’s in the documentation: http://modxcms.com/mappath.html, whereas I couldn’t find the constants in the docs anywhere. When an API function is documented, you don’t tend to think it’s use is unsafe, or going to be removed.

          Quote from: OpenGeek at Aug 07, 2008, 10:58 PM
          I’ve written a lot of components for MODx and never been even tempted to use mapPath(). It probably should not have been just removed (bit hasty), but it would help you transition to Revolution more easily if you went ahead and modified your use of mapPath with the configuration variables or constants above; these will always be available and always accurate. This change will allow us to solve some long-standing issues in making the manager easier to get working on more environments.

          OK I’ll change to use a constant as long as they’re going to stay around. A better approach would have been to "depreciate" the function - if user has error reporting turned on, log or display a warning: "this function has been deprecated, please use MODX_BASE_PATH or $modx->config[’base_path’] instead."

          The change you made could break sites completely (like my development site) - but if this was a stable release, and I’d gone and installed it over my 0.9.6.1 live site, it would have destroyed my live site.
            Andy Shellam | www.networkmail.eu | @Pandy06269 @NetworkMail

            modx Revolution 2.2.6
            Windows 2012 | IIS 8 | php 5.4.11 | MySQL 5.5.29

            Content-Managed Websites Built on MODX
          • Again, I never ever used the function; it was used in the manager at one time but removed long ago, and I didn’t document it, nor ever would have. It causes problems on certain platforms and generally just never seemed to be a useful function to me. Yes it should have been deprecated (I assume you didn’t really mean depreciate, though that would be a lot cooler), but damage done. I truly didn’t think anyone used the function at all, and will refrain from making those assumptions in the future.
            • It’s in the Wiki as well... http://wiki.modxcms.com/index.php/API:mapPath
                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
              • Thanks for updating the wiki with the information.