w funkcji quotującej PDO następuje type casting wartości NULL na string'a
żeby to obejść powinieneś sprawdzać czy wartość czasem nie jest NULL'em i pisać:
<?php
$pdo->query('INSERT INTO tabela(tresc) VALUES('.(is_null($zmienna) ?
NULL : $pdo->quote($zmienna)).')'); ?>
albo napisz swoją funkcję quotującą i jej używaj zamiast $pdo->quote()
<?php
function DBNull($value = null){
if(is_bool($value)) return (bool
)$value; if(is_int($value)) return (int
)$value; if(is_float($value)) return (float
)$value; return (string
) $value = (trim($value)); }
DBNull(null), # null
DBNull('null'), # string 'null' (length=4)
DBNull(0), #int 0
DBNull(), # null
DBNull(''), # string '' (length=0)
DBNull(true) # boolean true
);
?>