Skip to content

fatal errors with extending PDO and interface usage #1187

@dasmfm

Description

@dasmfm

Got the following problem with fresh deb-package and latest Doctrine DBAL.

It has following class, extending PDO extension.

class PDOConnection extends PDO implements Connection
{
    /**
     * @param string      $dsn
     * @param string|null $user
     * @param string|null $password
     * @param array|null  $options
     */
    public function __construct($dsn, $user = null, $password = null, array $options = null)
    {
        parent::__construct($dsn, $user, $password, $options);
        $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine\DBAL\Driver\PDOStatement', array()));
        $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
}

Connection interface has following method:

    /**
     * Prepares a statement for execution and returns a Statement object.
     *
     * @param string $prepareString
     *
     * @return \Doctrine\DBAL\Driver\Statement
     */
    function prepare($prepareString);

This method exists in PDO extension, but doesn't exists in PDOConnection class.

So, hhvm throws fatal error (while php works fine):

HipHop Fatal error: Declaration of Doctrine\DBAL\Driver\PDOConnection::prepare() must be compatible with that of Doctrine\DBAL\Driver\Connection::prepare() in /home/dasmfm/doctrine-demo/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 30

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions