I get error with amfphp

110 Views Asked by At

How can i solve this problem? The error is: Fatal error: Using $this when not in object context in /.../amfphp/core/amf/app/Gateway.php on line 134

public static function service() {

        //Set the parameters for the charset handler
        CharsetHandler::setMethod($this->_charsetMethod); // the problem points here
        CharsetHandler::setPhpCharset($this->_charsetPhp);
        CharsetHandler::setSqlCharset($this->_charsetSql);

        //Attempt to call charset handler to catch any uninstalled extensions
        $ch = new CharsetHandler('flashtophp');
        $ch->transliterate('?');

        $ch2 = new CharsetHandler('sqltophp');
        $ch2->transliterate('?');

        $GLOBALS['amfphp']['actions'] = $this->actions;
1

There are 1 best solutions below

2
Ivan Kalita On

You can't use $this variable inside static methods, cause class instance does not exist. Static methods know nothing about instance of the class, you can treat these methods as class methods, not instance methods. Looks like you need to remove static modifier of this function. Check the docs for further explanation.