I don’t know why this is, but typeCast function doesn’t handle double values (do not cast them to “double” and return as they were passed to function as default action):
public function typecast($value)
{
if(gettype($value)===$this->type || $value===null || $value instanceof CDbExpression)
return $value;
if($value==='')
return $this->type==='string' ? '' : null;
switch($this->type)
{
case 'string': return (string)$value;
case 'integer': return (integer)$value;
case 'boolean': return (boolean)$value;
case 'double':
default: return $value;
}
}
it should be:
public function typecast($value)
{
if(gettype($value)===$this->type || $value===null || $value instanceof CDbExpression)
return $value;
if($value==='')
return $this->type==='string' ? '' : null;
switch($this->type)
{
case 'string': return (string)$value;
case 'integer': return (integer)$value;
case 'boolean': return (boolean)$value;
case 'double': return (double)$value;
default: return $value;
}
}
without this there is a problem with oracle connection when calling findByPk - createPkCriteria function call quote for PK value, which has string type beceuse of the above bug, and pdo::quote return empty string for it… which is also strange but it works so under linux. under windows I haven’t notice such problems on very same Yii application.
with patch like above everything works fine.
Hmm… it really looks like bug i PDO_OCI under linux, to reproduce try:
$v = '23';
$v2 = Yii::app()->db->quoteValue( $v );
echo "v=$v, v2=$v2";
it shows:
v=23, v2=