Parameterized Queries in PostgreSQL using PHP fail to handle null values
if ($p_int_4 = '' || is_null($p_int_4)) $p_int_4 = null; 


The equality operator in PHP is ==. Your code uses =, and will always set $p_int_4 to an empty string as a result of this mistake.