}
$this->person_name = $au && !empty($au->name) ? $au->name : '';
- $this->person_id = $au ? (!empty($au->id) ? $au->id : $au->pid()) : -1;
+ if (isset($au->id) && empty($au->id)) {
+ // not authenticated - and a standard id based object
+ $this->person_id = 0;
+ } else {
+ $this->person_id = $au ? (!empty($au->id) ? $au->id : $au->pid()) : -1;
+ }
$this->person_table = $au ? $au->tableName() : '';
$this->ipaddr = isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : 'cli';
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {