We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18438
    • 3 Posts
    PHP 5.3.0 introduced a new error level called E_DEPRECATED, which is triggered when PHP detects use of a function marked deprecated (see http://php.net/manual/en/migration53.deprecated.php for a complete list).
    That said, MODx 0.9.6.3 running under PHP 5.3.0 throws an error similar to the following:

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »
     
    PHP error debug
      Error: 	Function split() is deprecated	 
      Error type/ Nr.: 	- 8192	 
      File: 	/var/www/html/funfly/cms/manager/includes/document.parser.class.inc.php	 
      Line: 	844	 
      Line 844 source: 	$tempSnippetParams= split($splitter, $tempSnippetParams); 	 
     
    Parser timing
      MySQL: 	0.0008 s	(0 Requests)
      PHP: 	0.0259 s	 
      Total: 	0.0267 s


    While the error itself is rather obvious, it’s not immediately clear how to get rid of it, as the document parser happily ignores the error_reporting setting in the config file.
    So, to get rid of the error, do the following:

    1) in your MODx config file, set the error reporting to ignore deprecated functions (line 13):
    error_reporting(E_ALL & ~E_DEPRECATED | E_STRICT);

    is a good value for development, while
    error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED)

    should be okay for production.

    2) in manager/includes/document.parser.class.php, change line 2502 (aww, almost a GitS reference tongue) from:
    if (error_reporting() == 0 || $nr == 0 || ($nr == 8 && $this->stopOnNotice == false)) {

    to:
    if (error_reporting() == 0 || $nr == 0 || (error_reporting() & $nr) != $nr || ($nr == 8 && $this->stopOnNotice == false)) {

    which will make the error handling function actually ignore errors you don’t care about & disabled their handling in the config file.

    Not sure if it also affects evo/revo as I haven’t gotten to playing around with them yet.

    I probably should’ve posted this to JIRA, but I think more people will see it here -- feel free to slap me for my laziness wink

    EDIT: fixed a runaway bracket

    EDIT 2: posted to JIRA as MODX-863
      • 28215
      • 4,149 Posts
      Thanks for catching this.

      Please post in JIRA so it doesn’t get lost here.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 25663 MODX Staff
        • 12,272 Posts
        Anyone confirm with Evo RC?
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 18438
          • 3 Posts
          Just checked - evo 1.0.0-rc1 is also affected; same symptoms, same fix applies.

          Sadly, another bug emerged: while trying to log in to manager, following errors appear:
          I) Deprecated: Assigning the return value of new by reference is deprecated in (cut)modx_evo/manager/includes/browsercheck.inc.php on line 16.
          (also applies to 0.9.6.3)

          II) Notice: Use of undefined constant SNIPPET_INTERACTIVE_MODE - assumed ’SNIPPET_INTERACTIVE_MODE’ in (cut)modx_evo/manager/includes/document.parser.class.inc.php on line 1982
          Notice: Use of undefined constant SNIPPET_INSTALL_MODE - assumed ’SNIPPET_INSTALL_MODE’ in (cut)/modx_evo/manager/includes/document.parser.class.inc.php on line 1985
          (multiple times, new to 1.0.0-rc1).
          This is output before even the doctype, so nothing is visible except the error message (at least in Firefox 3.0.11/Linux).

          Fixes:

          1) browsercheck.inc.php:
          line 16 becomes:
          $client = new phpSniff($GET_VARS[’UA’],$sniffer_settings);

          2) document.parser.class.inc.php:
          line 1982 becomes:
          if (defined(’SNIPPET_INTERACTIVE_MODE’) && SNIPPET_INTERACTIVE_MODE == ’true’)
          and line 1985 becomes:
          if (defined(’SNIPPET_INSTALL_MODE’) && SNIPPET_INSTALL_MODE == ’true’)
          (and this should probably also apply to line 1980, just for sake of code strictness).

          From there, the manager loads okay, but throws a lot of notices concerning undefined variables/indices in multiple files, obstructing the top menu and the document tree...
          (error_reporting set to E_ALL & ~E_DEPRECATED | E_STRICT; see http://img401.imageshack.us/img401/2589/manager.jpg for a screenshot).
          Disabling E_NOTICE hides these messages and makes the interface usable, but it kind of misses the point for a development install, and totals for a lot of hoops to jump through just to make the install usable.
            • 10487 MODX Staff
            • 1,535 Posts
            Hi Marshall, thanks for the reports smiley

            I will be reviewing the ticket (MODX-863) over the next few days - I can well imagine there will be numerous issues with this new E_DEPRECATED setting and the current Evo codebase.
              Garry Nutting
              Senior Developer
              MODX, LLC

              Email: [email protected]
              Twitter: @garryn
              Web: modx.com
              • 18438
              • 3 Posts
              Glad to be of assistance - it’s the least I can do to give something back to this wonderful community smiley
              Keep up the good work, guys & girls!
                • 30969
                • 1 Posts
                Here’s another one:
                [tt]PHP Deprecated: Assigning the return value of new by reference is deprecated in /path/to/manager/includes/browsercheck.inc.php on line 16[/tt]

                Sorry I don’t have a patch for this.
                  • 25663 MODX Staff
                  • 12,272 Posts
                  Please continue all further discussions about this issue in JIRA: http://svn.modxcms.com/jira/browse/MODX-863

                  That way we won’t overlook any of the solutions/issues reported related to this. Thanks!
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me

                  This discussion is closed to further replies. Keep calm and carry on.