We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19889
    • 616 Posts
    Hello
    I don’t know whether I’m doing something wrong or if there is an error somewhere

    when I echo the following:
    //$charset = $GLOBALS[’database_connection_charset’];
    echo ’type: ’ . gettype($this->config[’charset’]);
    $charset = $charset ? $charset : $this->config[’charset’];

    I get "string" - if I just echo gettype($charset), I’m getting NULL?
      • 22303 MODX Staff
      • 10,725 Posts
      The code you are showing there has the line which assigns the charset variable commented out huh I don’t understand the problem here.
        • 19889
        • 616 Posts
        this is the original line in the file: $charset = $charset ? $charset : $this->config[’charset’]; that causes the error

        to fix it, I did the following change:
        //$charset = $charset ? $charset : $this->config[’charset’];
        $charset = $this->config[’charset’];
          • 14230
          • 3 Posts
          I received this very same error out of the blue. What causes it?
            • 19889
            • 616 Posts
            I fixed it like this:
            $charset = isset($charset) ? $charset : $this->config['charset'];
              • 14230
              • 3 Posts
              When I change it to your suggestion the site just comes up blank?? Does not even show the debug stuff which was:

              « MODx Parse Error »
              MODx encountered the following error while attempting to parse the requested resource:
              « PHP Parse Error »

              PHP error debug
              Error: Undefined variable: charset
              Error type/ Nr.: Notice - 8
              File: /home/jbinfoman/modx1.magnabait.net/manager/includes/extenders/dbapi.mysql.class.inc.php
              Line: 86
              Line 86 source: $charset = $charset ? $charset : $this->config[’charset’];

              When I change it back the debug works again showing the above?

              Lost here....any idea what is going on? Here are both lines I have tried on line 86 of the file:

              $charset = $charset ? $charset : $this->config[’charset’]; //this was the origional
              $charset = isset($charset) ? $charset : $this->config[’charset’]; //this was your recommended line

              using the second line I just get a blank site at my domain. The first yields the error above when debug is on to show it......

                • 25388
                • 31 Posts
                I fixed it with commenting out some of the last lines in index.php (renamed to default.php in my case because of a parallel installation). Hope this helps somebody...

                // execute the parser if index.php was not included
                //if (!MODX_API_MODE) {
                    $modx->executeParser();
                //}
                ?>