bugsnag/bugsnag-php — pull request #42 by jaketoolson (2014-04-29 22:47:58+00:00)
Title: cast $str to (string) for mb_detect_encoding

"mb_detect_encoding() expects parameter 1 to be string, object given". Adding (string) prevents errors in the event $str is not a string.

Alternatively, you could use strval($str).