Skip to content

Commit d8d617d

Browse files
committed
sure.
1 parent 0497408 commit d8d617d

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/KV/KVPair.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ public static function jsonUnserialize(\stdClass $decoded): self
165165
$n = new self();
166166
foreach ((array)$decoded as $k => $v) {
167167
if ('Value' === $k) {
168+
if (null === $v) {
169+
$n->Value = '';
170+
continue;
171+
}
168172
$val = base64_decode($v, true);
169173
if (false === $val) {
170174
throw new \DomainException(sprintf('Could not base64 decode value "%s"', $v));

src/Txn/KVTxnOp.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ public static function jsonUnserialize(\stdClass $decoded): self
154154
if ('Verb' === $k) {
155155
$n->Verb = KVOp::from($v);
156156
} elseif ('Value' === $k) {
157+
if (null === $v) {
158+
$n->Value = '';
159+
continue;
160+
}
157161
$val = base64_decode($v, true);
158162
if (false === $val) {
159163
throw new \DomainException(sprintf('Could not base64 decode value "%s"', $v));
@@ -171,7 +175,7 @@ public function jsonSerialize(): \stdClass
171175
$out = $this->_startJsonSerialize();
172176
$out->Verb = $this->Verb;
173177
$out->Key = $this->Key;
174-
$out->Value = $this->Value;
178+
$out->Value = base64_encode($this->Value);
175179
$out->Flags = $this->Flags;
176180
$out->Index = $this->Index;
177181
$out->Session = $this->Session;

0 commit comments

Comments
 (0)