JSON: Encode closures as empty objects for PHP compat

Summary: Fixes #4035

This one fixes [issue 4035](https://github.com/facebook/hhvm/issues/4035) which describes in details the case of encoding closures in `json_encode`.

To be compatible with PHP 5, we should in legacy mode encode closures as empty objects `"{}"`. In HipHop syntax the corresponding warning is issued, and the `false` is returned.

In case if `JSON_PARTIAL_OUTPUT_ON_ERROR` is passed, a closure (as other non-JSON values, e.g. a resource) is rendred as `null`.

HipHop syntax (default):

  // HH
  json_encode(function() {}); // false, warning
  json_encode([1, 2, function() {}]); // false, warning

HipHop syntax with `JSON_PARTIAL_OUTPUT_ON_ERROR`:

  // HH, with JSON_PARTIAL_OUTPUT_ON_ERROR
  json_encode(function() {}, JSON_PARTIAL_OUTPUT_ON_ERROR); // "null", warning
  json_encode([1, 2, function() {}], JSON_PARTIAL_OUTPUT_ON_ERROR); // "[1, 2, null]", warning

Legacy PHP mode for compatibility:

  // PHP
  json_encode(function() {}); // "{}"
  json_encode([1, 2, function() {}]); // [1, 2, {}]

  // PHP, with JSON_PARTIAL_OUTPUT_ON_ERROR
  json_encode(function() {}, JSON_PARTIAL_OUTPUT_ON_ERROR); // "{}"
  json_encode([1, 2, function() {}], JSON_PARTIAL_OUTPUT_ON_ERROR); // "[1, 2, {}]"

Reviewed By: @ptarjan

Differential Revision: D1637255

Signature: t1:1637255:1414523821:bd5620f3dd8d453228e63a84b962187e0265181a