1

I have one page in my site with flash, but I have a problem. When I try to execute dircetly the file site.com/amfphp/gateway.php I get this error:

Fatal error: Uncaught exception 'VerboseException' with message 'Non-static method CharsetHandler::setMethod() should not be called statically, assuming $this from incompatible context' in ....

function service() {

//Set the parameters for the charset handler
CharsetHandler::setMethod($this->_charsetMethod); // the problem point 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('?');

How can I fix this?

Chris
  • 4,672
  • 13
  • 52
  • 93

1 Answers1

0

Apparently the setMethod function of the CharsetHandler class isn't static. That means you can't call it unless you have an instance of that class. Alexander's suggestion to call setMethod on each of the two instances is appropriate. Your code should read:

function service() {

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

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

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

This should work if the other two methods you call staticaly are indeed static.