ZF-5298: Zend_Db_Adapter_Pdo_Abstract->getServerVersion PDO_OCI - SQLSTATE[IM001]: Driver does not support this function: driver does not support getting attributes

Description

First time I seen this problem with ZF 13325 SVN revision.

On first connect (when building metadata cache i'm getting

PDOException::SQLSTATE[IM001]: Driver does not support this function: driver does not support getting attributes Full exception below

From my observations it looks like server related problem - it appears only on production server: Linux Debian, Apache 2.2.9-10+lenny1, PHP 5.2.6-5, PDO-1.0.3, PDO_OCI-1.0, instantclient-linuxAMD64-10.1.0.5.0-20060519

trying and catching this exception and returning null value works ( app is working as expected ).

/**
 * Retrieve server version in PHP style
 *
 * @return string
 */
public function getServerVersion()
{
    $this->_connect();
    // ********************* BEGIN OWN PATCH *********************
    try {
    // ********************** END OWN PATCH **********************
        $version = $this->_connection->getAttribute(PDO::ATTR_SERVER_VERSION);
        $matches = null;
        if (preg_match('/((?:[0-9]{1,2}\.){1,3}[0-9]{1,2})/', $version, $matches)) {
            return $matches[1];
        } else {
            return null;
        }
    // ********************* BEGIN OWN PATCH *********************
    } catch ( PDOException $e) {
        return null;
    }
    // ********************** END OWN PATCH **********************
}

Almost whole exception:

PDOException Object ( [message:protected] => SQLSTATE[IM001]: Driver does not support this function: driver does not support getting attributes [string:private] => [code:protected] => IM001 [file:protected] => /home/www/some_project/library/Zend/Db/Adapter/Pdo/Abstract.php [line:protected] => 361 [trace:private] => Array ( [0] => Array ( [file] => /home/www/some_project/library/Zend/Db/Adapter/Pdo/Abstract.php [line] => 361 [function] => getAttribute [class] => PDO [type] => -> [args] => Array ( [0] => 4 )

            )

        [1] => Array
            (
                [file] => /home/www/some_project/library/Zend/Db/Adapter/Pdo/Oci.php
                [line] => 173
                [function] => getServerVersion
                [class] => Zend_Db_Adapter_Pdo_Abstract
                [type] => ->
                [args] => Array
                    (
                    )

            )

        [2] => Array
            (
                [file] => /home/www/some_project/library/Zend/Db/Table/Abstract.php
                [line] => 696
                [function] => describeTable
                [class] => Zend_Db_Adapter_Pdo_Oci
                [type] => ->
                [args] => Array
                    (
                        [0] => PACJ
                        [1] => 
                    )

            )

        [3] => Array
            (
                [file] => /home/www/some_project/library/Zend/Db/Table/Abstract.php
                [line] => 722
                [function] => _setupMetadata
                [class] => Zend_Db_Table_Abstract
                [type] => ->
                [args] => Array
                    (
                    )

            )

        [4] => Array
            (
                [file] => /home/www/some_project/library/Zend/Db/Table/Abstract.php
                [line] => 762
                [function] => _getCols
                [class] => Zend_Db_Table_Abstract
                [type] => ->
                [args] => Array
                    (
                    )

            )

        [5] => Array
            (
                [file] => /home/www/some_project/library/Zend/Db/Table/Abstract.php
                [line] => 846
                [function] => _setupPrimaryKey
                [class] => Zend_Db_Table_Abstract
                [type] => ->
                [args] => Array
                    (
                    )

            )

        [6] => Array
            (
                [file] => /home/www/some_project/library/Zend/Db/Table/Select.php
                [line] => 99
                [function] => info
                [class] => Zend_Db_Table_Abstract
                [type] => ->
                [args] => Array
                    (
                    )

            )

            ------- TRUNCATED UNRELATED TRACE ----------

[errorInfo] => Array
    (
        [0] => IM001
        [1] => 0
    )

)

Comments

Fixed with SVN 13600