-
Notifications
You must be signed in to change notification settings - Fork 450
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
PHP Warning: json_encode(): in ChromePhp.php on line 405 #35
Comments
I think the warning is valid. Why do you think it's important to prevent it? |
You are right, this warning is valid. Because this occurs when I have NaN in a variable. But wouldn't it be better to really have a NaN? According to the warning the NaN will be encoded as 0. So as I understand, I really don't know if the logged variable is a 0 or a NaN (encoded as 0). And by the way, I look in my error logs to ensure my application is working without any errors. So this warning in the logs can use a lot of lines in my error log. |
It is not possible to represent NaN with JSON. As JSON is used, these error-conditions need either to be filtered out or not dealt with that. It would be perhaps most useful to encode these non-encode able values differently, like a string with value " Projects that do the same (like FirePHP) might show how an implementation could be done. I just don't have a similar report at hand within that project. But I assume it exists. |
I suggest merging #55, in which @ErikKrause not only fixed this, but did an excellent job in making the library more friendly to users coming from FirePHP without modifying the current default behaviour. Additionally, I suggest rendering |
PHP Warning: json_encode(): double NAN does not conform to the JSON spec, encoded as 0 in ChromePhp.php on line 405
Maybe, we can fix this warning.
This maybe helps a bit: http://stackoverflow.com/questions/13581843/php-how-to-encode-infinity-or-nan-numbers-to-json
Thanks!
The text was updated successfully, but these errors were encountered: