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

Description

Basically the problem is:


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

Comments

The aforementioned patch would be:


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