Home > AMFPHP, Flash Platform, Zend_Amf > Major Zend Amf updates for 1.8.4 release

Major Zend Amf updates for 1.8.4 release

June 23rd, 2009

Lots of changes made to Zend Amf made there way into Zend Frameworks next mini release for 1.8.4. I thought that I would run through the major changes. Special thanks to Stefan Klug for all of the patches that he produced! Absolutely grateful sir! This is probably the biggest update to the system since the first release. Please make sure that you test 1.8.4 before you push it into your production environment. Why? Well if your like me you probably built a couple work arounds for some of these bugs. Those work arounds may no longer work once the bug is fixed!

Major Changes

ZF-6641 Shared references are duplicated
ZF-6205 Serializer does not support cyclic references
ZF-6393 Wrong Amf0_Amf3 reference counting
ZF-5382 Multiple calls seems to break the deserializer.
ZF-6625 Zend Amf can load any instantiated PHP class. Security

Minor but significant changes

ZF-6975
Adobe Flash Builder 4 wizard now supports data types for introspection.
ZF-6992 Negative integers on 64 bit system is resolved.
ZF-6775 Unable to send Array’s from Blaze DS.

The 1.8.4 release has already been tagged and should come out sometime today 6/23/2009

AMFPHP, Flash Platform, Zend_Amf

  1. June 23rd, 2009 at 15:49 | #1

    Thanks Wade :) Great work!

  2. Alessio
    June 24th, 2009 at 11:17 | #2

    I downloaded the ‘latest version of zend amf, but when I go to run my site developed in flex me an error that did not gave me:
    code: 0

    Why?

  3. Björn
    June 24th, 2009 at 13:22 | #3

    Hi Wade,
    after updating to 1.8.4 I have some trouble with autoloading classes and Zend_Amf. I used to add a directory to the server with $server->addDirectory() where my classes reside together with $autoloader->setFallbackAutoloader(true) in my bootstrap class. Now I have to add every class with $server->addClass() to not get exceptions thrown about not existing classes. Can you point me to a working example with autoloading?
    Thanks in advance for your help.
    Best regards,
    Björn

  4. Paulo Azevedo
    June 25th, 2009 at 04:00 | #4

    Hello! It seems version 1.8.4 Zend Framework broke all my Zend_AMF applications.

    Didn’t do anything too fancy, they work fine till 1.8.3 and now every service I call returns a AMF fault. No errors on the server side though!

    Any clue what could be wrong ?

  5. June 25th, 2009 at 09:47 | #5

    @pauo @alessio Did you use the full install of zend or just upload the AMF folder? The latest version requires the new Zend Loader or else you will get the errors that you mention.

  6. Railk
    June 25th, 2009 at 10:58 | #6

    Hi, i had the same problem as Paulo.
    I use the addDirectory (that worked fine with 1.8.3) method for service that is now passing by zend loader pluginoader with addPrefixPath.
    I noticed that all my classname where prefixed with ‘_’ (Hello_World => _Hello_World) and so i had an error with class (Hello_World) not found. To fix that i’ve just put if(prefix) before $prefix = $this->_formatPrefix($prefix); in (pluginloader class), so that when there is no prefix set like with zend amf, it does not prefix the class with ‘_’ and then it works again.

    it’s not the best way but that’s the only way i found to fix the problem, is there a better way ?

  7. Felix-Johannes Jendrusch
    June 25th, 2009 at 12:42 | #7

    Hi Wade!

    I really appreciate your work but it’s kind of frustrating not getting a single answer to 2 mails and 1 tweet as I’m trying to contact you. Is there any chance of getting an answer on how service browser request responses have to be formatted?

    Best regards
    Felix

  8. Rob Morgan
    June 25th, 2009 at 22:23 | #8

    Hi Wade,

    I’ve also upgraded to ZF 1.8.4.

    No Idea what I’ve done? or what’s going on? but every service call I make I get a ‘Class “X” does not exist’ remoting fault.

    I’ve even used require_once’s right above my Zend_Amf_Server instantiation. So I don’t see why Zend_Amf shouldn’t be able to see my classes?

    N.B. I’ve used the full install.
    Hope that helps.

    Cheers,

    Rob

  9. Rob Morgan
    June 25th, 2009 at 22:47 | #9

    Hi Wade,

    I downgraded to ZF 1.8.3 and everything is now working fine for me.

    Cheers,

    Rob

  10. June 26th, 2009 at 00:56 | #10

    @Felix, sorry for the delay. Unfortunately Zend Amf is not a paid project for me. I work on it as much as possible but still need to cover rent. THe service browser is in the queue but is dependent on better ArrayCollection support that what currently exists. Once that’s in place i’m sure i will work on the service browser. Donations can change priorities though!

  11. June 26th, 2009 at 00:58 | #11

    @rob are you also using addDirectory ?

  12. Rob Morgan
    June 26th, 2009 at 03:35 | #12

    @wadearnold
    yeah I am. Here’s a snippet of my code:

    $server = new Zend_Amf_Server();
    //$server->setSession();
    $server->setProduction(false);
    $server->addDirectory(APPLICATION_PATH . ‘/services’);
    $response = $server->handle();
    echo $response;

  13. Paulo Azevedo
    June 26th, 2009 at 05:23 | #13

    hey Wade, thanks for your answers.

    I’m using the full package of the Zend Framework.
    Here’s my AMF Broker code:

    addDirectory( ‘/usr/share/php/services/’ );

    //TODO: arranjar alternativa para este mapping explicito
    require_once ‘/usr/share/php/lib/billing/BillingPairingMatrixVO.php’;
    $server->setClassMap( ‘lib.billing.BillingPairingMatrixVO’, ‘BillingPairingMatrixVO’ );
    require_once ‘/usr/share/php/lib/billing/OverrideComponentVO.php’;
    $server->setClassMap( ‘lib.billing.OverrideComponentVO’, ‘OverrideComponentVO’ );
    require_once ‘/usr/share/php/lib/billing/OverrideBillingVO.php’;
    $server->setClassMap( ‘lib.billing.OverrideBillingVO’, ‘OverrideBillingVO’ );

    print $server->handle();
    ?>

    Another think I would like to know if there’s anyway of passing Objects from Flex to Zend_AMF without explicitly using the $server->setClassMap.

    Thank you for your great job.

  14. Paulo Azevedo
    June 26th, 2009 at 05:25 | #14

    @Paulo Azevedo
    For some reason most of my code was eaten. Is there any other place where we can discuss this ?

  15. Felix-Johannes Jendrusch
    June 26th, 2009 at 05:36 | #15

    @wadearnold As already mentioned it would be great if services would be automatically detected but I’d be satisfied with an non-automatically detecting version. I already got the tree navigation working:

    public function getServices() {
    return array(array(‘label’ => ‘CompanyService’, ‘data’ => ”));
    }

    The only problem is the service description page. I took a look at what AMFPHP generates and tried to generate similar output but it doesn’t work, e.g.:

    public function describeService($data) {
    return array(
    array(
    ‘getAll’ => array(
    ‘description’ => ‘No description given.’,
    ‘arguments’ => array(),
    ‘access’ => ‘private’
    )
    ),

    );
    }

    Any tips?

  16. Björn
    June 27th, 2009 at 12:09 | #16

    Hi everybody,
    same problem here. I also used addDirectory() which is no longer working. As a fix I now manually add every class with setClass().
    Regards,
    Björn

  17. July 1st, 2009 at 15:48 | #17
  18. July 22nd, 2009 at 08:21 | #18

    Hi Wade,

    First of all, thanks for creating something as useful as Zend AMF Server. :)

    I have a problem updating to anything above version 1.7.6 however as I then get the errormessage:
    RPC Fault faultString=”Method “getMainKenmerken” does not exist” faultCode=”0″ faultDetail=”#0

    Seeing the amount of bugfixes for Zend AMF I do need to update now it seems, since I also want to use circular references now. But this problem means I cannot get the new version (now 1.8.4) to run.

    For adding the function to the server I currently use $server->setClass(“classname”);
    I’m using Zend AMF to build a Flex interface that communicates with Ez Publish, which could be a complicating factor here. For one thing Ez Publish handles the autoloading of classes once a classname is used in the extension on the platform.

    I wonder what changed between 1.7.6 and later versions that this stopped working for me, but still seems to work for most others?

    If you need more details, feel free to ask, either here or by mail.

    Greetings
    Arnoud

  19. July 23rd, 2009 at 06:13 | #19

    To add to my comment, I’ve done some more testing and the setClass is not working outside of Ez Publish anymore either. I’ve just used a very small prototype that calls one simple method on a class I add to the server.

    addFunction still works fine, so I can use that as a work around. But there’s no way I could can call functions on the server added through the setClass method.

  20. July 28th, 2009 at 06:23 | #20

    Thanks WADEARNO
    It really did worked.

  21. September 29th, 2009 at 09:40 | #21

    Hello Wade,

    Many thanks for a brilliant addition to the Zend Framework – we’re currently using it on our website quite a bit. However, since upgrade from Zend Frame 1.8.0 to 1.9.3PL1, we’ve had problems with the AMF side of things (in particular, the problem appears to have it’s roots in the difference between 1.8.3 and 1.8.4).

    Basically, we have AMF calles with two DTO objects – one a generic “here I am” and the other a “here’s what needs to happen”. They both have a “sessionid”, “gameid” and “userid” in them, but the second object is not being populated with the details (sometimes due to Zend_Amf_Parse/Amf3/Deserializer readString’s “Undefined string refernece”). Is there any assistance you can provide? I can supply you with proxy recordings (which show the data is being transmitted to the server), example PHP/AMF code etc etc.

    I am trying to look into it myself (as I know you only have so much free time to work on Zend), but it’s delving a lot deeper into AMF that I ever wanted to and hence it’s taking time. Thanks!

  22. May 20th, 2012 at 06:46 | #22

    I am facing a problem on the setClass method on a flex/php application.
    This application works perfectly on another machine, but when I ude it on a windows 7 machine I get a problem, which is the same I get when deploying the application on a server.

    I have my php classes, i.e. AMFAuth for authorization,
    which contains for instance a “login” method.
    Und usually I manage this class in the service endpoint gateway in this way:

    //////////////////////////////////////

    //zend framework inclusion
    require_once ‘Zend/Amf/Server.php’;
    require_once ‘Zend/Auth.php’;
    require_once ‘Zend/Auth/Adapter/DbTable.php’;

    //including common functions
    require_once (“commons.php”);

    //web services files inclusions
    require_once ‘services/AMFAuth.php’;
    date_default_timezone_set(‘Europe/Rome’);

    // AMF services instance
    $server = new Zend_Amf_Server();
    $server->setProduction(false);

    //adding classes to zend amf server
    $server->setClass(“AMFAuth”);

    echo($server->handle());

    /////////////////////////////////////

    The flex application responses:

    Method “login” not found.

    Note that no error is coming on in serviceEP.php debugging and that apparently classes are correctly loaded.
    Even apache logs does not show any kind of error.

    Can you give me some help please?
    How can I manage to debug this situation?

    I’ve tried also with an amf_config.ini which normally I do not use but t did not solve the problem.

    Paolo

  23. May 20th, 2012 at 13:56 | #23

    Finally I have solved the problem. It was on flex.
    I normally used the service end point gateway name as the source property for the remote object and on many machines this way works and allows to have a single remote object for many php classes.
    But of course this method is not correct and in some machines the problem arises.

    so the correct as syntax for the remote object properties is:

    RO.source=”AMFClassName”; //the amf php class
    RO.endpoint=”serviceEP”; // the gateway

    So I have solved the problem creating a remote object for every class.

  1. July 1st, 2009 at 19:12 | #1