diff options
| author | Jakub Zelenka <bukka@php.net> | 2016-05-03 19:55:41 +0100 |
|---|---|---|
| committer | Jakub Zelenka <bukka@php.net> | 2016-05-03 19:55:41 +0100 |
| commit | 34a9882ad357620ccec2bfadba72fce027acd3d6 (patch) | |
| tree | d531877fdae8ec4126e8042ca350dcfcdb8b770f /ext/json/json_encoder.c | |
| parent | 93b67dd511fdf890931e2b18846886368798ca5a (diff) | |
| parent | ee551106bc11d6ac2eb277b810c9b8bb90e318bc (diff) | |
| download | php-git-34a9882ad357620ccec2bfadba72fce027acd3d6.tar.gz | |
Merge branch 'master' into json_parser_method
Diffstat (limited to 'ext/json/json_encoder.c')
| -rw-r--r-- | ext/json/json_encoder.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c index 8da5abd088..62df102847 100644 --- a/ext/json/json_encoder.c +++ b/ext/json/json_encoder.c @@ -457,6 +457,7 @@ static void php_json_encode_serializable_object(smart_str *buf, zval *val, int o zend_class_entry *ce = Z_OBJCE_P(val); zval retval, fname; HashTable* myht; + int origin_error_code; if (Z_TYPE_P(val) == IS_ARRAY) { myht = Z_ARRVAL_P(val); @@ -470,8 +471,10 @@ static void php_json_encode_serializable_object(smart_str *buf, zval *val, int o return; } + ZVAL_STRING(&fname, "jsonSerialize"); + origin_error_code = JSON_G(error_code); if (FAILURE == call_user_function_ex(EG(function_table), val, &fname, &retval, 0, NULL, 1, NULL) || Z_TYPE(retval) == IS_UNDEF) { zend_throw_exception_ex(NULL, 0, "Failed calling %s::jsonSerialize()", ZSTR_VAL(ce->name)); smart_str_appendl(buf, "null", sizeof("null") - 1); @@ -479,6 +482,7 @@ static void php_json_encode_serializable_object(smart_str *buf, zval *val, int o return; } + JSON_G(error_code) = origin_error_code; if (EG(exception)) { /* Error already raised */ zval_ptr_dtor(&retval); |
