I'm editing this question to make it more didactic for other members, since there are only publications addressing this situation outside the community.
I have a INT field with UNIQUE property that can have NULL value.
The value that will be entered in this field comes from a variable that can have NULL value. The problem is that when doing this INSERT , if this variable has a null value, the value 0 ( zero ) will be stored in this field. will cause problems inserting a new record thanks to the UNIQUE property.
Here is the example that will generate this error:
$varExemplo = null;
$sql = "INSERT INTO usuario (campoIntExemplo) VALUES ('".$varExemplo."');
$query = $mysqli->query(sql);