From ddd013cc9f21f1a78d07ba9082bdce618b9442d5 Mon Sep 17 00:00:00 2001 From: rpuboh <168681043+rpuboh@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:35:59 +0800 Subject: [PATCH] more log in JsonCodec::serialize --- includes/json/JsonCodec.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/json/JsonCodec.php b/includes/json/JsonCodec.php index 2ab8b1e3e081d..db35cf82f65c6 100644 --- a/includes/json/JsonCodec.php +++ b/includes/json/JsonCodec.php @@ -25,6 +25,8 @@ use InvalidArgumentException; use JsonSerializable; use Wikimedia\Assert\Assert; +use CacheTime; +use MediaWiki\Json\JsonUnserializable; /** * Helper class to serialize/unserialize things to/from JSON. @@ -88,12 +90,17 @@ public function unserializeArray( array $array ): array { public function serialize( $value ) { $valclass = get_class($value); + $v1 = $value instanceof JsonSerializable; + $v2 = $value instanceof CacheTime; + $v3 = $value instanceof JsonUnserializable; if ( $value instanceof JsonSerializable ) { + wfDebugLog('pcd', "JC: calling jsonSerialize"); $value = $value->jsonSerialize(); } $json = FormatJson::encode( $value, false, FormatJson::ALL_OK ); wfDebugLog('pcd', "JC: $valclass; $json"); - usleep(2000); + wfDebugLog('pcd', "JsonSerializable $v1; CacheTime $v2; JsonUnserializable $v3"); + usleep(1000); if ( !$json ) { // TODO: make it JsonException throw new InvalidArgumentException(