]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #9494 from MrPetovan/bug/9491-model-id-0
authorMichael Vogel <icarus@dabo.de>
Thu, 5 Nov 2020 22:28:47 +0000 (23:28 +0100)
committerGitHub <noreply@github.com>
Thu, 5 Nov 2020 22:28:47 +0000 (23:28 +0100)
Allow models extending BaseModel to have an id equal to 0

src/BaseModel.php

index 8f9370bb09aa4f2b1574e49ec2c02918b4959fa1..41320d8bd5bcf528529b9a6f623babf9bfe84508 100644 (file)
@@ -141,7 +141,7 @@ abstract class BaseModel extends BaseEntity
 
        protected function checkValid()
        {
-               if (empty($this->data['id'])) {
+               if (!isset($this->data['id']) || is_null($this->data['id'])) {
                        throw new HTTPException\InternalServerErrorException(static::class . ' record uninitialized');
                }
        }