ZF-5755: Class mapping with autoloader
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().
Comments
Posted by Juan Manuel Tissera (johnybgood) on 2009-03-18T06:44:44.000+0000
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
Posted by Maurice Fonk (naneau) on 2009-04-19T03:48:03.000+0000
I can confirm that Juan's simple fix solves the same issue for me.
Posted by Tero Nurminen (tero@panic.fi) on 2009-05-09T07:56:07.000+0000
I can also confirm that JMT's solution fixes the problem. (In version 1.7.4, the correct line would be 95 :))
Posted by Tero Nurminen (tero@panic.fi) on 2009-05-09T08:07:07.000+0000
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.
Posted by Tero Nurminen (tero@panic.fi) on 2009-05-09T08:26:11.000+0000
The SVN revision 15454 is also broken and the same fix addresses the problem.
Posted by Wade Arnold (wadearnold) on 2009-05-11T20:30:06.000+0000
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!
Posted by Tero Nurminen (tero@panic.fi) on 2009-05-12T00:14:38.000+0000
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
Warning: require_once(Zend/Amf/Value/MessageBody.php) [function.require-once]: failed to open stream: No such file or directory in /Users/tero/Zend/Svn/incubator/Zend/Amf/Server.php on line 31
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Amf/Value/MessageBody.php' (include_path='.:../library:../application/default/models/:.:/Applications/MAMP/bin/php5/lib/php') in /Users/tero/Zend/Svn/incubator/Zend/Amf/Server.php on line 31
Posted by Romain Fromi (fromi) on 2009-06-14T10:39:27.000+0000
I had exactly the same problem, and I can comfirm that JMT's solution fixes it.
Posted by Rob Allen (rob) on 2012-11-20T20:52:32.000+0000
Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".
Feel free to re-open and provide a patch if you want to fix this issue.