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:
-CharsetHandler::getMethod
-CharsetHandler::getPhpCharset
-CharsetHandler::getSqlCharset
-CharsetHandler::setMethod
-CharsetHandler::setPhpCharset
-CharsetHandler::setSqlCharset
-DateWrapper::getTimezone
-DateWrapper::setTimezone
-Executive::buildClass (php5Executive.php)
-Executive::deferredMethodCall (php5Executive.php)
-Executive::doMethodCall (php5Executive.php)
-Executive::includeClass (php5Executive.php)
-Headers::getHeader
-Headers::setHeader
-MessageException::getFriendlyError
-MessageException::throwException
-MethodTable::cleanArguments
-MethodTable::cleanComment
-MethodTable::create
-MethodTable::getClassMethodsReflection
-MethodTable::getClassMethodsTokenizer
-MethodTable::getMethodArguments
-MethodTable::getMethodCommentArguments
-MethodTable::getMethodCommentAttribute
-MethodTable::getMethodCommentAttributeFirstLine
-MethodTable::getMethodCommentAttributeFirstWord
-MethodTable::getMethodDescription
-NetDebug::getTraceStack
-NetDebug::initialize
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:
the list lacks -MethodTable::create that also needs to be static.
With all that it works fine.
Thanks
Added Methodtable::create to the list.
Thanks, sebpatu. :)
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!