go to bug id or search bugs for
json_encode() encodes an object by treating its public properties like an array.
This is not always the desired behavior and it's difficult to detect beforehand without walking the whole input array.
Therefore it would be good if json_encode() had an option to make it refuse to encode any object (throw an exception), unless the object implements JsonSerializable.
Add a Patch
Add a Pull Request