-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Entity castAsJson returns an empty array #2080
Comments
I think everything is ok.
and
|
or just try to pass: |
Entity.php Line 591 Seems we need to change the code above. |
This code will check if first and last char from the string is - As I said in my opinion for your parameter |
Well,actually |
And I thought the correct code was |
codeigniter4#2080 (...) And I thought the correct code was (strpos($value, '"') === 0 && strrpos($value, '"') === strlen($value) - 1 ) (...)
you are right in this point. |
Describe the bug
Entity castAsJson returns an empty array
CodeIgniter 4 version
Codeigniter 4.0.0-beta.3
Affected module(s)
Entity
Expected behavior, and steps to reproduce if appropriate
I was testing the Entity class.
I called
castAsJson('"{\"name\":\"test\",\"age\":0}"',$asArray=true)
and expected to get['name' => 'test','age' => 0]
,but the function returned an empty array instead.Context
The text was updated successfully, but these errors were encountered: