ZF-12310: Zend_Db_Adapter_Exception::hasChainedException tries to read a private property from Zend_Exception

Issue Type: Bug Created: 2012-06-29T13:46:57.000+0000 Last Updated: 2012-06-29T14:52:56.000+0000 Status: Open Fix version(s): Reporter: Ivo Kund (ivokund) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db

Related issues: Attachments:


Basically the problem is:

<pre class="highlight">
class Zend_Exception extends Exception
    private $_previous = null;

class Zend_Db_Adapter_Exception extends Zend_Db_Exception
    public function hasChainedException()
        return ($this->_previous !== null);

I can imagine that either:

  1. Zend_Db_Adapter_Exception::hasChainedException should call Zend_Exception::getPrevious() instead of reading the missing private property 2) or Zend_Exception::$_previous should be declared protected 3) or Zend_Db_Adapter_Exception::hasChainedException() should be moved to Zend_Exception

I checked and this does not seem to be fixed in 1.11.12


Posted by Ivo Kund (ivokund) on 2012-06-29T14:52:56.000+0000

The aforementioned patch would be:

<pre class="highlight">
Index: Zend/Db/Adapter/Exception.php
@@ -46,7 +46,7 @@
     public function hasChainedException()
-        return ($this->_previous !== null);
+        return ($this->getPrevious() !== null);
     public function getChainedException()

Have you found an issue?

See the Overview section for more details.


© 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.