We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16450
    • 15 Posts
    I have created a custom Module, but it throws PHP Strict errors. The code runs fine, it’s just pickiness.
    Anyway ... when MODx runs the module the errors are thrown, so the System Events log gets huge.
    I’ve tried tweaking every call to "error_reporting" that I can find but no luck.
    How can I stop the module parser from picking these up?!?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Well, I can think of two options. First (and what I always do) fix the errors. Surround code using a variable that may or may not exist with if... blocks, make sure all array keys have quotes, etc. Second, set your base error_reporting in the main (or the manager) .htaccess file.
        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
        • 16450
        • 15 Posts
        Unfortunately the scripts that are throwing errors are a third party plugin .. ugh...
        stuff like:
        "Strict Standards: Assigning the return value of new by reference is deprecated in ...."

        That’s annoying .. I’ll try the .htaccess again, I had set error_reporting in the some of the index.php scripts (ex: at webroot, and /manager/) but that didn’t do anything.
          • 16450
          • 15 Posts
          If I run my custom thing outside of the manager (and subsequently, the modules), it doesn’t show the errors because in the module i have error_reporting set to 0; however, the manager/modules still catches these errors, most likely due to the `eval()` I’m guessing.

          This is so frustrating.
            • 16450
            • 15 Posts
            ... the continuing saga ....

            I’m using 0.9.6.1p2

            so ... in manager/processors/execute_module.processor.php on line 102, there is:
            if(!strpos($php_errormsg,'Deprecated')) { // ignore php5 strict errors
            


            I don’t think that’s being checked is correct, should most likely be:

            if(!stripos($php_errormsg,'Strict Standards')) { // ignore php5 strict errors
            


            since that’s the main ’title’ of the error that comes up. Btw, I’m using PHP 5.1.5

            Thoughts?
              • 22303 MODX Staff
              • 10,725 Posts
                • 16450
                • 15 Posts
                Ah yeah, that would be another option.
                Thanks!