Here is the catch:
$error = NULL;
when you assign NULL
to $error
it makes $error a set variable, eventhough it is null.
Thus the following line would give you unexpected result:
$error = $this->model->store_review(); if(isset($error)) echo 'error is set';
The proper way to check would be to use is_null
Here is how you can test my answer
<?php
$error = NULL;
if(is_null($error)){
echo "is_null | error not set \n";
}else{
echo "is_null |error set \n";
}
if(isset($error)){
echo "isset | error not set \n";
}else{
echo "isset |error set \n";
}
OUTPUT
is_null | error not set
isset | error set