ZF-7102: Exception not propogated correctly if thrown from constructor

Issue Type: Bug Created: 2009-06-23T10:42:24.000+0000 Last Updated: 2009-07-31T21:03:58.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Mayank Kumar (mayankk) Assignee: Stanislav Malyshev (stas) Tags: - Zend_Amf

Related issues: Attachments:


Consider a PHP Class with the following constructor:

public function __construct() {
    $this->connection = mysql_connect($this->server,  $this->username,  $this->password);

    if(mysql_error()) {
        $msg = mysql_errno() . ": " . mysql_error();
        throw new Exception('MySQL Error - '. $msg);


when an exception is thrown, Zend AMF ignores it and throws an exception with the message "Error instantiating class"

            try {
                $object = $info->getDeclaringClass()->newInstance();
            } catch (Exception $e) {
                require_once 'Zend/Amf/Server/Exception.php';
                throw new Zend_Amf_Server_Exception('Error instantiating class ' . $class . ' to invoke method ' . $info->getName(), 621);

While throwing this exception, ZendAMF should append the error message from the caught exception.


Posted by Stanislav Malyshev (stas) on 2009-06-30T17:26:17.000+0000


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.