Import: workaround for ZF1 binary data corrpution

This commit is contained in:
Thomas Gelf 2015-12-10 17:17:49 +01:00
parent 20e0a6ca1f
commit ab597ba958
1 changed files with 20 additions and 3 deletions

View File

@ -359,9 +359,26 @@ class Import
{ {
$db = $this->db; $db = $this->db;
$existing = $db->fetchCol( // TODO: The following is a quickfix for binary data corrpution reported
$db->select()->from($table, 'checksum')->where('checksum IN (?)', $checksums) // in https://github.com/zendframework/zf1/issues/655 caused by
); // https://github.com/zendframework/zf1/commit/2ac9c30f
//
// Should be reverted once fixed, eventually with a check continueing
// to use this workaround for specific ZF versions (1.12.16 and 1.12.17
// so far). Alternatively we could also use a custom quoteInto method.
// The former query looked as follows:
//
// $query = $db->select()->from($table, 'checksum')
// ->where('checksum IN (?)', $checksums)
$hexed = array_map('Icinga\Module\Director\Util::binary2hex', $checksums);
$query = $db
->select()
->from($table, 'checksum')
->where('LOWER(HEX(checksum)) IN (?)', $hexed)
$existing = $db->fetchCol($query);
return array_diff($checksums, $existing); return array_diff($checksums, $existing);
} }