Recursively check for resource arguments if trace is coming from internal function.

With `React` or `Guzzle`, that register stream wrappers with PHP, the traces are treated as coming from internal functions with no line and file inside the frame. But they almost always contain resources as arguments, on which the `json_encode()` call will choke (probably this should be addressed in json_encode internally, since it is very easy to cast a resource to a string).

I added a test case proving the situation and a pretty basic recursive checker for resources which just casts them as a string into the frame again.
Merge remote-tracking branch 'tPl0ch/hotfix-resource-internal-function'
Remove reference use, refs #474