Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonSerializable should not call json_encode() in Emarref\Jwt\Token\PropertyList->jsonSerialize() #34

Open
Grundik opened this issue May 26, 2020 · 0 comments

Comments

@Grundik
Copy link

Grundik commented May 26, 2020

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant