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

Using PHP empty function strips out properties in the response. #33

Closed
nyamsprod opened this issue Feb 9, 2021 · 0 comments
Closed

Comments

@nyamsprod
Copy link
Contributor

Code to reproduce:

<?php

$problem = new ApiProblem('0');
echo json_encode($problem, JSON_PRETTY_PRINT), PHP_EOL;

Expected:

{
    "title": "0",
    "type": "about:blank"
}

Returned:

{
    "type": "about:blank"
}

The title property is missing because it is evaluated via PHP empty function. This should be replace by a strict comparison against empty string '' !==. when needed

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

2 participants