From 4859a12fb461aa42e66831a23997ea2ceafbfc7b Mon Sep 17 00:00:00 2001 From: kov-lucas Date: Thu, 28 Oct 2021 13:08:25 +0200 Subject: [PATCH] allow null for birthdate --- lib/Model/Contact.php | 2 +- lib/Request.php | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Model/Contact.php b/lib/Model/Contact.php index 12f2535..fe9621a 100644 --- a/lib/Model/Contact.php +++ b/lib/Model/Contact.php @@ -301,7 +301,7 @@ public function jsonSerialize() { $result["addresses"] = $this->addresses; } if (!is_null($this->birthdate)) { - $result["birthdate"] = Json::packTimestamp($this->birthdate); + $result["birthdate"] = !empty($this->birthdate) ? Json::packTimestamp($this->birthdate) : null; } if (!is_null($this->company)) { $result["company"] = strval($this->company); diff --git a/lib/Request.php b/lib/Request.php index dcb91e1..8c21bab 100644 --- a/lib/Request.php +++ b/lib/Request.php @@ -163,9 +163,7 @@ private function prepare() { $headers[] = "Expect:"; // issue with cURL when doing big size POSTs https://stackoverflow.com/questions/14158675/how-can-i-stop-curl-from-using-100-continue if ($this->bodycontenttype == "json") { foreach ($this->body as $key => $value) { - if (!is_null($value)) { - $body[$key] = $value; - } + $body[$key] = $value; } $body = json_encode($body); $headers[] = "Content-Type: application/json";