AMFPHP 1.9 problem with PHP 5.4

By | 27 May, 2013

I was developing an application at work that used amfphp 1.9. All was working until i decided to bring it home to work over the weekend (thats already a bad thing to do right there), and i started getting errors. At work i use windows 7+xampp (with php 5.3.8), at home i use windows 8+xampp (with php 5.4.7). Identifying the possible culprit was easy enough, but fixing the problem was something else. What i knew was that amfphp version 1.9 had some issues with later versions of PHP.

After using Charles (if you dont know what it is, see -> here) to sniff the amf communication, i saw some errors like this:

‘Fatal error: Uncaught exception ‘VerboseException’ with message ‘Non-static method CharsetHandler::getMethod() should not be called statically’ in…’

Looking at the lines of the files mentioned on the errors and searching in google, i found some possible solutions. The one that worked was to make all the php functions listed as non static (therefore giving the error), static.

The list of the functions that give errors is:

-Executive::buildClass (php5Executive.php)
-Executive::deferredMethodCall (php5Executive.php)
-Executive::doMethodCall (php5Executive.php)
-Executive::includeClass (php5Executive.php)

In case you are a newbie in programming, or life itself, the files to edit are inside “core” directory, spread over the folders inside it, and their names are the strings between the “-” and the “::” in the listing above. (i.e. for “-CharsetHandler::getMethod”, the filename is “CharsetHandler.php”)

UPDATED: Added sebpatu’s correction (see comments). Thanks.

Credits go to this forum thread:

3 thoughts on “AMFPHP 1.9 problem with PHP 5.4

  1. sebpatu

    the list lacks -MethodTable::create that also needs to be static.
    With all that it works fine.

  2. 42 Post author

    Added Methodtable::create to the list.

    Thanks, sebpatu. :)

  3. Tristan

    Thx, mate. I knew it had something to do with static functions, but I didn’t think to check the core files of amfphp itself. This has been a real help!

Comments are closed.