We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8425
    • 159 Posts
    Hello,
    I’m running into something weird. My host provider hostpapa upgraded to php 5.3.6 and things started to mess up with the extra quotes.
    I put magic_quotes_gpc = Off statement into my php.ini and I’ve created a file phpinfo.php to check the results as follow:
    <html>
    <body>
    <?php 
    phpinfo(); 
    ?>
    </body>
    </html>

    When I run it it shows that the magic quotes are Off but when I check in Modx (I’m using 1.0.4) under Reports->System Info ->View magic_quotes_gpc are On which creates lots of problems.
    Does anyone know what’s happening? First the magic-quotes are still turned on on the server and hostpapa is no help. Second why when I check www.myDomain/phpinfo.php the magic quotes show Off?
    Thanks in advance for any help in this as it is driving me crazy...
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Custom php.ini files are not inherited across folders as .htaccess files are. You need to have the php.ini files in each folder that has a .php file being executed. In the case of MODx Evo, that means you need one in the /manager folder to deal with the Manager’s forms (run via the manager/index.php file) as well as one in the root (where the main index.php file is). What you are seeing with your phpinfo.php file is the result for the folder that file is in, but the directive isn’t being applied to the Manager folder.
        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
        • 8425
        • 159 Posts
        Thank you for your quick reply.
        When I copy the php.ini file under manager directory I cannot login into the manager anymore. The login form displays fine but when I click ’Login’ nothing happens. Do you know why?
        Thanks
          • 8425
          • 159 Posts
          Ok, I fixed it by adding this script in the config.inc.php. I hope it is helpful to somebody else as I’ve spent way too much time in this thing.
          // Added by EclipseTalk
          if (get_magic_quotes_gpc()) {
              $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
              while (list($key, $val) = each($process)) {
                  foreach ($val as $k => $v) {
                      unset($process[$key][$k]);
                      if (is_array($v)) {
                          $process[$key][stripslashes($k)] = $v;
                          $process[] = &$process[$key][stripslashes($k)];
                      } else {
                          $process[$key][stripslashes($k)] = stripslashes($v);
                      }
                  }
              }
              unset($process);
          }
            • 22303 MODX Staff
            • 10,725 Posts
            Your host needs to get rid of the magic_quotes_gpc On setting TBH. It is a deprecated feature in 5.3 and will trigger deprecated warnings in PHP if this code is used. This is why it was removed...