Skip to content

Commit

Permalink
log more steps of JsonCodec
Browse files Browse the repository at this point in the history
  • Loading branch information
rpuboh committed Jun 30, 2024
1 parent 0f1802d commit 0324db3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions includes/json/JsonCodec.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ public function unserializeArray( array $array ): array {
}

public function serialize( $value ) {
$valclass = get_class($value);
if ( $value instanceof JsonSerializable ) {
$value = $value->jsonSerialize();
}
$json = FormatJson::encode( $value, false, FormatJson::ALL_OK );
wfDebugLog('pcd', "JC: $valclass; $json");
if ( !$json ) {
// TODO: make it JsonException
throw new InvalidArgumentException(
Expand Down
1 change: 1 addition & 0 deletions includes/json/JsonUnserializableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
trait JsonUnserializableTrait {

public function jsonSerialize(): array {
wfDebugLog('pcd', "JT::jsonSerialize");
return $this->annotateJsonForDeserialization(
$this->toJsonArray()
);
Expand Down
2 changes: 1 addition & 1 deletion includes/parser/ParserOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2488,7 +2488,7 @@ protected function toJsonArray(): array {
}

$trunc_data = substr(json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 0, 35);
wfDebugLog('pcd', $trunc_data);
wfDebugLog('pcd', "ParserOutput: $trunc_data");

return $data;
}
Expand Down

0 comments on commit 0324db3

Please sign in to comment.