php/php-src — pull request #33 by charliesome (2012-04-03 01:28:14+00:00)
Title: If a string is not valid UTF-8, treat it as ASCII rather than giving up and serializing 'null'

I ran into an issue involving serializing a query string parameter as JSON. If there was a percent-encoded character above 127, `json_encode` would choke and simply serialize it as `null`.

I've changed the behaviour of `json_escape_string` to fall back to ASCII if its input isn't valid UTF-8. I've retained the warning it produces in this case.