If anyone is using my phpRemoting package, be aware there is a serious bug in AS3's AMF3 implementation and you need to switch the code in the phpAccess file to AMF0.
Here's what's up: The AMF3 encoder is fine sending an array out, and fine receiving a MySQL result set as an object. But if you try to send an array and receive a MySQL result in the same call, the result comes in as null.
Simple example:
Note that this has NOTHING to do with the PHP code being run. In fact, the PHP code is just this:Code:var rs:NetConnection = new NetConnection(); /*uncommenting the following line makes the PHP request return an object. When it is commented, i.e. using AMF3, the PHP request returns null.*/ //rs.objectEncoding = flash.net.ObjectEncoding.AMF0; rs.connect("http://localhost/~strike/barkNet/barknetamfphp/gateway.php"); var rsResponder:Responder = new Responder(gotResult, handleError); var v:Array = new Array("a","b","c"); rs.call("genericEvent.arrayTest",rsResponder,v); function gotResult(re:Object) { trace (re); //returns Object under AMF0, null under AMF3 } function handleError(fe:Object) { }
Interestingly, if you have the code return $arr, you actually get the array right back under AMF3.Code:function arrayTest($arr) { $q = "SELECT * FROM users"; $z = mysql_query($q); return ($z); }
This is a dirty filthy bug that cost me a lot of time and money. BEWARE.
Josh


Reply With Quote