Issues

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:

Description

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);
    }

    mysql_select_db($this->databasename);
}

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.

Comments

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

fixed

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts