Zend Framework

"Unknows Definition" error when sending simple untyped objects

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.10.2
  • Fix Version/s: None
  • Component/s: Zend_Amf
  • Labels:
    None

Description

I upgraded to PHP 5.3.2 and Zend Framework 1.10.2 at the same time. Afterwards, a simple AMF call that used to work no longer does. When passing several untyped arrays ("Object" types from Flex) to the PHP function, the result is the following exception, which makes no sense to me:

<b>Fatal error</b>: Uncaught exception 'Zend_Amf_Exception' with message 'Unknows Definition reference: 0' in C:\svn\zend\ZendFramework-1.10.2-minimal\library\Zend\Amf\Parse\Amf3\Deserializer.php:304
Stack trace:
#0 C:\svn\zend\ZendFramework-1.10.2-minimal\library\Zend\Amf\Parse\Amf3\Deserializer.php(106): Zend_Amf_Parse_Amf3_Deserializer->readObject()
#1 C:\svn\zend\ZendFramework-1.10.2-minimal\library\Zend\Amf\Parse\Amf0\Deserializer.php(293): Zend_Amf_Parse_Amf3_Deserializer->readTypeMarker()
#2 C:\svn\zend\ZendFramework-1.10.2-minimal\library\Zend\Amf\Parse\Amf0\Deserializer.php(130): Zend_Amf_Parse_Amf0_Deserializer->readAmf3TypeMarker()
#3 C:\svn\zend\ZendFramework-1.10.2-minimal\library\Zend\Amf\Parse\Amf0\Deserializer.php(217): Zend_Amf_Parse_Amf0_Deserializer->readTypeMarker()
#4 C:\svn\zend\ZendFramework-1.10.2-minimal\library\Zend\Amf\Parse\Amf0\Deserializer.php(106): Zend_Amf_Parse_Amf0_Deserializer->readArray()
#5 C:\svn\zend\ZendFramework-1.10.2-minimal\library\Zend\Amf\Request.php(173): Zend_Amf_Parse_Amf0_Deseria in <b>C:\svn\zend\ZendFramework-1.10.2-minimal\library\Zend\Amf\Request.php</b> on line <b>176</b><br />

I will attach a skeleton PHP sample that exhibits the behavior. The calling code is a Flex function that looks like so:

public function login(username:String, password:String):void

{ var session:Object = new Object(); session['code'] = _sessionID; var loginInfo:Object = new Object(); loginInfo['username'] = username; loginInfo['password'] = SHA1.encrypt(_authSalt+password); var everything:Object = new Object(); everything['session_info'] = session; everything['login_method'] = "password"; everything['login_blob'] = loginInfo; var responder:Responder = new Responder(onLogin, onNetworkingError); _conn.call("XCRpcProtocol_AMF.login", responder, session, "password", loginInfo); }

In this example case it is called with both parameters set to "". I will attach the binary input (saved from Charles proxy) in case you have a method of importing it directly, to simplify repro. Thanks!

  1. example.as
    05/Mar/10 5:34 PM
    0.6 kB
    Eric Heimburg
  2. input.bin
    05/Mar/10 5:31 PM
    0.1 kB
    Eric Heimburg
  3. test.php
    05/Mar/10 5:31 PM
    0.9 kB
    Eric Heimburg

Activity

Hide
Eric Heimburg added a comment -

test.php is a very simple example that does nothing much. (I am sure you will need to change the include path, I was making sure that the correct Zend library was getting used.)

input.bin is the binary data that is generated by the Flex client application, which causes the error.

Show
Eric Heimburg added a comment - test.php is a very simple example that does nothing much. (I am sure you will need to change the include path, I was making sure that the correct Zend library was getting used.) input.bin is the binary data that is generated by the Flex client application, which causes the error.
Hide
Eric Heimburg added a comment -

The code snippet I pasted originally got malformed; here it is again as example.as. Not actually runnable, but it's pretty understandable (as it doesn't do much).

Show
Eric Heimburg added a comment - The code snippet I pasted originally got malformed; here it is again as example.as. Not actually runnable, but it's pretty understandable (as it doesn't do much).
Hide
Max Wagner added a comment -

Same exact exception and callstack. Using ZendFramework 1.11.3, PHP 5.3.2. In my case, it's only when I add a third argument to my PHP function, and only when that third argument is an object (can pass string and int fine).

in PHP service:
function failsToGetCalledFromAS3($tableName, $rowAsObject, $whereExpression)

{ return TRUE; }

from AS3:
connection.gateway.call("DevDb.failsToGetCalledFromAS3",new Responder(onResponse,onFault),tableName,row,{someValue:"128"});

Show
Max Wagner added a comment - Same exact exception and callstack. Using ZendFramework 1.11.3, PHP 5.3.2. In my case, it's only when I add a third argument to my PHP function, and only when that third argument is an object (can pass string and int fine). in PHP service: function failsToGetCalledFromAS3($tableName, $rowAsObject, $whereExpression) { return TRUE; } from AS3: connection.gateway.call("DevDb.failsToGetCalledFromAS3",new Responder(onResponse,onFault),tableName,row,{someValue:"128"});
Hide
Max Wagner added a comment -

The obvious workaround I guess is just to pass all parameters to RPCs as a single array of arguments, and extract them inside my own functions. Seems a little ghetto but it works so far.

Show
Max Wagner added a comment - The obvious workaround I guess is just to pass all parameters to RPCs as a single array of arguments, and extract them inside my own functions. Seems a little ghetto but it works so far.

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated: