We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 47318
    • 2 Posts

    Im a new developer in Modx, and the previous developer didnt give me any documentation about his project. And now i have to maintain his project.

    everytime i open the front end website, i have Fatal error: Call-time pass-by-reference has been removed in /var/www/mysite/core/cache/includes/elements/modsnippet/28.include.cache.php on line 11

    here is the code in 28.include.cache.php

    line 09....$req = require_once(MODX_BASE_PATH . 'core/components/mysite/model/mysite.class.php');
    line 10....if(!isset($modx->mysite)){
    line 11.... $modx->mysite = new mysite(&$modx);
    line 12....}

    Is there someone who experience the same thing like me?

    whenever i change the cache,
    from $modx->mysite = new mysite(&$modx); to $modx->mysite = new mysite($modx);

    i can display it, but then again since its in cache, later on if the cache was restored, and generated a new one, it will rewrite it and gave me error again.

    is there away to debug where he wrote the cache?

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Find that line in the actual snippet's code.
        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
        • 36426
        • 197 Posts
        Hi sorry to jump on the thread by I'm now getting this error on a lot of sites since a php upgrade on the server. I don't know how many or which sites are effected though - so is there something that can be done to fix them all on the server from WHM or cPanel or Apache rebuild etc?

        Or even a linux command line solution from SSH to batch fix everything?

        Thanks for any help at all.
          Yorkshire UK based hosting provider: https://www.simulant.uk
          • 3749
          • 24,544 Posts
          This is no longer valid PHP:

          $modx->mysite = new mysite(&$modx);


          If you put &$modx as an argument in the constructor, it will have the same effect and be legal.

            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
            • 36426
            • 197 Posts
            Hi Bob I thought this was all a bit strange having to update code in modx or current plugins when everything should already work with PHP 5.4 - turns out it was down to an SQL injection hack! The sites had been attacked that weren't working but the attack hadn't been visible until the PHP upgrade!

            Thanks for the help anyway.
              Yorkshire UK based hosting provider: https://www.simulant.uk