
digg - issue #9
PDB query skips special treatment for the LOB column when file-resource is sent.
$fp = fopen('testfile.txt', 'r'); $pdb->query('INSERT INTO files (filecontent) VALUES (?)', array($fp));
Expected output: filecontent to have content of testfile.txt Actual output: filecontent having value resource #nnn
Fix: bindParam with LOB data-type when resource is sent as part of value.
File: PDB/Common.php
public function query($sql, array $args = array()) { ... if (is_array($args)) { $cnt = count($args); if ($cnt > 0) { foreach ($args as $key => $value) { $param = (is_int($key) ? ($key + 1) : $key);
// FIX HERE
$result =
is_resource($value)?
$stmt->bindParam($param, $args[$key], PDO::PARAM_LOB) :
$stmt->bindParam($param, $args[$key]);
}
}
}
// ...
}
Status: New
Labels:
Type-Defect
Priority-Medium