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

Consider named argument flags:JSON_THROW_ON_ERROR for json_ functions as "Safe" #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pyrou
Copy link

@pyrou pyrou commented Aug 11, 2022

Since PHP8, named argument allows to pass input data into a function, based on their argument name instead of the argument order.

// PHP 7.3
json_decode($payload, null, 512, JSON_THROW_ON_ERROR);
// PHP 8.0
json_decode($payload, flags: JSON_THROW_ON_ERROR);

Because of this, flags might not be any more always on 4th position. This PR bring support of named argument for json_decode and json_encode JSON_THROW_ON_ERROR flag detection.

Copy link

@spawnia spawnia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this implementation is sound and adds a useful feature, I would love to see it merged and released.

@pyrou
Copy link
Author

pyrou commented Nov 17, 2023

ping @moufmouf @dbrekelmans :)

@dbrekelmans
Copy link
Collaborator

@pyrou if you could resolve the conflict, I'll be happy to merge it

@pyrou pyrou requested a review from dbrekelmans November 23, 2024 19:40
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

Successfully merging this pull request may close these issues.

3 participants