Issue with PDO Adaptor wrt MySQL DateTime Datatypes in AMFPHP Remoting
Lately, during a project development involving PHP 5, MySQL 5 and AMFPHP 1.1 Remoting, we realized that there is an issue with the PDO Adaptor that comes with AMFPHP with respect to the MySQL DateTime datatypes. Well, we would like to term it more of a missing feature than a bug/issue and hope to see it included in the next release of AMFPHP with the updated PDO Adaptor bundled.
Basically AMFPHP comes with various recordset adaptors depending on what database/abstraction layer you are using, like mysqli, PDO etc. The adaptors that currently comes with it, do not convert datatypes correctly when returning the recordset to Flash. Selecting a datetime datatype returns a string date to flash as opposed to a date object.
And since the timezone offset is not included in the date string, the flash client parses the datetime with an incorrect timezone offset.
Comments
The issues with MySQL are not really amfphp-specific. The mysql_* always return strings because of a limitation in the database driver for it. The mysql adapter in amfphp makes up for this by inspecting the column types and making an educated guess as to how they should be typed. I have no idea if PDO exhibits the same issues but my guess would be yes since PDO probably just wraps the MySQL driver instead of reimplementing it. If you can document the problem thoroughly and give an expected behaviour, I can attempt to patch the issue, but again the real problem lies in the MySQL driver.
Another thing: there is an issue in the player with respect to timezones in AMF. It sends the timezone offset to the remote server but it completely ignores the timezone offset given by the server. It seems that it is a bug in the player. So regardless of the solution we come up with to have date columns coming back as dates, the timezone will never work properly because of this bug in the player.
Post a comment