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

False positive "Please consider taking advantage of JSON_THROW_ON_ERROR flag for this call options." when using a const for flags parameter #1961

Open
fietserwin opened this issue Oct 31, 2024 · 0 comments

Comments

@fietserwin
Copy link

Subject Details
Plugin Php Inspections (EA Extended) 5.1.0
Language level all

Code example

`
const MY_SIMPLE_JSON_FLAGS = JSON_THROW_ON_ERROR;

const MY_JSON_FLAGS = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR |
JSON_PRESERVE_ZERO_FRACTION;

const MY_JSON_LOG_FLAGS = MY_JSON_FLAGS | JSON_PRETTY_PRINT;

$log_message1 = json_encode([], MY_SIMPLE_JSON_FLAGS);
$log_message2 = json_encode([], MY_JSON_FLAGS);
$log_message3 = json_encode([], MY_JSON_LOG_FLAGS);
`

Current behaviour

Warning on all 3 json_encode() statements

Expected behaviour

No warnings (I assume that the actual values of constants can be used on analysis).

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