diff --git a/app/src/Model/Table/PersonRolesTable.php b/app/src/Model/Table/PersonRolesTable.php index bdbfbd8b9..dc0ee791f 100644 --- a/app/src/Model/Table/PersonRolesTable.php +++ b/app/src/Model/Table/PersonRolesTable.php @@ -294,12 +294,14 @@ public function beforeMarshal(EventInterface $event, \ArrayObject $data, \ArrayO } $re = '/^.*\(ID: (\d+)\)$/m'; - if(!empty($data['sponsor_person_id'])) { + // The data coming from the API is an int while the data coming from the UI is a string. The + // latter is produced by the people picker + if(!empty($data['sponsor_person_id']) && !ctype_digit($data['sponsor_person_id'])) { preg_match_all($re, $data['sponsor_person_id'], $matchesSponsor, PREG_SET_ORDER, 0); $data['sponsor_person_id'] = $matchesSponsor[0][1]; } - if(!empty($data['manager_person_id'])) { + if(!empty($data['manager_person_id']) && !ctype_digit($data['manager_person_id'])) { preg_match_all($re, $data['manager_person_id'], $matchesManager, PREG_SET_ORDER, 0); $data['manager_person_id'] = $matchesManager[0][1]; } diff --git a/app/src/Model/Table/VerificationsTable.php b/app/src/Model/Table/VerificationsTable.php index f75ab25cc..d88642422 100644 --- a/app/src/Model/Table/VerificationsTable.php +++ b/app/src/Model/Table/VerificationsTable.php @@ -253,7 +253,7 @@ public function verifyCode(int $id, string $code): bool { throw new \InvalidArgumentException(__d('error', 'Verifications.processed')); } - if($verification->request_expiration_time->lt(FrozenTime::now())) { + if($verification->request_expiration_time->lessThan(FrozenTime::now())) { $this->llog('debug', "Verification $id has expired"); throw new \InvalidArgumentException(__d('error', 'Verifications.expired')); }