Document why we have to check with defined() first.

This commit is contained in:
Andreas Fischer 2014-07-16 15:06:59 +02:00
parent e26612244a
commit d8bd8c4b66
1 changed files with 2 additions and 0 deletions

View File

@ -61,6 +61,8 @@ class ConnectionFactory {
throw new \InvalidArgumentException("Unsupported type: $type"); throw new \InvalidArgumentException("Unsupported type: $type");
} }
$result = $this->defaultConnectionParams[$normalizedType]; $result = $this->defaultConnectionParams[$normalizedType];
// \PDO::MYSQL_ATTR_FOUND_ROWS may not be defined, e.g. when the MySQL
// driver is missing. In this case, we won't be able to connect anyway.
if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) { if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) {
$result['driverOptions'] = array( $result['driverOptions'] = array(
\PDO::MYSQL_ATTR_FOUND_ROWS => true, \PDO::MYSQL_ATTR_FOUND_ROWS => true,