diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-02-05 13:46:46 +0100 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2021-02-08 19:53:55 +0100 |
commit | 98fb565c7448cd455b8d24df5f6be8fcf9330fd7 (patch) | |
tree | 939ec045221d2590e28d9111d7721414fec35478 /ext/json | |
parent | 882b418a014890b9b6763825ce9766f21da38a6f (diff) | |
download | php-git-98fb565c7448cd455b8d24df5f6be8fcf9330fd7.tar.gz |
Generate class entries from stubs for another batch of extensions
Closes GH-6669
Diffstat (limited to 'ext/json')
-rw-r--r-- | ext/json/json.c | 8 | ||||
-rw-r--r-- | ext/json/json.stub.php | 9 | ||||
-rw-r--r-- | ext/json/json_arginfo.h | 28 |
3 files changed, 37 insertions, 8 deletions
diff --git a/ext/json/json.c b/ext/json/json.c index 872766239e..5315966f7d 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -44,13 +44,9 @@ PHP_JSON_API ZEND_DECLARE_MODULE_GLOBALS(json) /* {{{ MINIT */ static PHP_MINIT_FUNCTION(json) { - zend_class_entry ce; + php_json_serializable_ce = register_class_JsonSerializable(); - INIT_CLASS_ENTRY(ce, "JsonSerializable", class_JsonSerializable_methods); - php_json_serializable_ce = zend_register_internal_interface(&ce); - - INIT_CLASS_ENTRY(ce, "JsonException", NULL); - php_json_exception_ce = zend_register_internal_class_ex(&ce, zend_ce_exception); + php_json_exception_ce = register_class_JsonException(zend_ce_exception); /* options for json_encode */ PHP_JSON_REGISTER_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG); diff --git a/ext/json/json.stub.php b/ext/json/json.stub.php index a9b5bbf511..bf64f49408 100644 --- a/ext/json/json.stub.php +++ b/ext/json/json.stub.php @@ -1,6 +1,9 @@ <?php -/** @generate-function-entries */ +/** + * @generate-function-entries + * @generate-class-entries + */ function json_encode(mixed $value, int $flags = 0, int $depth = 512): string|false {} @@ -15,3 +18,7 @@ interface JsonSerializable /** @return mixed */ public function jsonSerialize(); } + +class JsonException extends Exception +{ +} diff --git a/ext/json/json_arginfo.h b/ext/json/json_arginfo.h index c4b20d7013..9cf5fad6ff 100644 --- a/ext/json/json_arginfo.h +++ b/ext/json/json_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2d1e6c422221ec7efbbd540ee777a5ce2c639943 */ + * Stub hash: bb9d306951484ce32054dff31dde37638f2841dc */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_json_encode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) @@ -43,3 +43,29 @@ static const zend_function_entry class_JsonSerializable_methods[] = { ZEND_ABSTRACT_ME_WITH_FLAGS(JsonSerializable, jsonSerialize, arginfo_class_JsonSerializable_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) ZEND_FE_END }; + + +static const zend_function_entry class_JsonException_methods[] = { + ZEND_FE_END +}; + +zend_class_entry *register_class_JsonSerializable() +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "JsonSerializable", class_JsonSerializable_methods); + class_entry = zend_register_internal_interface(&ce); + + return class_entry; +} + +zend_class_entry *register_class_JsonException(zend_class_entry *class_entry_Exception) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "JsonException", class_JsonException_methods); + class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception); + + return class_entry; +} + |