Details
Description
For tables that have no primary keys (don't blame me, I didn't write the horrifying SQL schema
), warnings will be thrown because array_key_exists is invoked against an undefined variable.
At/around line 225 in Zend/Db/Adapter/Pdo/Mssql.php is the offending bit of code:
$isPrimary = array_key_exists($row[$column_name], $primaryKeyColumn);
$primaryKeyColumn is never initialised, so somewhere around line 209 this change should be made:
$primaryKeysResult = $stmt->fetchAll(Zend_Db::FETCH_NUM);
$pkey_column_name = 3;
$pkey_key_seq = 4;
+
+ $primaryKeyColumn = array();
foreach ($primaryKeysResult as $pkeysRow) {
$primaryKeyColumn[$pkeysRow[$pkey_column_name]] = $pkeysRow[$pkey_key_seq];
}
Initially I thought it should be enough to just cast to an array, but that still threw a Notice. This actually addresses the issue.
Cheers,
Initially I thought that it should be enough just to cast to an array, but PHP still threw a Notice about the variable being undefined. So, let's actually define the variable.