We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3316
    • 28 Posts
    Hi All,

    I am running MODx Evo 1.0.5. I have a client site hosted with Media Temple and they recently upgraded their PHP version to 5.3.13. This has caused an error in my manager. When I click on a resource in the site tree to edit the resource, I see the following error at the bottom of the main window frame:

    Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c07/h03/mnt/123456/domains/xyzdomain.com/html/manager/includes/Text/Diff.php on line 383

    Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c07/h03/mnt/123456/domains/xyzdomain.com/html/manager/includes/Text/Diff.php on line 405

    Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c07/h03/mnt/123456/domains/xyzdomain.com/html/manager/includes/Text/Diff.php on line 427

    Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c07/h03/mnt/123456/domains/xyzdomain.com/html/manager/includes/Text/Diff.php on line 449

    Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c07/h03/mnt/123456/domains/xyzdomain.com/html/manager/includes/Text/Diff/Renderer.php on line 103

    Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c07/h03/mnt/123456/domains/xyzdomain.com/html/manager/includes/Text/Diff/Renderer.php on line 123

    I don't know enough PHP to really understand the error, but I do know it is some sort of conflict with the new PHP version.

    The real problem that develops is when I go to edit a rich content box, all the regular quotation marks gets escaped by php escape mark thingies like this: "\" or similar. It basically messes up all the code in any of the rich content editor boxes whether or not I have the rich content box checked on the settings tab.

    Anyone know how I can fix this? Thanks.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The second problem is because the new PHP has "magic_quotes_gpc" turned on. You need to ask your host how to turn it off. You may be able to add a line to your .htaccess file, or you may need to have a custom php.ini file in your /manager/ directory.

      As far as the deprecated messages, if you go to the files and the line numbers indicated, you'll see something like this:
      $object =& new MyObject();
      

      You can just remove the &.

      In PHP 4, a "new" object was created as a copy of the original object, so anything you did with it had no effect on the original. Adding the & caused it to create, not a copy, but a reference (or pointer) to the original, so that when you made changes it changed the actual original object. http://www.php.net/manual/en/oop4.newref.php

      PHP 5 now creates objects as identifiers that point to the actual object by default, so a "new" one would be a copy of the identifier, still pointing to the same object, and the & is no longer needed. http://www.php.net/manual/en/language.oop5.references.php




        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
        • 3316
        • 28 Posts
        Susan Ottwell does it again! Thanks so much Susan, you are a hero. Easy fix worked perfectly.