jwt
jwt copied to clipboard
JsonSerializable should not call json_encode() in Emarref\Jwt\Token\PropertyList->jsonSerialize()
Method jsonSerialize of JsonSerializable interface should return data to be serialized to json, not json itself, as stated in the PHP documentation: "JsonSerializable::jsonSerialize — Specify data which should be serialized to JSON". Using json_encode in jsonSerialize() causes double json encoding: at first in jsonSerialize, and then json string is converted to json again by json_encode itself.
Problem exists in Emarref\Jwt\Token\PropertyList->jsonSerialize(): https://github.com/emarref/jwt/blob/master/src/Token/PropertyList.php#L43, it should just return $properties, not json_encode($properties).