ZF-7016: Error Messages should not be in plain text it should be sent as a AMF message


I have the following function which connects to my local mysql database and if you notice there is a syntax error in the SELECT query, it is missing the select list.

public function getItem($id) { $this->connect();

  $id = mysql_real_escape_string($id);
  $sql = "SELECT  FROM books where id=$id";
  $result = mysql_query($sql) or die('Query failed: ' . mysql_error());
  return $result;

Zend gives a nice error "Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM books where id=1' at line 1"

However other AMF implementations like ColdFusion, BlazeDS, LCDS give this error message as a AMF message and not as a plain text. When Flashplayer is expecting a AMF response it sees this plain text and tells this is not a valid AMF message and disconnects resulting in "Channel Disconnected" Error

Can Zend AMF send all error messages in AMF?


If you use die() it does just that - ends the script, and so AMF module could not process it. Replace die() with exception, that should be caught by the AMF module and returned as AMF message.