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

getJsonRawBody throws an exception instead of a boolean value as in 3.4 #14765

Closed
chelipf opened this issue Jan 23, 2020 · 2 comments
Closed
Labels
documentation Documentation required enhancement Enhancement to the framework

Comments

@chelipf
Copy link

chelipf commented Jan 23, 2020

It seems that now getJsonRawBody uses the new \Phalcon\Helper\Json that makes my old code crash because it throws a json_decode exception:

json_decode error: Syntax error

In version 3.4.5 it just returned a boolean value.

The 4.0 doc says:

public function getJsonRawBody( bool $associative = bool ): \stdClass | array | bool;

Gets decoded JSON HTTP raw request body

No problem, I could just catch the exception but the question is, Should this be the new behavior?

@chelipf chelipf changed the title getJsonRawBody on request throws an exception instead of bool value as in 3.4 getJsonRawBody throws an exception instead of bool value as in 3.4 Jan 23, 2020
@chelipf chelipf changed the title getJsonRawBody throws an exception instead of bool value as in 3.4 getJsonRawBody throws an exception instead of a boolean value as in 3.4 Jan 23, 2020
@Jurigag
Copy link
Contributor

Jurigag commented Jan 23, 2020

Yes, that was one of changes in 4.0 as I checked in code, I guess we should maybe update return values because it's much better to just return exception.

@ruudboon ruudboon added 4.1.0 enhancement Enhancement to the framework labels Jan 25, 2020
@niden niden added the documentation Documentation required label Feb 20, 2020
@niden
Copy link
Member

niden commented Oct 1, 2020

This has been addressed here: #14936

@niden niden closed this as completed Oct 1, 2020
@niden niden moved this to Released in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation required enhancement Enhancement to the framework
Projects
Archived in project
Development

No branches or pull requests

4 participants