Zend Framework

Class mapping with autoloader

Details

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

Description

Dispatching Remote Object calls from Flex to PHP, object parameters are not mapped correctly and an exception is thrown "exception 'Zend_Amf_Exception' with message 'Unable to parse null body data My_Mapped_Vo mapped class is not defined' in ...".

class My_Mapped_Vo {} locates in models/My/Mapped/Vo.php where models-directory is set in include path and ZF autoloader is registered. The problem can be rounded using explicit class mapping setClassMap("My_Mapped_Vo", "My_Mapped_Vo") but this is needed only when passing objects as parameters to service calls. Service calls are mapped correctly without explicitly using setClassMap().

Activity

Hide
Juan Manuel Tissera added a comment -

Hi, I currently solve this problem modifing Zend/Amf/Parse/TypeLoader.php (1.7.7) on line 105 replacing "return false;" by "return $className;". I'm not sure if this patch is right, but I'll be trying it for a while. Probably, this will cause unexpected behavior.

In my AS3 class, I put "[RemoteClass(alias="My_Mapped_Vo")]" and it works fine without setClassMap.

What do you think?

JMT

Show
Juan Manuel Tissera added a comment - Hi, I currently solve this problem modifing Zend/Amf/Parse/TypeLoader.php (1.7.7) on line 105 replacing "return false;" by "return $className;". I'm not sure if this patch is right, but I'll be trying it for a while. Probably, this will cause unexpected behavior. In my AS3 class, I put "[RemoteClass(alias="My_Mapped_Vo")]" and it works fine without setClassMap. What do you think? JMT
Hide
Maurice Fonk added a comment -

I can confirm that Juan's simple fix solves the same issue for me.

Show
Maurice Fonk added a comment - I can confirm that Juan's simple fix solves the same issue for me.
Hide
Tero Nurminen added a comment -

I can also confirm that JMT's solution fixes the problem. (In version 1.7.4, the correct line would be 95 )

Show
Tero Nurminen added a comment - I can also confirm that JMT's solution fixes the problem. (In version 1.7.4, the correct line would be 95 )
Hide
Tero Nurminen added a comment -

The TypeLoader.php hasn't had any changes from 1.7.7 to 1.8.0, so I suggest patching the file with JMT's solution.

Show
Tero Nurminen added a comment - The TypeLoader.php hasn't had any changes from 1.7.7 to 1.8.0, so I suggest patching the file with JMT's solution.
Hide
Tero Nurminen added a comment -

The SVN revision 15454 is also broken and the same fix addresses the problem.

Show
Tero Nurminen added a comment - The SVN revision 15454 is also broken and the same fix addresses the problem.
Hide
Wade Arnold added a comment -

Although it is not changed the way you have suggested the changes in the incubator should resolve this issue both ways. By default all class mapping to and from php defaults to the class name. Please check out zend_amf_server and Zend_amf_parse_typeloader from the incubator and let me know if it does not resolve your feature request. I'll add your suggestion if it does not do the trick!

Show
Wade Arnold added a comment - Although it is not changed the way you have suggested the changes in the incubator should resolve this issue both ways. By default all class mapping to and from php defaults to the class name. Please check out zend_amf_server and Zend_amf_parse_typeloader from the incubator and let me know if it does not resolve your feature request. I'll add your suggestion if it does not do the trick!
Hide
Tero Nurminen added a comment -

Replacing the Zend/Amf-directory with the incubator's version, I got the following error:

HTTP/1.1 200 OK
Date: Tue, 12 May 2009 07:03:57 GMT
Server: Apache/2.0.59 (Unix) PHP/5.2.6 DAV/2
X-Powered-By: PHP/5.2.6
Content-Length: 599
Content-Type: text/html

<br />
<b>Warning</b>: require_once(Zend/Amf/Value/MessageBody.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in <b>/Users/tero/Zend/Svn/incubator/Zend/Amf/Server.php</b> on line <b>31</b><br />
<br />
<b>Fatal error</b>: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'Zend/Amf/Value/MessageBody.php' (include_path='.:../library:../application/default/models/:.:/Applications/MAMP/bin/php5/lib/php') in <b>/Users/tero/Zend/Svn/incubator/Zend/Amf/Server.php</b> on line <b>31</b><br />

Show
Tero Nurminen added a comment - Replacing the Zend/Amf-directory with the incubator's version, I got the following error: HTTP/1.1 200 OK Date: Tue, 12 May 2009 07:03:57 GMT Server: Apache/2.0.59 (Unix) PHP/5.2.6 DAV/2 X-Powered-By: PHP/5.2.6 Content-Length: 599 Content-Type: text/html <br /> <b>Warning</b>: require_once(Zend/Amf/Value/MessageBody.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in <b>/Users/tero/Zend/Svn/incubator/Zend/Amf/Server.php</b> on line <b>31</b><br /> <br /> <b>Fatal error</b>: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'Zend/Amf/Value/MessageBody.php' (include_path='.:../library:../application/default/models/:.:/Applications/MAMP/bin/php5/lib/php') in <b>/Users/tero/Zend/Svn/incubator/Zend/Amf/Server.php</b> on line <b>31</b><br />
Hide
Romain Fromi added a comment -

I had exactly the same problem, and I can comfirm that JMT's solution fixes it.

Show
Romain Fromi added a comment - I had exactly the same problem, and I can comfirm that JMT's solution fixes it.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated: