ZF-8005: Actionscript function arguments not passed as correct type to Zend_Amf

Issue Type: Bug Created: 2009-10-02T13:44:43.000+0000 Last Updated: 2012-11-20T20:52:33.000+0000 Status: Closed Fix version(s): Reporter: Luke Mackenzie (codecowboy) Assignee: None Tags: - Zend_Amf

Related issues: Attachments:


The Zend_Amf specification states that a Number type returned from flash will map to a float in PHP. That's fine but why does the number 16 get parsed as 6.1026988574311E_320 ? I actually want to pass an integer but even if I do an explicit cast in Actionscript to type:int, Charles Proxy still reports that the value being passed is of type:Number so Zend/Amf sees it as a float. The number 16 is actually a parameter in a netconnection call from Actionscript so I don't believe it relates to object mapping between Actionscript and Zend_AMF.

As a workaround, I can pass the parameter as a string and this works but I think I should be able to pass it as a true integer."myservice.doSomething()", responder, id); //id is the value in question

I have tried setting the id to int elsewhere in the code and also passing int(16) but the value always arrives as a float in PHP and cannot be cast to an integer (PHP rounds it to zero).

Does anyone know why this is happening? Is it possible there is a bug in Zend_Amf causing it?


Posted by Gabriel Froehlich (gfroehlich) on 2009-12-07T01:53:48.000+0000

There is a similar problem with the results sent from PHP to Flex. If an array or object value is a float in PHP, a wrong value arrives in flex. e.g. a price from db of 59.56 arrives in Flex as 1.2179606413329341e+43. If it's a string on PHP side, it arrives correct.

The same with too big integer values, they are converted to wrong float value.

Posted by Luke Mackenzie (codecowboy) on 2009-12-07T02:16:43.000+0000

See this thread re this being an 'endian' problem.…

Posted by Gabriel Froehlich (gfroehlich) on 2009-12-07T04:48:15.000+0000

The problem is in the class Zend_Amf_Util_BinaryStream: in the constructor the class variable _bigEndian is fix set to 1. If change this to 0, it's working for me.

My server is an i5 (AS/400) which has PPC architecture. I thought PPC is big endian and x86 is little endian? But it works if _bigEndian is set to false!

Posted by Rob Allen (rob) on 2012-11-20T20:52:33.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.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.