summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_exceptions.c86
-rw-r--r--Zend/zend_exceptions.stub.php47
-rw-r--r--Zend/zend_exceptions_arginfo.h217
-rw-r--r--Zend/zend_generators.c11
-rw-r--r--Zend/zend_generators.stub.php10
-rw-r--r--Zend/zend_generators_arginfo.h30
-rwxr-xr-xbuild/gen_stub.php495
-rw-r--r--ext/curl/curl_file.c7
-rw-r--r--ext/curl/curl_file.stub.php12
-rw-r--r--ext/curl/curl_file_arginfo.h31
-rw-r--r--ext/dom/php_dom.stub.php2
-rw-r--r--ext/dom/php_dom_arginfo.h2
-rw-r--r--ext/intl/common/common.stub.php5
-rw-r--r--ext/intl/common/common_arginfo.h14
-rw-r--r--ext/intl/common/common_enum.cpp9
-rw-r--r--ext/intl/resourcebundle/resourcebundle.stub.php5
-rw-r--r--ext/intl/resourcebundle/resourcebundle_arginfo.h14
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c13
-rw-r--r--ext/intl/transliterator/transliterator.stub.php8
-rw-r--r--ext/intl/transliterator/transliterator_arginfo.h19
-rw-r--r--ext/intl/transliterator/transliterator_class.c21
-rw-r--r--ext/libxml/libxml.c32
-rw-r--r--ext/libxml/libxml.stub.php15
-rw-r--r--ext/libxml/libxml_arginfo.h54
-rw-r--r--ext/pdo/pdo.c2
-rw-r--r--ext/pdo/pdo.stub.php6
-rw-r--r--ext/pdo/pdo_arginfo.h7
-rw-r--r--ext/pdo/pdo_stmt.c11
-rw-r--r--ext/pdo/pdo_stmt.stub.php8
-rw-r--r--ext/pdo/pdo_stmt_arginfo.h31
-rw-r--r--ext/simplexml/simplexml.c10
-rw-r--r--ext/simplexml/simplexml.stub.php5
-rw-r--r--ext/simplexml/simplexml_arginfo.h24
-rw-r--r--ext/spl/spl_iterators.stub.php3
-rw-r--r--ext/spl/spl_iterators_arginfo.h2
-rwxr-xr-xext/standard/user_filters.stub.php5
-rw-r--r--ext/standard/user_filters_arginfo.h2
-rw-r--r--ext/tokenizer/tokenizer.c30
-rw-r--r--ext/tokenizer/tokenizer.stub.php10
-rw-r--r--ext/tokenizer/tokenizer_arginfo.h38
-rw-r--r--ext/xml/xml.c5
-rw-r--r--ext/xml/xml.stub.php6
-rw-r--r--ext/xml/xml_arginfo.h14
-rw-r--r--ext/zend_test/test.c58
-rw-r--r--ext/zend_test/test.stub.php31
-rw-r--r--ext/zend_test/test_arginfo.h123
-rw-r--r--ext/zip/php_zip.stub.php3
-rw-r--r--ext/zip/php_zip_arginfo.h2
48 files changed, 1300 insertions, 295 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index e93526689d..0026860ef8 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -53,14 +53,21 @@ static zend_object_handlers default_exception_handlers;
/* {{{ zend_implement_throwable */
static int zend_implement_throwable(zend_class_entry *interface, zend_class_entry *class_type)
{
- if (instanceof_function(class_type, zend_ce_exception) || instanceof_function(class_type, zend_ce_error)) {
+ /* zend_ce_exception and zend_ce_error may not be initialized yet when this is caleld (e.g when
+ * implementing Throwable for Exception itself). Perform a manual inheritance check. */
+ zend_class_entry *root = class_type;
+ while (root->parent) {
+ root = root->parent;
+ }
+ if (zend_string_equals_literal(root->name, "Exception")
+ || zend_string_equals_literal(root->name, "Error")) {
return SUCCESS;
}
- zend_error_noreturn(E_ERROR, "Class %s cannot implement interface %s, extend %s or %s instead",
+
+ zend_error_noreturn(E_ERROR,
+ "Class %s cannot implement interface %s, extend Exception or Error instead",
ZSTR_VAL(class_type->name),
- ZSTR_VAL(interface->name),
- ZSTR_VAL(zend_ce_exception->name),
- ZSTR_VAL(zend_ce_error->name));
+ ZSTR_VAL(interface->name));
return FAILURE;
}
/* }}} */
@@ -740,87 +747,50 @@ ZEND_METHOD(Exception, __toString)
}
/* }}} */
-static void declare_exception_properties(zend_class_entry *ce)
-{
- zval val;
-
- zend_declare_property_string(ce, "message", sizeof("message")-1, "", ZEND_ACC_PROTECTED);
- zend_declare_property_string(ce, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE);
- zend_declare_property_long(ce, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED);
- zend_declare_property_null(ce, "file", sizeof("file")-1, ZEND_ACC_PROTECTED);
- zend_declare_property_null(ce, "line", sizeof("line")-1, ZEND_ACC_PROTECTED);
-
- ZVAL_EMPTY_ARRAY(&val);
- zend_declare_typed_property(
- ce, ZSTR_KNOWN(ZEND_STR_TRACE), &val, ZEND_ACC_PRIVATE, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY));
-
- ZVAL_NULL(&val);
- zend_declare_typed_property(
- ce, ZSTR_KNOWN(ZEND_STR_PREVIOUS), &val, ZEND_ACC_PRIVATE, NULL,
- (zend_type) ZEND_TYPE_INIT_CE(zend_ce_throwable, /* allow_null */ 1, 0));
-}
-
void zend_register_default_exception(void) /* {{{ */
{
- zend_class_entry ce;
-
- REGISTER_MAGIC_INTERFACE(throwable, Throwable);
- zend_class_implements(zend_ce_throwable, 1, zend_ce_stringable);
+ zend_ce_throwable = register_class_Throwable(zend_ce_stringable);
+ zend_ce_throwable->interface_gets_implemented = zend_implement_throwable;
memcpy(&default_exception_handlers, &std_object_handlers, sizeof(zend_object_handlers));
default_exception_handlers.clone_obj = NULL;
- INIT_CLASS_ENTRY(ce, "Exception", class_Exception_methods);
- zend_ce_exception = zend_register_internal_class_ex(&ce, NULL);
+ zend_ce_exception = register_class_Exception(zend_ce_throwable);
zend_ce_exception->create_object = zend_default_exception_new;
- zend_class_implements(zend_ce_exception, 1, zend_ce_throwable);
- declare_exception_properties(zend_ce_exception);
- INIT_CLASS_ENTRY(ce, "ErrorException", class_ErrorException_methods);
- zend_ce_error_exception = zend_register_internal_class_ex(&ce, zend_ce_exception);
+ zend_ce_error_exception = register_class_ErrorException(zend_ce_exception);
zend_ce_error_exception->create_object = zend_error_exception_new;
+ /* Declared manually because it uses constant E_ERROR. */
zend_declare_property_long(zend_ce_error_exception, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED);
- INIT_CLASS_ENTRY(ce, "Error", class_Error_methods);
- zend_ce_error = zend_register_internal_class_ex(&ce, NULL);
+ zend_ce_error = register_class_Error(zend_ce_throwable);
zend_ce_error->create_object = zend_default_exception_new;
- zend_class_implements(zend_ce_error, 1, zend_ce_throwable);
- declare_exception_properties(zend_ce_error);
- INIT_CLASS_ENTRY(ce, "CompileError", class_CompileError_methods);
- zend_ce_compile_error = zend_register_internal_class_ex(&ce, zend_ce_error);
+ zend_ce_compile_error = register_class_CompileError(zend_ce_error);
zend_ce_compile_error->create_object = zend_default_exception_new;
- INIT_CLASS_ENTRY(ce, "ParseError", class_ParseError_methods);
- zend_ce_parse_error = zend_register_internal_class_ex(&ce, zend_ce_compile_error);
+ zend_ce_parse_error = register_class_ParseError(zend_ce_compile_error);
zend_ce_parse_error->create_object = zend_default_exception_new;
- INIT_CLASS_ENTRY(ce, "TypeError", class_TypeError_methods);
- zend_ce_type_error = zend_register_internal_class_ex(&ce, zend_ce_error);
+ zend_ce_type_error = register_class_TypeError(zend_ce_error);
zend_ce_type_error->create_object = zend_default_exception_new;
- INIT_CLASS_ENTRY(ce, "ArgumentCountError", class_ArgumentCountError_methods);
- zend_ce_argument_count_error = zend_register_internal_class_ex(&ce, zend_ce_type_error);
+ zend_ce_argument_count_error = register_class_ArgumentCountError(zend_ce_type_error);
zend_ce_argument_count_error->create_object = zend_default_exception_new;
- INIT_CLASS_ENTRY(ce, "ValueError", class_ValueError_methods);
- zend_ce_value_error = zend_register_internal_class_ex(&ce, zend_ce_error);
+ zend_ce_value_error = register_class_ValueError(zend_ce_error);
zend_ce_value_error->create_object = zend_default_exception_new;
- INIT_CLASS_ENTRY(ce, "ArithmeticError", class_ArithmeticError_methods);
- zend_ce_arithmetic_error = zend_register_internal_class_ex(&ce, zend_ce_error);
+ zend_ce_arithmetic_error = register_class_ArithmeticError(zend_ce_error);
zend_ce_arithmetic_error->create_object = zend_default_exception_new;
- INIT_CLASS_ENTRY(ce, "DivisionByZeroError", class_DivisionByZeroError_methods);
- zend_ce_division_by_zero_error = zend_register_internal_class_ex(&ce, zend_ce_arithmetic_error);
+ zend_ce_division_by_zero_error = register_class_DivisionByZeroError(zend_ce_arithmetic_error);
zend_ce_division_by_zero_error->create_object = zend_default_exception_new;
- INIT_CLASS_ENTRY(zend_ce_unwind_exit, "UnwindExit", NULL);
-
- INIT_CLASS_ENTRY(ce, "UnhandledMatchError", NULL);
- zend_ce_unhandled_match_error = zend_register_internal_class_ex(&ce, zend_ce_error);
+ zend_ce_unhandled_match_error = register_class_UnhandledMatchError(zend_ce_error);
zend_ce_unhandled_match_error->create_object = zend_default_exception_new;
+
+ INIT_CLASS_ENTRY(zend_ce_unwind_exit, "UnwindExit", NULL);
}
/* }}} */
diff --git a/Zend/zend_exceptions.stub.php b/Zend/zend_exceptions.stub.php
index 11c1d500d3..89dff788c0 100644
--- a/Zend/zend_exceptions.stub.php
+++ b/Zend/zend_exceptions.stub.php
@@ -1,6 +1,9 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
interface Throwable extends Stringable
{
@@ -22,6 +25,19 @@ interface Throwable extends Stringable
class Exception implements Throwable
{
+ /** @var string */
+ protected $message = "";
+ /** @var string */
+ private $string = "";
+ /** @var int */
+ protected $code = 0;
+ /** @var string|null */
+ protected $file = null;
+ /** @var int|null */
+ protected $line = null;
+ private array $trace = [];
+ private ?Throwable $previous = null;
+
final private function __clone(): void {}
public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null) {}
@@ -49,13 +65,36 @@ class Exception implements Throwable
class ErrorException extends Exception
{
- public function __construct(string $message = "", int $code = 0, int $severity = E_ERROR, ?string $filename = null, ?int $line = null, ?Throwable $previous = null) {}
+ /** @var int */
+ protected $severity = E_ERROR;
+
+ public function __construct(
+ string $message = "",
+ int $code = 0,
+ int $severity = E_ERROR,
+ ?string $filename = null,
+ ?int $line = null,
+ ?Throwable $previous = null
+ ) {}
final public function getSeverity(): int {}
}
class Error implements Throwable
{
+ /** @var string */
+ protected $message = "";
+ /** @var string */
+ private $string = "";
+ /** @var int */
+ protected $code = 0;
+ /** @var string|null */
+ protected $file = null;
+ /** @var int|null */
+ protected $line = null;
+ private array $trace = [];
+ private ?Throwable $previous = null;
+
/** @implementation-alias Exception::__clone */
final private function __clone(): void {}
@@ -123,3 +162,7 @@ class ArithmeticError extends Error
class DivisionByZeroError extends ArithmeticError
{
}
+
+class UnhandledMatchError extends Error
+{
+}
diff --git a/Zend/zend_exceptions_arginfo.h b/Zend/zend_exceptions_arginfo.h
index 5b8dab9b4d..04e3ec753b 100644
--- a/Zend/zend_exceptions_arginfo.h
+++ b/Zend/zend_exceptions_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 3699b51b31e509c11435845c7e0d35a2608dd268 */
+ * Stub hash: 053248482a00efc35be505186f8430708bd280e9 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Throwable_getMessage, 0, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
@@ -180,3 +180,218 @@ static const zend_function_entry class_ArithmeticError_methods[] = {
static const zend_function_entry class_DivisionByZeroError_methods[] = {
ZEND_FE_END
};
+
+
+static const zend_function_entry class_UnhandledMatchError_methods[] = {
+ ZEND_FE_END
+};
+
+zend_class_entry *register_class_Throwable(zend_class_entry *class_entry_Stringable)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "Throwable", class_Throwable_methods);
+ class_entry = zend_register_internal_interface(&ce);
+ zend_class_implements(class_entry, 1, class_entry_Stringable);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_Exception(zend_class_entry *class_entry_Throwable)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "Exception", class_Exception_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ zend_class_implements(class_entry, 1, class_entry_Throwable);
+
+ zval property_message_default_value;
+ ZVAL_EMPTY_STRING(&property_message_default_value);
+ zend_string *property_message_name = zend_string_init("message", sizeof("message") - 1, 1);
+ zend_declare_property_ex(class_entry, property_message_name, &property_message_default_value, ZEND_ACC_PROTECTED, NULL);
+ zend_string_release(property_message_name);
+
+ zval property_string_default_value;
+ ZVAL_EMPTY_STRING(&property_string_default_value);
+ zend_string *property_string_name = zend_string_init("string", sizeof("string") - 1, 1);
+ zend_declare_property_ex(class_entry, property_string_name, &property_string_default_value, ZEND_ACC_PRIVATE, NULL);
+ zend_string_release(property_string_name);
+
+ zval property_code_default_value;
+ ZVAL_LONG(&property_code_default_value, 0);
+ zend_string *property_code_name = zend_string_init("code", sizeof("code") - 1, 1);
+ zend_declare_property_ex(class_entry, property_code_name, &property_code_default_value, ZEND_ACC_PROTECTED, NULL);
+ zend_string_release(property_code_name);
+
+ zval property_file_default_value;
+ ZVAL_NULL(&property_file_default_value);
+ zend_string *property_file_name = zend_string_init("file", sizeof("file") - 1, 1);
+ zend_declare_property_ex(class_entry, property_file_name, &property_file_default_value, ZEND_ACC_PROTECTED, NULL);
+ zend_string_release(property_file_name);
+
+ zval property_line_default_value;
+ ZVAL_NULL(&property_line_default_value);
+ zend_string *property_line_name = zend_string_init("line", sizeof("line") - 1, 1);
+ zend_declare_property_ex(class_entry, property_line_name, &property_line_default_value, ZEND_ACC_PROTECTED, NULL);
+ zend_string_release(property_line_name);
+
+ zval property_trace_default_value;
+ ZVAL_EMPTY_ARRAY(&property_trace_default_value);
+ zend_string *property_trace_name = zend_string_init("trace", sizeof("trace") - 1, 1);
+ zend_declare_typed_property(class_entry, property_trace_name, &property_trace_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY));
+ zend_string_release(property_trace_name);
+
+ zend_string *property_previous_class_Throwable = zend_string_init("Throwable", sizeof("Throwable")-1, 1);
+ zval property_previous_default_value;
+ ZVAL_NULL(&property_previous_default_value);
+ zend_string *property_previous_name = zend_string_init("previous", sizeof("previous") - 1, 1);
+ zend_declare_typed_property(class_entry, property_previous_name, &property_previous_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_previous_class_Throwable, 1, 0));
+ zend_string_release(property_previous_name);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_ErrorException(zend_class_entry *class_entry_Exception)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "ErrorException", class_ErrorException_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_Error(zend_class_entry *class_entry_Throwable)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "Error", class_Error_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ zend_class_implements(class_entry, 1, class_entry_Throwable);
+
+ zval property_message_default_value;
+ ZVAL_EMPTY_STRING(&property_message_default_value);
+ zend_string *property_message_name = zend_string_init("message", sizeof("message") - 1, 1);
+ zend_declare_property_ex(class_entry, property_message_name, &property_message_default_value, ZEND_ACC_PROTECTED, NULL);
+ zend_string_release(property_message_name);
+
+ zval property_string_default_value;
+ ZVAL_EMPTY_STRING(&property_string_default_value);
+ zend_string *property_string_name = zend_string_init("string", sizeof("string") - 1, 1);
+ zend_declare_property_ex(class_entry, property_string_name, &property_string_default_value, ZEND_ACC_PRIVATE, NULL);
+ zend_string_release(property_string_name);
+
+ zval property_code_default_value;
+ ZVAL_LONG(&property_code_default_value, 0);
+ zend_string *property_code_name = zend_string_init("code", sizeof("code") - 1, 1);
+ zend_declare_property_ex(class_entry, property_code_name, &property_code_default_value, ZEND_ACC_PROTECTED, NULL);
+ zend_string_release(property_code_name);
+
+ zval property_file_default_value;
+ ZVAL_NULL(&property_file_default_value);
+ zend_string *property_file_name = zend_string_init("file", sizeof("file") - 1, 1);
+ zend_declare_property_ex(class_entry, property_file_name, &property_file_default_value, ZEND_ACC_PROTECTED, NULL);
+ zend_string_release(property_file_name);
+
+ zval property_line_default_value;
+ ZVAL_NULL(&property_line_default_value);
+ zend_string *property_line_name = zend_string_init("line", sizeof("line") - 1, 1);
+ zend_declare_property_ex(class_entry, property_line_name, &property_line_default_value, ZEND_ACC_PROTECTED, NULL);
+ zend_string_release(property_line_name);
+
+ zval property_trace_default_value;
+ ZVAL_EMPTY_ARRAY(&property_trace_default_value);
+ zend_string *property_trace_name = zend_string_init("trace", sizeof("trace") - 1, 1);
+ zend_declare_typed_property(class_entry, property_trace_name, &property_trace_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY));
+ zend_string_release(property_trace_name);
+
+ zend_string *property_previous_class_Throwable = zend_string_init("Throwable", sizeof("Throwable")-1, 1);
+ zval property_previous_default_value;
+ ZVAL_NULL(&property_previous_default_value);
+ zend_string *property_previous_name = zend_string_init("previous", sizeof("previous") - 1, 1);
+ zend_declare_typed_property(class_entry, property_previous_name, &property_previous_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_previous_class_Throwable, 1, 0));
+ zend_string_release(property_previous_name);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_CompileError(zend_class_entry *class_entry_Error)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "CompileError", class_CompileError_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_Error);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_ParseError(zend_class_entry *class_entry_CompileError)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "ParseError", class_ParseError_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_CompileError);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_TypeError(zend_class_entry *class_entry_Error)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "TypeError", class_TypeError_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_Error);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_ArgumentCountError(zend_class_entry *class_entry_TypeError)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "ArgumentCountError", class_ArgumentCountError_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_TypeError);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_ValueError(zend_class_entry *class_entry_Error)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "ValueError", class_ValueError_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_Error);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_ArithmeticError(zend_class_entry *class_entry_Error)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "ArithmeticError", class_ArithmeticError_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_Error);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_DivisionByZeroError(zend_class_entry *class_entry_ArithmeticError)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "DivisionByZeroError", class_DivisionByZeroError_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_ArithmeticError);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_UnhandledMatchError(zend_class_entry *class_entry_Error)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "UnhandledMatchError", class_UnhandledMatchError_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_Error);
+
+ return class_entry;
+}
+
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index 4e6f1d4bbd..df94446d6f 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -1112,17 +1112,11 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob
void zend_register_generator_ce(void) /* {{{ */
{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, "Generator", class_Generator_methods);
- zend_ce_generator = zend_register_internal_class(&ce);
- zend_ce_generator->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
+ zend_ce_generator = register_class_Generator(zend_ce_iterator);
zend_ce_generator->create_object = zend_generator_create;
zend_ce_generator->serialize = zend_class_serialize_deny;
zend_ce_generator->unserialize = zend_class_unserialize_deny;
-
/* get_iterator has to be assigned *after* implementing the interface */
- zend_class_implements(zend_ce_generator, 1, zend_ce_iterator);
zend_ce_generator->get_iterator = zend_generator_get_iterator;
memcpy(&zend_generator_handlers, &std_object_handlers, sizeof(zend_object_handlers));
@@ -1132,7 +1126,6 @@ void zend_register_generator_ce(void) /* {{{ */
zend_generator_handlers.clone_obj = NULL;
zend_generator_handlers.get_constructor = zend_generator_get_constructor;
- INIT_CLASS_ENTRY(ce, "ClosedGeneratorException", NULL);
- zend_ce_ClosedGeneratorException = zend_register_internal_class_ex(&ce, zend_ce_exception);
+ zend_ce_ClosedGeneratorException = register_class_ClosedGeneratorException(zend_ce_exception);
}
/* }}} */
diff --git a/Zend/zend_generators.stub.php b/Zend/zend_generators.stub.php
index f2e47616ba..879fdb3642 100644
--- a/Zend/zend_generators.stub.php
+++ b/Zend/zend_generators.stub.php
@@ -1,7 +1,11 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
+/** @strict-properties */
final class Generator implements Iterator
{
public function rewind(): void {}
@@ -20,3 +24,7 @@ final class Generator implements Iterator
public function getReturn(): mixed {}
}
+
+class ClosedGeneratorException extends Exception
+{
+}
diff --git a/Zend/zend_generators_arginfo.h b/Zend/zend_generators_arginfo.h
index 22084d9feb..c4384a770e 100644
--- a/Zend/zend_generators_arginfo.h
+++ b/Zend/zend_generators_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 18d2bb68729ff622a5c0c124a8822f7ee882c2ec */
+ * Stub hash: 9d6c2801abbb78d402efb2b2ccdd5242438bd6a1 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_rewind, 0, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
@@ -46,3 +46,31 @@ static const zend_function_entry class_Generator_methods[] = {
ZEND_ME(Generator, getReturn, arginfo_class_Generator_getReturn, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
+
+
+static const zend_function_entry class_ClosedGeneratorException_methods[] = {
+ ZEND_FE_END
+};
+
+zend_class_entry *register_class_Generator(zend_class_entry *class_entry_Iterator)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "Generator", class_Generator_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
+ zend_class_implements(class_entry, 1, class_entry_Iterator);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_ClosedGeneratorException(zend_class_entry *class_entry_Exception)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "ClosedGeneratorException", class_ClosedGeneratorException_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_Exception);
+
+ return class_entry;
+}
+
diff --git a/build/gen_stub.php b/build/gen_stub.php
index 319446ef41..8653b6f3c5 100755
--- a/build/gen_stub.php
+++ b/build/gen_stub.php
@@ -2,11 +2,13 @@
<?php declare(strict_types=1);
use PhpParser\Comment\Doc as DocComment;
+use PhpParser\ConstExprEvaluator;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Class_;
+use PhpParser\Node\Stmt\Interface_;
use PhpParser\PrettyPrinter\Standard;
use PhpParser\PrettyPrinterAbstract;
@@ -54,6 +56,7 @@ function processStubFile(string $stubFile, Context $context): ?FileInfo {
initPhpParser();
$fileInfo = parseStubFile($stubCode);
+
$arginfoCode = generateArgInfoCode($fileInfo, $stubHash);
if (($context->forceRegeneration || $stubHash !== $oldStubHash) && file_put_contents($arginfoFile, $arginfoCode)) {
echo "Saved $arginfoFile\n";
@@ -63,11 +66,15 @@ function processStubFile(string $stubFile, Context $context): ?FileInfo {
foreach ($fileInfo->getAllFuncInfos() as $funcInfo) {
$funcInfo->discardInfoForOldPhpVersions();
}
+ foreach ($fileInfo->getAllPropertyInfos() as $propertyInfo) {
+ $propertyInfo->discardInfoForOldPhpVersions();
+ }
+
$arginfoCode = generateArgInfoCode($fileInfo, $stubHash);
if (($context->forceRegeneration || $stubHash !== $oldStubHash) && file_put_contents($legacyFile, $arginfoCode)) {
echo "Saved $legacyFile\n";
}
- }
+ }
return $fileInfo;
} catch (Exception $e) {
@@ -293,7 +300,7 @@ class Type {
return null;
}
- public function toArginfoType(): ?ArginfoType {
+ public function toArginfoType(): ArginfoType {
$classTypes = [];
$builtinTypes = [];
foreach ($this->types as $type) {
@@ -457,6 +464,24 @@ class ArgInfo {
}
}
+class PropertyName {
+ /** @var Name */
+ public $class;
+ /** @var string */
+ public $property;
+
+ public function __construct(Name $class, string $property)
+ {
+ $this->class = $class;
+ $this->property = $property;
+ }
+
+ public function __toString()
+ {
+ return $this->class->toString() . "::$" . $this->property;
+ }
+}
+
interface FunctionOrMethodName {
public function getDeclaration(): string;
public function getArgInfoName(): string;
@@ -804,6 +829,14 @@ class FuncInfo {
}
}
+ public function discardInfoForOldPhpVersions(): void {
+ $this->return->type = null;
+ foreach ($this->args as $arg) {
+ $arg->type = null;
+ $arg->defaultValue = null;
+ }
+ }
+
private function getFlagsAsArginfoString(): string
{
$flags = "ZEND_ACC_PUBLIC";
@@ -940,14 +973,6 @@ class FuncInfo {
return $methodSynopsis;
}
- public function discardInfoForOldPhpVersions(): void {
- $this->return->type = null;
- foreach ($this->args as $arg) {
- $arg->type = null;
- $arg->defaultValue = null;
- }
- }
-
private function appendMethodSynopsisTypeToElement(DOMDocument $doc, DOMElement $elementToAppend, Type $type) {
if (count($type->types) > 1) {
$typeElement = $doc->createElement('type');
@@ -965,16 +990,306 @@ class FuncInfo {
}
}
+class PropertyInfo
+{
+ /** @var PropertyName */
+ public $name;
+ /** @var int */
+ public $flags;
+ /** @var Type|null */
+ public $type;
+ /** @var Expr|null */
+ public $defaultValue;
+
+ public function __construct(PropertyName $name, int $flags, ?Type $type, ?Expr $defaultValue)
+ {
+ $this->name = $name;
+ $this->flags = $flags;
+ $this->type = $type;
+ $this->defaultValue = $defaultValue;
+ }
+
+ public function discardInfoForOldPhpVersions(): void {
+ $this->type = null;
+ }
+
+ public function getDeclaration(): string {
+ $code = "\n";
+
+ $propertyName = $this->name->property;
+
+ $defaultValueConstant = false;
+ if ($this->defaultValue === null) {
+ $defaultValue = null;
+ $defaultValueType = "undefined";
+ } else {
+ $evaluator = new ConstExprEvaluator(
+ function (Expr $expr) use (&$defaultValueConstant) {
+ if ($expr instanceof Expr\ConstFetch) {
+ $defaultValueConstant = true;
+ return null;
+ }
+
+ throw new Exception("Property $this->name has an unsupported default value");
+ }
+ );
+ $defaultValue = $evaluator->evaluateDirectly($this->defaultValue);
+ $defaultValueType = gettype($defaultValue);
+ }
+
+ if ($defaultValueConstant) {
+ echo "Skipping code generation for property $this->name, because it has a constant default value\n";
+ return "";
+ }
+
+ $typeCode = "";
+ if ($this->type) {
+ $arginfoType = $this->type->toArginfoType();
+ if ($arginfoType->hasClassType()) {
+ $simpleType = $this->type->tryToSimpleType();
+
+ $className = $arginfoType->classTypes[0]->name;
+ $code .= " zend_string *property_{$propertyName}_class_{$className} = zend_string_init(\"$className\", sizeof(\"$className\")-1, 1);\n";
+ if ($simpleType) {
+ $typeCode = "(zend_type) ZEND_TYPE_INIT_CLASS(property_{$propertyName}_class_{$className}, " . ((int) $this->type->isNullable()) . ", 0)";
+ } elseif (count($arginfoType->classTypes) === 1) {
+ $typeCode = "(zend_type) ZEND_TYPE_INIT_CLASS(property_{$propertyName}_class_{$className}, 0, " . $arginfoType->toTypeMask() . ")";
+ } else {
+ throw new Exception("Property $this->name has an unsupported union type");
+ }
+ } else {
+ $typeCode = "(zend_type) ZEND_TYPE_INIT_MASK(" . $arginfoType->toTypeMask() . ")";
+ }
+ }
+
+ $code .= $this->initializeValue($defaultValueType, $defaultValue, $this->type !== null);
+
+ $code .= "\tzend_string *property_{$propertyName}_name = zend_string_init(\"$propertyName\", sizeof(\"$propertyName\") - 1, 1);\n";
+ $nameCode = "property_{$propertyName}_name";
+
+ if ($this->type !== null) {
+ $code .= "\tzend_declare_typed_property(class_entry, $nameCode, &property_{$propertyName}_default_value, " . $this->getFlagsAsString() . ", NULL, $typeCode);\n";
+ } else {
+ $code .= "\tzend_declare_property_ex(class_entry, $nameCode, &property_{$propertyName}_default_value, " . $this->getFlagsAsString() . ", NULL);\n";
+ }
+ $code .= "\tzend_string_release(property_{$propertyName}_name);\n";
+
+ return $code;
+ }
+
+ /**
+ * @param mixed $value
+ */
+ private function initializeValue(string $type, $value, bool $isTyped): string
+ {
+ $name = $this->name->property;
+ $zvalName = "property_{$name}_default_value";
+
+ $code = "\tzval $zvalName;\n";
+
+ switch ($type) {
+ case "undefined":
+ if ($isTyped) {
+ $code .= "\tZVAL_UNDEF(&$zvalName);\n";
+ } else {
+ $code .= "\tZVAL_NULL(&$zvalName);\n";
+ }
+ break;
+
+ case "NULL":
+ $code .= "\tZVAL_NULL(&$zvalName);\n";
+ break;
+
+ case "boolean":
+ $code .= "\tZVAL_BOOL(&$zvalName, " . ((int) $value) . ");\n";
+ break;
+
+ case "integer":
+ $code .= "\tZVAL_LONG(&$zvalName, $value);\n";
+ break;
+
+ case "double":
+ $code .= "\tZVAL_DOUBLE(&$zvalName, $value);\n";
+ break;
+
+ case "string":
+ if (empty($value)) {
+ $code .= "\tZVAL_EMPTY_STRING(&$zvalName);\n";
+ } else {
+ $code .= "\tZVAL_STRING(&$zvalName, \"$value\");\n";
+ }
+ break;
+
+ case "array":
+ if (empty($value)) {
+ $code .= "\tZVAL_EMPTY_ARRAY(&$zvalName);\n";
+ } else {
+ throw new Exception("Unimplemented property default value");
+ }
+ break;
+
+ default:
+ throw new Exception("Invalid property default value");
+ }
+
+ return $code;
+ }
+
+ private function getFlagsAsString(): string
+ {
+ $flags = "ZEND_ACC_PUBLIC";
+ if ($this->flags & Class_::MODIFIER_PROTECTED) {
+ $flags = "ZEND_ACC_PROTECTED";
+ } elseif ($this->flags & Class_::MODIFIER_PRIVATE) {
+ $flags = "ZEND_ACC_PRIVATE";
+ }
+
+ if ($this->flags & Class_::MODIFIER_STATIC) {
+ $flags .= "|ZEND_ACC_STATIC";
+ }
+
+ return $flags;
+ }
+}
+
class ClassInfo {
/** @var Name */
public $name;
+ /** @var int */
+ public $flags;
+ /** @var string */
+ public $type;
+ /** @var string|null */
+ public $alias;
+ /** @var bool */
+ public $isDeprecated;
+ /** @var bool */
+ public $isStrictProperties;
+ /** @var Name[] */
+ public $extends;
+ /** @var Name[] */
+ public $implements;
+ /** @var PropertyInfo[] */
+ public $propertyInfos;
/** @var FuncInfo[] */
public $funcInfos;
- public function __construct(Name $name, array $funcInfos) {
+ /**
+ * @param Name[] $extends
+ * @param Name[] $implements
+ * @param PropertyInfo[] $propertyInfos
+ * @param FuncInfo[] $funcInfos
+ */
+ public function __construct(
+ Name $name,
+ int $flags,
+ string $type,
+ ?string $alias,
+ bool $isDeprecated,
+ bool $isStrictProperties,
+ array $extends,
+ array $implements,
+ array $propertyInfos,
+ array $funcInfos
+ ) {
$this->name = $name;
+ $this->flags = $flags;
+ $this->type = $type;
+ $this->alias = $alias;
+ $this->isDeprecated = $isDeprecated;
+ $this->isStrictProperties = $isStrictProperties;
+ $this->extends = $extends;
+ $this->implements = $implements;
+ $this->propertyInfos = $propertyInfos;
$this->funcInfos = $funcInfos;
}
+
+ public function getRegistration(): string
+ {
+ $params = [];
+ foreach ($this->extends as $extends) {
+ $params[] = "zend_class_entry *class_entry_" . implode("_", $extends->parts);
+ }
+ foreach ($this->implements as $implements) {
+ $params[] = "zend_class_entry *class_entry_" . implode("_", $implements->parts);
+ }
+
+ $escapedName = implode("_", $this->name->parts);
+
+ $code = "zend_class_entry *register_class_$escapedName(" . implode(", ", $params) . ")\n";
+
+ $code .= "{\n";
+ $code .= "\tzend_class_entry ce, *class_entry;\n\n";
+ if (count($this->name->parts) > 1) {
+ $className = $this->name->getLast();
+ $namespace = $this->name->slice(0, -1);
+
+ $code .= "\tINIT_NS_CLASS_ENTRY(ce, \"$namespace\", \"$className\", class_{$escapedName}_methods);\n";
+ } else {
+ $code .= "\tINIT_CLASS_ENTRY(ce, \"$this->name\", class_{$escapedName}_methods);\n";
+ }
+
+ if ($this->type === "class" || $this->type === "trait") {
+ $code .= "\tclass_entry = zend_register_internal_class_ex(&ce, " . (isset($this->extends[0]) ? "class_entry_" . str_replace("\\", "_", $this->extends[0]->toString()) : "NULL") . ");\n";
+ } else {
+ $code .= "\tclass_entry = zend_register_internal_interface(&ce);\n";
+ }
+ if ($this->getFlagsAsString()) {
+ $code .= "\tclass_entry->ce_flags |= " . $this->getFlagsAsString() . ";\n";
+ }
+
+ $implements = array_map(
+ function (Name $item) {
+ return "class_entry_" . implode("_", $item->parts);
+ },
+ $this->type === "interface" ? $this->extends : $this->implements
+ );
+
+ if (!empty($implements)) {
+ $code .= "\tzend_class_implements(class_entry, " . count($implements) . ", " . implode(", ", $implements) . ");\n";
+ }
+
+ if ($this->alias) {
+ $code .= "\tzend_register_class_alias(\"" . str_replace("\\", "_", $this->alias) . "\", class_entry);\n";
+ }
+
+ foreach ($this->propertyInfos as $property) {
+ $code .= $property->getDeclaration();
+ }
+
+ $code .= "\n\treturn class_entry;\n";
+
+ $code .= "}\n\n";
+
+ return $code;
+ }
+
+ private function getFlagsAsString(): string
+ {
+ $flags = [];
+
+ if ($this->type === "trait") {
+ $flags[] = "ZEND_ACC_TRAIT";
+ }
+
+ if ($this->flags & Class_::MODIFIER_FINAL) {
+ $flags[] = "ZEND_ACC_FINAL";
+ }
+
+ if ($this->flags & Class_::MODIFIER_ABSTRACT) {
+ $flags[] = "ZEND_ACC_ABSTRACT";
+ }
+
+ if ($this->isDeprecated) {
+ $flags[] = "ZEND_ACC_DEPRECATED";
+ }
+
+ if ($this->isStrictProperties) {
+ $flags[] = "ZEND_ACC_NO_DYNAMIC_PROPERTIES";
+ }
+
+ return implode("|", $flags);
+ }
}
class FileInfo {
@@ -988,6 +1303,8 @@ class FileInfo {
public $declarationPrefix = "";
/** @var bool */
public $generateLegacyArginfo = false;
+ /** @var bool */
+ public $generateClassEntries = false;
/**
* @return iterable<FuncInfo>
@@ -998,6 +1315,15 @@ class FileInfo {
yield from $classInfo->funcInfos;
}
}
+
+ /**
+ * @return iterable<PropertyInfo>
+ */
+ public function getAllPropertyInfos(): iterable {
+ foreach ($this->classInfos as $classInfo) {
+ yield from $classInfo->propertyInfos;
+ }
+ }
}
class DocCommentTag {
@@ -1209,6 +1535,98 @@ function parseFunctionLike(
}
}
+function parseProperty(
+ Name $class,
+ int $flags,
+ Stmt\PropertyProperty $property,
+ ?Node $type,
+ ?DocComment $comment
+): PropertyInfo {
+ $docType = false;
+
+ if ($comment) {
+ $tags = parseDocComment($comment);
+ foreach ($tags as $tag) {
+ if ($tag->name === 'var') {
+ $docType = true;
+ }
+ }
+ }
+
+ $propertyType = $type ? Type::fromNode($type) : null;
+ if ($propertyType === null && !$docType) {
+ throw new Exception("Missing type for property $class::\$$property->name");
+ }
+
+ if ($property->default instanceof Expr\ConstFetch &&
+ $property->default->name->toLowerString() === "null" &&
+ $propertyType && !$propertyType->isNullable()
+ ) {
+ $simpleType = $propertyType->tryToSimpleType();
+ if ($simpleType === null) {
+ throw new Exception(
+ "Property $class::\$$property->name has null default, but is not nullable");
+ }
+ }
+
+ return new PropertyInfo(
+ new PropertyName($class, $property->name->__toString()),
+ $flags,
+ $propertyType,
+ $property->default
+ );
+}
+
+/**
+ * @param PropertyInfo[] $properties
+ * @param FuncInfo[] $methods
+ */
+function parseClass(Name $name, Stmt\ClassLike $class, array $properties, array $methods): ClassInfo {
+ $flags = $class instanceof Class_ ? $class->flags : 0;
+ $comment = $class->getDocComment();
+ $alias = null;
+ $isDeprecated = false;
+ $isStrictProperties = false;
+
+ if ($comment) {
+ $tags = parseDocComment($comment);
+ foreach ($tags as $tag) {
+ if ($tag->name === 'alias') {
+ $alias = $tag->getValue();
+ } else if ($tag->name === 'deprecated') {
+ $isDeprecated = true;
+ } else if ($tag->name === 'strict-properties') {
+ $isStrictProperties = true;
+ }
+ }
+ }
+
+ $extends = [];
+ $implements = [];
+
+ if ($class instanceof Class_) {
+ if ($class->extends) {
+ $extends[] = $class->extends;
+ }
+ $implements = $class->implements;
+ } elseif ($class instanceof Interface_) {
+ $extends = $class->extends;
+ }
+
+ return new ClassInfo(
+ $name,
+ $flags,
+ $class instanceof Class_ ? "class" : ($class instanceof Interface_ ? "interface" : "trait"),
+ $alias,
+ $isDeprecated,
+ $isStrictProperties,
+ $extends,
+ $implements,
+ $properties,
+ $methods
+ );
+}
+
function handlePreprocessorConditions(array &$conds, Stmt $stmt): ?string {
foreach ($stmt->getComments() as $comment) {
$text = trim($comment->getText());
@@ -1281,6 +1699,7 @@ function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstrac
if ($stmt instanceof Stmt\ClassLike) {
$className = $stmt->namespacedName;
+ $propertyInfos = [];
$methodInfos = [];
foreach ($stmt->stmts as $classStmt) {
$cond = handlePreprocessorConditions($conds, $classStmt);
@@ -1288,7 +1707,7 @@ function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstrac
continue;
}
- if (!$classStmt instanceof Stmt\ClassMethod) {
+ if (!$classStmt instanceof Stmt\ClassMethod && !$classStmt instanceof Stmt\Property) {
throw new Exception("Not implemented {$classStmt->getType()}");
}
@@ -1303,20 +1722,32 @@ function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstrac
}
if (!($flags & Class_::VISIBILITY_MODIFIER_MASK)) {
- throw new Exception("Method visibility modifier is required");
+ throw new Exception("Visibility modifier is required");
}
- $methodInfos[] = parseFunctionLike(
- $prettyPrinter,
- new MethodName($className, $classStmt->name->toString()),
- $classFlags,
- $flags,
- $classStmt,
- $cond
- );
+ if ($classStmt instanceof Stmt\Property) {
+ foreach ($classStmt->props as $property) {
+ $propertyInfos[] = parseProperty(
+ $className,
+ $flags,
+ $property,
+ $classStmt->type,
+ $classStmt->getDocComment()
+ );
+ }
+ } else if ($classStmt instanceof Stmt\ClassMethod) {
+ $methodInfos[] = parseFunctionLike(
+ $prettyPrinter,
+ new MethodName($className, $classStmt->name->toString()),
+ $classFlags,
+ $flags,
+ $classStmt,
+ $cond
+ );
+ }
}
- $fileInfo->classInfos[] = new ClassInfo($className, $methodInfos);
+ $fileInfo->classInfos[] = parseClass($className, $stmt, $propertyInfos, $methodInfos);
continue;
}
@@ -1348,10 +1779,16 @@ function parseStubFile(string $code): FileInfo {
$fileInfo->declarationPrefix = $tag->value ? $tag->value . " " : "";
} else if ($tag->name === 'generate-legacy-arginfo') {
$fileInfo->generateLegacyArginfo = true;
+ } else if ($tag->name === 'generate-class-entries') {
+ $fileInfo->generateClassEntries = true;
}
}
}
+ if ($fileInfo->generateClassEntries && !$fileInfo->generateFunctionEntries) {
+ throw new Exception("Function entry generation must be enabled when generating class entries");
+ }
+
handleStatements($fileInfo, $stmts, $prettyPrinter);
return $fileInfo;
}
@@ -1533,6 +1970,20 @@ function generateArgInfoCode(FileInfo $fileInfo, string $stubHash): string {
}
}
+ if ($fileInfo->generateClassEntries) {
+ $code .= generateClassEntryCode($fileInfo);
+ }
+
+ return $code;
+}
+
+function generateClassEntryCode(FileInfo $fileInfo): string {
+ $code = "\n";
+
+ foreach ($fileInfo->classInfos as $class) {
+ $code .= $class->getRegistration();
+ }
+
return $code;
}
diff --git a/ext/curl/curl_file.c b/ext/curl/curl_file.c
index aad162604a..a81239a60a 100644
--- a/ext/curl/curl_file.c
+++ b/ext/curl/curl_file.c
@@ -122,12 +122,7 @@ ZEND_METHOD(CURLFile, setPostFilename)
void curlfile_register_class(void)
{
- zend_class_entry ce;
- INIT_CLASS_ENTRY( ce, "CURLFile", class_CURLFile_methods );
- curl_CURLFile_class = zend_register_internal_class(&ce);
+ curl_CURLFile_class = register_class_CURLFile();
curl_CURLFile_class->serialize = zend_class_serialize_deny;
curl_CURLFile_class->unserialize = zend_class_unserialize_deny;
- zend_declare_property_string(curl_CURLFile_class, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC);
- zend_declare_property_string(curl_CURLFile_class, "mime", sizeof("mime")-1, "", ZEND_ACC_PUBLIC);
- zend_declare_property_string(curl_CURLFile_class, "postname", sizeof("postname")-1, "", ZEND_ACC_PUBLIC);
}
diff --git a/ext/curl/curl_file.stub.php b/ext/curl/curl_file.stub.php
index 28a218c698..7b0c83aa2f 100644
--- a/ext/curl/curl_file.stub.php
+++ b/ext/curl/curl_file.stub.php
@@ -1,9 +1,19 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
class CURLFile
{
+ /** @var string */
+ public $name = "";
+ /** @var string */
+ public $mime = "";
+ /** @var string */
+ public $postname = "";
+
public function __construct(string $filename, ?string $mime_type = null, ?string $posted_filename = null) {}
/** @return string */
diff --git a/ext/curl/curl_file_arginfo.h b/ext/curl/curl_file_arginfo.h
index c745d597da..47be45ac95 100644
--- a/ext/curl/curl_file_arginfo.h
+++ b/ext/curl/curl_file_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: a81720edab23748f6dce30306f5a5ffc9634da5d */
+ * Stub hash: 4cdab686b39e7c4bb03bd5517a637ff25a38b04a */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
@@ -40,3 +40,32 @@ static const zend_function_entry class_CURLFile_methods[] = {
ZEND_ME(CURLFile, setPostFilename, arginfo_class_CURLFile_setPostFilename, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
+
+zend_class_entry *register_class_CURLFile()
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "CURLFile", class_CURLFile_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ zval property_name_default_value;
+ ZVAL_EMPTY_STRING(&property_name_default_value);
+ zend_string *property_name_name = zend_string_init("name", sizeof("name") - 1, 1);
+ zend_declare_property_ex(class_entry, property_name_name, &property_name_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_name_name);
+
+ zval property_mime_default_value;
+ ZVAL_EMPTY_STRING(&property_mime_default_value);
+ zend_string *property_mime_name = zend_string_init("mime", sizeof("mime") - 1, 1);
+ zend_declare_property_ex(class_entry, property_mime_name, &property_mime_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_mime_name);
+
+ zval property_postname_default_value;
+ ZVAL_EMPTY_STRING(&property_postname_default_value);
+ zend_string *property_postname_name = zend_string_init("postname", sizeof("postname") - 1, 1);
+ zend_declare_property_ex(class_entry, property_postname_name, &property_postname_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_postname_name);
+
+ return class_entry;
+}
+
diff --git a/ext/dom/php_dom.stub.php b/ext/dom/php_dom.stub.php
index cdc6b99846..edebd13dd5 100644
--- a/ext/dom/php_dom.stub.php
+++ b/ext/dom/php_dom.stub.php
@@ -356,6 +356,8 @@ class DOMDocument implements DOMParentNode
final class DOMException extends Exception
{
+ /** @var int */
+ public $code = 0;
}
class DOMText
diff --git a/ext/dom/php_dom_arginfo.h b/ext/dom/php_dom_arginfo.h
index 844d2b9186..16819e2a68 100644
--- a/ext/dom/php_dom_arginfo.h
+++ b/ext/dom/php_dom_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 7cba1a7a34cc4789871faf44fc4794a48db26e61 */
+ * Stub hash: 3b8099cbadc28541bf0206c6173e82e5ba2f48ce */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1)
ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)
diff --git a/ext/intl/common/common.stub.php b/ext/intl/common/common.stub.php
index a0a8a20ffb..1e7c3d0f51 100644
--- a/ext/intl/common/common.stub.php
+++ b/ext/intl/common/common.stub.php
@@ -1,6 +1,9 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
class IntlIterator implements Iterator
{
diff --git a/ext/intl/common/common_arginfo.h b/ext/intl/common/common_arginfo.h
index 08679923cb..8e51c2da97 100644
--- a/ext/intl/common/common_arginfo.h
+++ b/ext/intl/common/common_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: cf905a693064ae31b6434e84f6c63bf7c9b804a6 */
+ * Stub hash: 88ed89560edf65b73b27618d3dafa40d54432c2d */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlIterator_current, 0, 0, 0)
ZEND_END_ARG_INFO()
@@ -28,3 +28,15 @@ static const zend_function_entry class_IntlIterator_methods[] = {
ZEND_ME(IntlIterator, valid, arginfo_class_IntlIterator_valid, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
+
+zend_class_entry *register_class_IntlIterator(zend_class_entry *class_entry_Iterator)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "IntlIterator", class_IntlIterator_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ zend_class_implements(class_entry, 1, class_entry_Iterator);
+
+ return class_entry;
+}
+
diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp
index 9d823ead57..1ea046b87c 100644
--- a/ext/intl/common/common_enum.cpp
+++ b/ext/intl/common/common_enum.cpp
@@ -286,15 +286,10 @@ PHP_METHOD(IntlIterator, valid)
*/
U_CFUNC void intl_register_IntlIterator_class(void)
{
- zend_class_entry ce;
-
/* Create and register 'IntlIterator' class. */
- INIT_CLASS_ENTRY(ce, "IntlIterator", class_IntlIterator_methods);
- ce.create_object = IntlIterator_object_create;
- IntlIterator_ce_ptr = zend_register_internal_class(&ce);
+ IntlIterator_ce_ptr = register_class_IntlIterator(zend_ce_iterator);
+ IntlIterator_ce_ptr->create_object = IntlIterator_object_create;
IntlIterator_ce_ptr->get_iterator = IntlIterator_get_iterator;
- zend_class_implements(IntlIterator_ce_ptr, 1,
- zend_ce_iterator);
memcpy(&IntlIterator_handlers, &std_object_handlers,
sizeof IntlIterator_handlers);
diff --git a/ext/intl/resourcebundle/resourcebundle.stub.php b/ext/intl/resourcebundle/resourcebundle.stub.php
index fccd65e3df..3585bf76e8 100644
--- a/ext/intl/resourcebundle/resourcebundle.stub.php
+++ b/ext/intl/resourcebundle/resourcebundle.stub.php
@@ -1,6 +1,9 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
class ResourceBundle implements IteratorAggregate, Countable
{
diff --git a/ext/intl/resourcebundle/resourcebundle_arginfo.h b/ext/intl/resourcebundle/resourcebundle_arginfo.h
index fca8a23104..6b7565f91a 100644
--- a/ext/intl/resourcebundle/resourcebundle_arginfo.h
+++ b/ext/intl/resourcebundle/resourcebundle_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: ba5e5a57404b44d2be662e9a6b5abb1a44ccfb22 */
+ * Stub hash: 474a5f2d63f94aaf68c92839bb343d74179111a7 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ResourceBundle___construct, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
@@ -50,3 +50,15 @@ static const zend_function_entry class_ResourceBundle_methods[] = {
ZEND_ME(ResourceBundle, getIterator, arginfo_class_ResourceBundle_getIterator, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
+
+zend_class_entry *register_class_ResourceBundle(zend_class_entry *class_entry_IteratorAggregate, zend_class_entry *class_entry_Countable)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "ResourceBundle", class_ResourceBundle_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ zend_class_implements(class_entry, 2, class_entry_IteratorAggregate, class_entry_Countable);
+
+ return class_entry;
+}
+
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index 351c3278a7..a10e1cfd9b 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -366,14 +366,9 @@ PHP_METHOD(ResourceBundle, getIterator) {
*/
void resourcebundle_register_class( void )
{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY( ce, "ResourceBundle", class_ResourceBundle_methods );
-
- ce.create_object = ResourceBundle_object_create;
- ce.get_iterator = resourcebundle_get_iterator;
-
- ResourceBundle_ce_ptr = zend_register_internal_class( &ce );
+ ResourceBundle_ce_ptr = register_class_ResourceBundle(zend_ce_aggregate, zend_ce_countable);
+ ResourceBundle_ce_ptr->create_object = ResourceBundle_object_create;
+ ResourceBundle_ce_ptr->get_iterator = resourcebundle_get_iterator;
ResourceBundle_object_handlers = std_object_handlers;
ResourceBundle_object_handlers.offset = XtOffsetOf(ResourceBundle_object, zend);
@@ -381,7 +376,5 @@ void resourcebundle_register_class( void )
ResourceBundle_object_handlers.free_obj = ResourceBundle_object_free;
ResourceBundle_object_handlers.read_dimension = resourcebundle_array_get;
ResourceBundle_object_handlers.count_elements = resourcebundle_array_count;
-
- zend_class_implements(ResourceBundle_ce_ptr, 2, zend_ce_aggregate, zend_ce_countable);
}
/* }}} */
diff --git a/ext/intl/transliterator/transliterator.stub.php b/ext/intl/transliterator/transliterator.stub.php
index c14a4cf0c0..d9e29bd073 100644
--- a/ext/intl/transliterator/transliterator.stub.php
+++ b/ext/intl/transliterator/transliterator.stub.php
@@ -1,9 +1,15 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
class Transliterator
{
+ /** @var string|null */
+ public $id;
+
final private function __construct() {}
/**
diff --git a/ext/intl/transliterator/transliterator_arginfo.h b/ext/intl/transliterator/transliterator_arginfo.h
index 406a086293..a2f0660c97 100644
--- a/ext/intl/transliterator/transliterator_arginfo.h
+++ b/ext/intl/transliterator/transliterator_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 4bcb458de884a68797bee28339399fb8c8664605 */
+ * Stub hash: 41b9929a370a5f4c0f3ba0dd2c98e766a1941f0d */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Transliterator___construct, 0, 0, 0)
ZEND_END_ARG_INFO()
@@ -50,3 +50,20 @@ static const zend_function_entry class_Transliterator_methods[] = {
ZEND_ME_MAPPING(getErrorMessage, transliterator_get_error_message, arginfo_class_Transliterator_getErrorMessage, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
+
+zend_class_entry *register_class_Transliterator()
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "Transliterator", class_Transliterator_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ zval property_id_default_value;
+ ZVAL_NULL(&property_id_default_value);
+ zend_string *property_id_name = zend_string_init("id", sizeof("id") - 1, 1);
+ zend_declare_property_ex(class_entry, property_id_name, &property_id_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_id_name);
+
+ return class_entry;
+}
+
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index e444f0eef4..9959be91c1 100644
--- a/ext/intl/transliterator/transliterator_class.c
+++ b/ext/intl/transliterator/transliterator_class.c
@@ -258,14 +258,10 @@ static zval *Transliterator_write_property( zend_object *object, zend_string *na
*/
void transliterator_register_Transliterator_class( void )
{
- zend_class_entry ce;
-
/* Create and register 'Transliterator' class. */
- INIT_CLASS_ENTRY( ce, "Transliterator", class_Transliterator_methods );
- ce.create_object = Transliterator_object_create;
- Transliterator_ce_ptr = zend_register_internal_class( &ce );
- memcpy( &Transliterator_handlers, &std_object_handlers,
- sizeof Transliterator_handlers );
+ Transliterator_ce_ptr = register_class_Transliterator();
+ Transliterator_ce_ptr->create_object = Transliterator_object_create;
+ memcpy( &Transliterator_handlers, &std_object_handlers, sizeof Transliterator_handlers );
Transliterator_handlers.offset = XtOffsetOf(Transliterator_object, zo);
Transliterator_handlers.free_obj = Transliterator_objects_free;
Transliterator_handlers.clone_obj = Transliterator_clone_obj;
@@ -273,17 +269,6 @@ void transliterator_register_Transliterator_class( void )
Transliterator_handlers.read_property = Transliterator_read_property;
Transliterator_handlers.write_property = Transliterator_write_property;
- /* Declare 'Transliterator' class properties */
- if( !Transliterator_ce_ptr )
- {
- zend_error( E_ERROR,
- "Transliterator: attempt to create properties "
- "on a non-registered class." );
- return;
- }
- zend_declare_property_null( Transliterator_ce_ptr,
- "id", sizeof( "id" ) - 1, ZEND_ACC_PUBLIC );
-
/* constants are declared in transliterator_register_constants, called from MINIT */
}
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index b3ce853ef1..088af30713 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -738,8 +738,6 @@ PHP_LIBXML_API void php_libxml_switch_context(zval *context, zval *oldcontext)
static PHP_MINIT_FUNCTION(libxml)
{
- zend_class_entry ce;
-
php_libxml_initialize();
REGISTER_LONG_CONSTANT("LIBXML_VERSION", LIBXML_VERSION, CONST_CS | CONST_PERSISTENT);
@@ -787,35 +785,7 @@ static PHP_MINIT_FUNCTION(libxml)
REGISTER_LONG_CONSTANT("LIBXML_ERR_ERROR", XML_ERR_ERROR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LIBXML_ERR_FATAL", XML_ERR_FATAL, CONST_CS | CONST_PERSISTENT);
- INIT_CLASS_ENTRY(ce, "LibXMLError", NULL);
- libxmlerror_class_entry = zend_register_internal_class(&ce);
-
- zval default_val;
- zend_string *name;
- ZVAL_UNDEF(&default_val);
-
- name = zend_string_init("level", sizeof("level")-1, 1);
- zend_declare_typed_property(
- libxmlerror_class_entry, name, &default_val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
- zend_string_release(name);
- zend_declare_typed_property(
- libxmlerror_class_entry, ZSTR_KNOWN(ZEND_STR_CODE), &default_val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
- name = zend_string_init("column", sizeof("column")-1, 1);
- zend_declare_typed_property(
- libxmlerror_class_entry, name, &default_val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
- zend_string_release(name);
- zend_declare_typed_property(
- libxmlerror_class_entry, ZSTR_KNOWN(ZEND_STR_MESSAGE), &default_val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
- zend_declare_typed_property(
- libxmlerror_class_entry, ZSTR_KNOWN(ZEND_STR_FILE), &default_val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
- zend_declare_typed_property(
- libxmlerror_class_entry, ZSTR_KNOWN(ZEND_STR_LINE), &default_val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ libxmlerror_class_entry = register_class_LibXMLError();
if (sapi_module.name) {
static const char * const supported_sapis[] = {
diff --git a/ext/libxml/libxml.stub.php b/ext/libxml/libxml.stub.php
index 12685bd8ce..b20d681b96 100644
--- a/ext/libxml/libxml.stub.php
+++ b/ext/libxml/libxml.stub.php
@@ -1,6 +1,19 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
+
+class LibXMLError
+{
+ public int $level;
+ public int $code;
+ public int $column;
+ public string $message;
+ public string $file;
+ public int $line;
+}
/** @param resource $context */
function libxml_set_streams_context($context): void {}
diff --git a/ext/libxml/libxml_arginfo.h b/ext/libxml/libxml_arginfo.h
index 217bff288b..a10639b619 100644
--- a/ext/libxml/libxml_arginfo.h
+++ b/ext/libxml/libxml_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: ded229511dc2bc3912d35b8055c0fd69420baff0 */
+ * Stub hash: 2de903a36e16ddd4ff7ca0ff5be0c2be4697bd7e */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_set_streams_context, 0, 1, IS_VOID, 0)
ZEND_ARG_INFO(0, context)
@@ -46,3 +46,55 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(libxml_set_external_entity_loader, arginfo_libxml_set_external_entity_loader)
ZEND_FE_END
};
+
+
+static const zend_function_entry class_LibXMLError_methods[] = {
+ ZEND_FE_END
+};
+
+zend_class_entry *register_class_LibXMLError()
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "LibXMLError", class_LibXMLError_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ zval property_level_default_value;
+ ZVAL_UNDEF(&property_level_default_value);
+ zend_string *property_level_name = zend_string_init("level", sizeof("level") - 1, 1);
+ zend_declare_typed_property(class_entry, property_level_name, &property_level_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_level_name);
+
+ zval property_code_default_value;
+ ZVAL_UNDEF(&property_code_default_value);
+ zend_string *property_code_name = zend_string_init("code", sizeof("code") - 1, 1);
+ zend_declare_typed_property(class_entry, property_code_name, &property_code_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_code_name);
+
+ zval property_column_default_value;
+ ZVAL_UNDEF(&property_column_default_value);
+ zend_string *property_column_name = zend_string_init("column", sizeof("column") - 1, 1);
+ zend_declare_typed_property(class_entry, property_column_name, &property_column_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_column_name);
+
+ zval property_message_default_value;
+ ZVAL_UNDEF(&property_message_default_value);
+ zend_string *property_message_name = zend_string_init("message", sizeof("message") - 1, 1);
+ zend_declare_typed_property(class_entry, property_message_name, &property_message_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_message_name);
+
+ zval property_file_default_value;
+ ZVAL_UNDEF(&property_file_default_value);
+ zend_string *property_file_name = zend_string_init("file", sizeof("file") - 1, 1);
+ zend_declare_typed_property(class_entry, property_file_name, &property_file_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_file_name);
+
+ zval property_line_default_value;
+ ZVAL_UNDEF(&property_line_default_value);
+ zend_string *property_line_name = zend_string_init("line", sizeof("line") - 1, 1);
+ zend_declare_typed_property(class_entry, property_line_name, &property_line_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_line_name);
+
+ return class_entry;
+}
+
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c
index 835b25c24c..b3d999bed5 100644
--- a/ext/pdo/pdo.c
+++ b/ext/pdo/pdo.c
@@ -303,7 +303,7 @@ PHP_MINIT_FUNCTION(pdo)
le_ppdo = zend_register_list_destructors_ex(NULL, php_pdo_pdbh_dtor,
"PDO persistent database", module_number);
- INIT_CLASS_ENTRY(ce, "PDOException", NULL);
+ INIT_CLASS_ENTRY(ce, "PDOException", class_PDOException_methods);
pdo_exception_ce = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException);
diff --git a/ext/pdo/pdo.stub.php b/ext/pdo/pdo.stub.php
index a5ec51f7f7..35404cade6 100644
--- a/ext/pdo/pdo.stub.php
+++ b/ext/pdo/pdo.stub.php
@@ -2,4 +2,10 @@
/** @generate-function-entries */
+class PDOException extends RuntimeException
+{
+ /** @var array|null */
+ public $errorInfo;
+}
+
function pdo_drivers(): array {}
diff --git a/ext/pdo/pdo_arginfo.h b/ext/pdo/pdo_arginfo.h
index 1dda2fd42a..fc9e52de9e 100644
--- a/ext/pdo/pdo_arginfo.h
+++ b/ext/pdo/pdo_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 5f8d0ae7732bdca8c60638021c4368f55d62826f */
+ * Stub hash: 68f2e4abc1071fdf8046695264de5768a8c10719 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pdo_drivers, 0, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
@@ -12,3 +12,8 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(pdo_drivers, arginfo_pdo_drivers)
ZEND_FE_END
};
+
+
+static const zend_function_entry class_PDOException_methods[] = {
+ ZEND_FE_END
+};
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index bfb06547c3..1cb7bfd65c 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2499,16 +2499,11 @@ zend_object *pdo_row_new(zend_class_entry *ce)
void pdo_stmt_init(void)
{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, "PDOStatement", class_PDOStatement_methods);
- pdo_dbstmt_ce = zend_register_internal_class(&ce);
+ pdo_dbstmt_ce = register_class_PDOStatement(zend_ce_aggregate);
pdo_dbstmt_ce->get_iterator = pdo_stmt_iter_get;
pdo_dbstmt_ce->create_object = pdo_dbstmt_new;
pdo_dbstmt_ce->serialize = zend_class_serialize_deny;
pdo_dbstmt_ce->unserialize = zend_class_unserialize_deny;
- zend_class_implements(pdo_dbstmt_ce, 1, zend_ce_aggregate);
- zend_declare_property_null(pdo_dbstmt_ce, "queryString", sizeof("queryString")-1, ZEND_ACC_PUBLIC);
memcpy(&pdo_dbstmt_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
pdo_dbstmt_object_handlers.offset = XtOffsetOf(pdo_stmt_t, std);
@@ -2520,9 +2515,7 @@ void pdo_stmt_init(void)
pdo_dbstmt_object_handlers.compare = dbstmt_compare;
pdo_dbstmt_object_handlers.clone_obj = NULL;
- INIT_CLASS_ENTRY(ce, "PDORow", class_PDORow_methods);
- pdo_row_ce = zend_register_internal_class(&ce);
- pdo_row_ce->ce_flags |= ZEND_ACC_FINAL; /* when removing this a lot of handlers need to be redone */
+ pdo_row_ce = register_class_PDORow();
pdo_row_ce->create_object = pdo_row_new;
pdo_row_ce->serialize = zend_class_serialize_deny;
pdo_row_ce->unserialize = zend_class_unserialize_deny;
diff --git a/ext/pdo/pdo_stmt.stub.php b/ext/pdo/pdo_stmt.stub.php
index ab3ab6a42f..dbc8aa8635 100644
--- a/ext/pdo/pdo_stmt.stub.php
+++ b/ext/pdo/pdo_stmt.stub.php
@@ -1,9 +1,15 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
class PDOStatement implements IteratorAggregate
{
+ /** @var string|null */
+ public $queryString;
+
/** @return bool */
public function bindColumn(string|int $column, mixed &$var, int $type = 0, int $maxLength = 0, mixed $driverOptions = null) {}
diff --git a/ext/pdo/pdo_stmt_arginfo.h b/ext/pdo/pdo_stmt_arginfo.h
index 25858477eb..ebfb0c7156 100644
--- a/ext/pdo/pdo_stmt_arginfo.h
+++ b/ext/pdo/pdo_stmt_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 9d890849a08b43cb35e2cd8468aeaabfc0a7f218 */
+ * Stub hash: 17cecd2e7b3f80314e18bbd44e51b54c9ed061a7 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindColumn, 0, 0, 2)
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)
@@ -134,3 +134,32 @@ static const zend_function_entry class_PDOStatement_methods[] = {
static const zend_function_entry class_PDORow_methods[] = {
ZEND_FE_END
};
+
+zend_class_entry *register_class_PDOStatement(zend_class_entry *class_entry_IteratorAggregate)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "PDOStatement", class_PDOStatement_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ zend_class_implements(class_entry, 1, class_entry_IteratorAggregate);
+
+ zval property_queryString_default_value;
+ ZVAL_NULL(&property_queryString_default_value);
+ zend_string *property_queryString_name = zend_string_init("queryString", sizeof("queryString") - 1, 1);
+ zend_declare_property_ex(class_entry, property_queryString_name, &property_queryString_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_queryString_name);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_PDORow()
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "PDORow", class_PDORow_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ class_entry->ce_flags |= ZEND_ACC_FINAL;
+
+ return class_entry;
+}
+
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 32899e576c..dc74967ede 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -2682,14 +2682,9 @@ ZEND_GET_MODULE(simplexml)
/* {{{ PHP_MINIT_FUNCTION(simplexml) */
PHP_MINIT_FUNCTION(simplexml)
{
- zend_class_entry ce;
-
- INIT_CLASS_ENTRY(ce, "SimpleXMLElement", class_SimpleXMLElement_methods);
- sxe_class_entry = zend_register_internal_class(&ce);
+ sxe_class_entry = register_class_SimpleXMLElement(zend_ce_stringable, zend_ce_countable, spl_ce_RecursiveIterator);
sxe_class_entry->create_object = sxe_object_new;
sxe_class_entry->get_iterator = php_sxe_get_iterator;
- zend_class_implements(sxe_class_entry, 3,
- zend_ce_countable, zend_ce_stringable, spl_ce_RecursiveIterator);
memcpy(&sxe_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
sxe_object_handlers.offset = XtOffsetOf(php_sxe_object, zo);
@@ -2719,8 +2714,7 @@ PHP_MINIT_FUNCTION(simplexml)
/* TODO: Why do we have two variables for this? */
ce_SimpleXMLElement = sxe_class_entry;
- INIT_CLASS_ENTRY(ce, "SimpleXMLIterator", NULL);
- ce_SimpleXMLIterator = zend_register_internal_class_ex(&ce, ce_SimpleXMLElement);
+ ce_SimpleXMLIterator = register_class_SimpleXMLIterator(ce_SimpleXMLElement);
php_libxml_register_export(sxe_class_entry, simplexml_export_node);
diff --git a/ext/simplexml/simplexml.stub.php b/ext/simplexml/simplexml.stub.php
index 7d56de88e9..da562db7e4 100644
--- a/ext/simplexml/simplexml.stub.php
+++ b/ext/simplexml/simplexml.stub.php
@@ -1,6 +1,9 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
function simplexml_load_file(string $filename, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $namespace_or_prefix = "", bool $is_prefix = false): SimpleXMLElement|false {}
diff --git a/ext/simplexml/simplexml_arginfo.h b/ext/simplexml/simplexml_arginfo.h
index 7da3c9f33c..89bb379a1d 100644
--- a/ext/simplexml/simplexml_arginfo.h
+++ b/ext/simplexml/simplexml_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: f8ca25a00ae1a5fed436851e88229b503c77bf31 */
+ * Stub hash: 71a9a5aa5947f254c62889f0a7d1eb5eafc01502 */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_simplexml_load_file, 0, 1, SimpleXMLElement, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
@@ -154,3 +154,25 @@ static const zend_function_entry class_SimpleXMLElement_methods[] = {
static const zend_function_entry class_SimpleXMLIterator_methods[] = {
ZEND_FE_END
};
+
+zend_class_entry *register_class_SimpleXMLElement(zend_class_entry *class_entry_Stringable, zend_class_entry *class_entry_Countable, zend_class_entry *class_entry_RecursiveIterator)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "SimpleXMLElement", class_SimpleXMLElement_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ zend_class_implements(class_entry, 3, class_entry_Stringable, class_entry_Countable, class_entry_RecursiveIterator);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_SimpleXMLIterator(zend_class_entry *class_entry_SimpleXMLElement)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "SimpleXMLIterator", class_SimpleXMLIterator_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_SimpleXMLElement);
+
+ return class_entry;
+}
+
diff --git a/ext/spl/spl_iterators.stub.php b/ext/spl/spl_iterators.stub.php
index 437efec46b..6a60b2acaf 100644
--- a/ext/spl/spl_iterators.stub.php
+++ b/ext/spl/spl_iterators.stub.php
@@ -320,6 +320,9 @@ class InfiniteIterator extends IteratorIterator
class RegexIterator extends FilterIterator
{
+ /** @var string|null */
+ public $replacement;
+
public function __construct(Iterator $iterator, string $pattern, int $mode = self::MATCH, int $flags = 0, int $pregFlags = 0) {}
/** @return bool */
diff --git a/ext/spl/spl_iterators_arginfo.h b/ext/spl/spl_iterators_arginfo.h
index 999528883a..5039624996 100644
--- a/ext/spl/spl_iterators_arginfo.h
+++ b/ext/spl/spl_iterators_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: ae7df94646bf08874d7b9804833d0081c40e0348 */
+ * Stub hash: 7d796a9f3df263d34cfe55070a09c4300e7d6765 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_EmptyIterator_current, 0, 0, 0)
ZEND_END_ARG_INFO()
diff --git a/ext/standard/user_filters.stub.php b/ext/standard/user_filters.stub.php
index 4065750312..7beb014f62 100755
--- a/ext/standard/user_filters.stub.php
+++ b/ext/standard/user_filters.stub.php
@@ -4,6 +4,11 @@
class php_user_filter
{
+ /** @var string */
+ public $filtername = "";
+ /** @var string */
+ public $params = "";
+
/**
* @param resource $in
* @param resource $out
diff --git a/ext/standard/user_filters_arginfo.h b/ext/standard/user_filters_arginfo.h
index aabb25c9d1..a982adbf72 100644
--- a/ext/standard/user_filters_arginfo.h
+++ b/ext/standard/user_filters_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: b3876ce9055a9417d0d1db9f97235513740de956 */
+ * Stub hash: e3ab7a87eb78ef3a7f96ad18f5dff6c6d8032ca2 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_php_user_filter_filter, 0, 0, 4)
ZEND_ARG_INFO(0, in)
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index fba4c0a126..ed3e8a6eab 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -251,37 +251,9 @@ PHP_METHOD(PhpToken, __toString)
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(tokenizer)
{
- zend_class_entry ce;
- zend_string *name;
- zval default_val;
- ZVAL_UNDEF(&default_val);
-
tokenizer_register_constants(INIT_FUNC_ARGS_PASSTHRU);
tokenizer_token_get_all_register_constants(INIT_FUNC_ARGS_PASSTHRU);
-
- INIT_CLASS_ENTRY(ce, "PhpToken", class_PhpToken_methods);
- php_token_ce = zend_register_internal_class(&ce);
- zend_class_implements(php_token_ce, 1, zend_ce_stringable);
-
- name = zend_string_init("id", sizeof("id") - 1, 1);
- zend_declare_typed_property(php_token_ce, name, &default_val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
- zend_string_release(name);
-
- name = zend_string_init("text", sizeof("text") - 1, 1);
- zend_declare_typed_property(php_token_ce, name, &default_val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
- zend_string_release(name);
-
- name = zend_string_init("line", sizeof("line") - 1, 1);
- zend_declare_typed_property(php_token_ce, name, &default_val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
- zend_string_release(name);
-
- name = zend_string_init("pos", sizeof("pos") - 1, 1);
- zend_declare_typed_property(php_token_ce, name, &default_val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
- zend_string_release(name);
+ php_token_ce = register_class_PhpToken(zend_ce_stringable);
return SUCCESS;
}
diff --git a/ext/tokenizer/tokenizer.stub.php b/ext/tokenizer/tokenizer.stub.php
index c329ef4932..8aa873e10f 100644
--- a/ext/tokenizer/tokenizer.stub.php
+++ b/ext/tokenizer/tokenizer.stub.php
@@ -1,6 +1,9 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
function token_get_all(string $code, int $flags = 0): array {}
@@ -8,6 +11,11 @@ function token_name(int $id): string {}
class PhpToken implements Stringable
{
+ public int $id;
+ public string $text;
+ public int $line;
+ public int $pos;
+
/** @return static[] */
public static function tokenize(string $code, int $flags = 0): array {}
diff --git a/ext/tokenizer/tokenizer_arginfo.h b/ext/tokenizer/tokenizer_arginfo.h
index 01d37d406e..f4cb0bbe4b 100644
--- a/ext/tokenizer/tokenizer_arginfo.h
+++ b/ext/tokenizer/tokenizer_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: a06da9ea0191ed78ee7af8f0d9eaccb17dfa4b20 */
+ * Stub hash: c84a06c889c19e2a81edbf43e4be53f3491d03be */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_token_get_all, 0, 1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0)
@@ -59,3 +59,39 @@ static const zend_function_entry class_PhpToken_methods[] = {
ZEND_ME(PhpToken, __toString, arginfo_class_PhpToken___toString, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
+
+zend_class_entry *register_class_PhpToken(zend_class_entry *class_entry_Stringable)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "PhpToken", class_PhpToken_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ zend_class_implements(class_entry, 1, class_entry_Stringable);
+
+ zval property_id_default_value;
+ ZVAL_UNDEF(&property_id_default_value);
+ zend_string *property_id_name = zend_string_init("id", sizeof("id") - 1, 1);
+ zend_declare_typed_property(class_entry, property_id_name, &property_id_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_id_name);
+
+ zval property_text_default_value;
+ ZVAL_UNDEF(&property_text_default_value);
+ zend_string *property_text_name = zend_string_init("text", sizeof("text") - 1, 1);
+ zend_declare_typed_property(class_entry, property_text_name, &property_text_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING));
+ zend_string_release(property_text_name);
+
+ zval property_line_default_value;
+ ZVAL_UNDEF(&property_line_default_value);
+ zend_string *property_line_name = zend_string_init("line", sizeof("line") - 1, 1);
+ zend_declare_typed_property(class_entry, property_line_name, &property_line_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_line_name);
+
+ zval property_pos_default_value;
+ ZVAL_UNDEF(&property_pos_default_value);
+ zend_string *property_pos_name = zend_string_init("pos", sizeof("pos") - 1, 1);
+ zend_declare_typed_property(class_entry, property_pos_name, &property_pos_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_pos_name);
+
+ return class_entry;
+}
+
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index ced0ac7d5d..3b692a8651 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -253,11 +253,8 @@ static void php_xml_free_wrapper(void *ptr)
PHP_MINIT_FUNCTION(xml)
{
- zend_class_entry ce;
- INIT_CLASS_ENTRY(ce, "XMLParser", class_XMLParser_methods);
- xml_parser_ce = zend_register_internal_class(&ce);
+ xml_parser_ce = register_class_XMLParser();
xml_parser_ce->create_object = xml_parser_create_object;
- xml_parser_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NO_DYNAMIC_PROPERTIES;
xml_parser_ce->serialize = zend_class_serialize_deny;
xml_parser_ce->unserialize = zend_class_unserialize_deny;
diff --git a/ext/xml/xml.stub.php b/ext/xml/xml.stub.php
index 6dc10d58b5..8167c68e86 100644
--- a/ext/xml/xml.stub.php
+++ b/ext/xml/xml.stub.php
@@ -1,6 +1,9 @@
<?php
-/** @generate-function-entries */
+/**
+ * @generate-function-entries
+ * @generate-class-entries
+ */
function xml_parser_create(?string $encoding = null): XMLParser {}
@@ -63,6 +66,7 @@ function xml_parser_set_option(XMLParser $parser, int $option, $value): bool {}
function xml_parser_get_option(XMLParser $parser, int $option): string|int {}
+/** @strict-properties */
final class XMLParser
{
}
diff --git a/ext/xml/xml_arginfo.h b/ext/xml/xml_arginfo.h
index 26187dad3d..0de97a4ba3 100644
--- a/ext/xml/xml_arginfo.h
+++ b/ext/xml/xml_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: d42215062c41775bae538cd310bc60e63fa06a8e */
+ * Stub hash: fffff15f512d0c99f201d1dd2257fb7bc91cebe2 */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_xml_parser_create, 0, 0, XMLParser, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
@@ -137,3 +137,15 @@ static const zend_function_entry ext_functions[] = {
static const zend_function_entry class_XMLParser_methods[] = {
ZEND_FE_END
};
+
+zend_class_entry *register_class_XMLParser()
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "XMLParser", class_XMLParser_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
+
+ return class_entry;
+}
+
diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c
index d0a63b77e0..64cc65b219 100644
--- a/ext/zend_test/test.c
+++ b/ext/zend_test/test.c
@@ -346,40 +346,13 @@ static void custom_zend_execute_ex(zend_execute_data *execute_data)
PHP_MINIT_FUNCTION(zend_test)
{
- zend_class_entry class_entry;
-
- INIT_CLASS_ENTRY(class_entry, "_ZendTestInterface", NULL);
- zend_test_interface = zend_register_internal_interface(&class_entry);
+ zend_test_interface = register_class__ZendTestInterface();
zend_declare_class_constant_long(zend_test_interface, ZEND_STRL("DUMMY"), 0);
- INIT_CLASS_ENTRY(class_entry, "_ZendTestClass", class__ZendTestClass_methods);
- zend_test_class = zend_register_internal_class(&class_entry);
- zend_class_implements(zend_test_class, 1, zend_test_interface);
+
+ zend_test_class = register_class__ZendTestClass(zend_test_interface);
zend_test_class->create_object = zend_test_class_new;
zend_test_class->get_static_method = zend_test_class_static_method_get;
- zend_declare_property_null(zend_test_class, "_StaticProp", sizeof("_StaticProp") - 1, ZEND_ACC_STATIC);
-
- {
- zend_string *name = zend_string_init("intProp", sizeof("intProp") - 1, 1);
- zval val;
- ZVAL_LONG(&val, 123);
- zend_declare_typed_property(
- zend_test_class, name, &val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_CODE(IS_LONG, 0, 0));
- zend_string_release(name);
- }
-
- {
- zend_string *name = zend_string_init("classProp", sizeof("classProp") - 1, 1);
- zend_string *class_name = zend_string_init("stdClass", sizeof("stdClass") - 1, 1);
- zval val;
- ZVAL_NULL(&val);
- zend_declare_typed_property(
- zend_test_class, name, &val, ZEND_ACC_PUBLIC, NULL,
- (zend_type) ZEND_TYPE_INIT_CLASS(class_name, 1, 0));
- zend_string_release(name);
- }
-
{
zend_string *name = zend_string_init("classUnionProp", sizeof("classUnionProp") - 1, 1);
zend_string *class_name1 = zend_string_init("stdClass", sizeof("stdClass") - 1, 1);
@@ -395,35 +368,16 @@ PHP_MINIT_FUNCTION(zend_test)
zend_string_release(name);
}
- {
- zend_string *name = zend_string_init("staticIntProp", sizeof("staticIntProp") - 1, 1);
- zval val;
- ZVAL_LONG(&val, 123);
- zend_declare_typed_property(
- zend_test_class, name, &val, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC, NULL,
- (zend_type) ZEND_TYPE_INIT_CODE(IS_LONG, 0, 0));
- zend_string_release(name);
- }
-
- INIT_CLASS_ENTRY(class_entry, "_ZendTestChildClass", NULL);
- zend_test_child_class = zend_register_internal_class_ex(&class_entry, zend_test_class);
+ zend_test_child_class = register_class__ZendTestChildClass(zend_test_class);
memcpy(&zend_test_class_handlers, &std_object_handlers, sizeof(zend_object_handlers));
zend_test_class_handlers.get_method = zend_test_class_method_get;
- INIT_CLASS_ENTRY(class_entry, "_ZendTestTrait", class__ZendTestTrait_methods);
- zend_test_trait = zend_register_internal_class(&class_entry);
- zend_test_trait->ce_flags |= ZEND_ACC_TRAIT;
- zend_declare_property_null(zend_test_trait, "testProp", sizeof("testProp")-1, ZEND_ACC_PUBLIC);
-
- zend_register_class_alias("_ZendTestClassAlias", zend_test_class);
+ zend_test_trait = register_class__ZendTestTrait();
REGISTER_LONG_CONSTANT("ZEND_TEST_DEPRECATED", 42, CONST_PERSISTENT | CONST_DEPRECATED);
- INIT_CLASS_ENTRY(class_entry, "ZendTestAttribute", NULL);
- zend_test_attribute = zend_register_internal_class(&class_entry);
- zend_test_attribute->ce_flags |= ZEND_ACC_FINAL;
-
+ zend_test_attribute = register_class_ZendTestAttribute();
{
zend_internal_attribute *attr = zend_internal_attribute_register(zend_test_attribute, ZEND_ATTRIBUTE_TARGET_ALL);
attr->validator = zend_attribute_validate_zendtestattribute;
diff --git a/ext/zend_test/test.stub.php b/ext/zend_test/test.stub.php
index 91ff78e113..e72094028d 100644
--- a/ext/zend_test/test.stub.php
+++ b/ext/zend_test/test.stub.php
@@ -1,10 +1,26 @@
<?php
-/** @generate-function-entries static */
+/**
+ * @generate-function-entries static
+ * @generate-class-entries
+ */
namespace {
-class _ZendTestClass {
+interface _ZendTestInterface
+{
+}
+
+/** @alias _ZendTestClassAlias */
+class _ZendTestClass implements _ZendTestInterface {
+ /** @var mixed */
+ public static $_StaticProp;
+ public static int $staticIntProp = 123;
+
+ public int $intProp = 123;
+ public ?stdClass $classProp = null;
+ //public stdClass|Iterator|null $classUnionProp = null;
+
public static function is_object(): int {}
/** @deprecated */
@@ -13,10 +29,21 @@ class _ZendTestClass {
public function returnsStatic(): static {}
}
+class _ZendTestChildClass extends _ZendTestClass
+{
+}
+
trait _ZendTestTrait {
+ /** @var mixed */
+ public $testProp;
+
public function testMethod(): bool {}
}
+final class ZendTestAttribute {
+
+}
+
function zend_test_array_return(): array {}
function zend_test_nullable_array_return(): ?array {}
diff --git a/ext/zend_test/test_arginfo.h b/ext/zend_test/test_arginfo.h
index c1fd6fd202..8b0754dd24 100644
--- a/ext/zend_test/test_arginfo.h
+++ b/ext/zend_test/test_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 759463b1adece643974a9c51455789aef11ba935 */
+ * Stub hash: 950679cde15789a9060d4798dc35dc5a590fd8b2 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_test_array_return, 0, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
@@ -107,6 +107,11 @@ static const zend_function_entry ext_functions[] = {
};
+static const zend_function_entry class__ZendTestInterface_methods[] = {
+ ZEND_FE_END
+};
+
+
static const zend_function_entry class__ZendTestClass_methods[] = {
ZEND_ME(_ZendTestClass, is_object, arginfo_class__ZendTestClass_is_object, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_ME(_ZendTestClass, __toString, arginfo_class__ZendTestClass___toString, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
@@ -115,12 +120,22 @@ static const zend_function_entry class__ZendTestClass_methods[] = {
};
+static const zend_function_entry class__ZendTestChildClass_methods[] = {
+ ZEND_FE_END
+};
+
+
static const zend_function_entry class__ZendTestTrait_methods[] = {
ZEND_ME(_ZendTestTrait, testMethod, arginfo_class__ZendTestTrait_testMethod, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
+static const zend_function_entry class_ZendTestAttribute_methods[] = {
+ ZEND_FE_END
+};
+
+
static const zend_function_entry class_ZendTestNS_Foo_methods[] = {
ZEND_ME(ZendTestNS_Foo, method, arginfo_class_ZendTestNS_Foo_method, ZEND_ACC_PUBLIC)
ZEND_FE_END
@@ -131,3 +146,109 @@ static const zend_function_entry class_ZendTestNS2_Foo_methods[] = {
ZEND_ME(ZendTestNS2_Foo, method, arginfo_class_ZendTestNS2_Foo_method, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
+
+zend_class_entry *register_class__ZendTestInterface()
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "_ZendTestInterface", class__ZendTestInterface_methods);
+ class_entry = zend_register_internal_interface(&ce);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class__ZendTestClass(zend_class_entry *class_entry__ZendTestInterface)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "_ZendTestClass", class__ZendTestClass_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ zend_class_implements(class_entry, 1, class_entry__ZendTestInterface);
+ zend_register_class_alias("_ZendTestClassAlias", class_entry);
+
+ zval property__StaticProp_default_value;
+ ZVAL_NULL(&property__StaticProp_default_value);
+ zend_string *property__StaticProp_name = zend_string_init("_StaticProp", sizeof("_StaticProp") - 1, 1);
+ zend_declare_property_ex(class_entry, property__StaticProp_name, &property__StaticProp_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC, NULL);
+ zend_string_release(property__StaticProp_name);
+
+ zval property_staticIntProp_default_value;
+ ZVAL_LONG(&property_staticIntProp_default_value, 123);
+ zend_string *property_staticIntProp_name = zend_string_init("staticIntProp", sizeof("staticIntProp") - 1, 1);
+ zend_declare_typed_property(class_entry, property_staticIntProp_name, &property_staticIntProp_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_staticIntProp_name);
+
+ zval property_intProp_default_value;
+ ZVAL_LONG(&property_intProp_default_value, 123);
+ zend_string *property_intProp_name = zend_string_init("intProp", sizeof("intProp") - 1, 1);
+ zend_declare_typed_property(class_entry, property_intProp_name, &property_intProp_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release(property_intProp_name);
+
+ zend_string *property_classProp_class_stdClass = zend_string_init("stdClass", sizeof("stdClass")-1, 1);
+ zval property_classProp_default_value;
+ ZVAL_NULL(&property_classProp_default_value);
+ zend_string *property_classProp_name = zend_string_init("classProp", sizeof("classProp") - 1, 1);
+ zend_declare_typed_property(class_entry, property_classProp_name, &property_classProp_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_classProp_class_stdClass, 1, 0));
+ zend_string_release(property_classProp_name);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class__ZendTestChildClass(zend_class_entry *class_entry__ZendTestClass)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "_ZendTestChildClass", class__ZendTestChildClass_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry__ZendTestClass);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class__ZendTestTrait()
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "_ZendTestTrait", class__ZendTestTrait_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ class_entry->ce_flags |= ZEND_ACC_TRAIT;
+
+ zval property_testProp_default_value;
+ ZVAL_NULL(&property_testProp_default_value);
+ zend_string *property_testProp_name = zend_string_init("testProp", sizeof("testProp") - 1, 1);
+ zend_declare_property_ex(class_entry, property_testProp_name, &property_testProp_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_testProp_name);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_ZendTestAttribute()
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "ZendTestAttribute", class_ZendTestAttribute_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ class_entry->ce_flags |= ZEND_ACC_FINAL;
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_ZendTestNS_Foo()
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_NS_CLASS_ENTRY(ce, "ZendTestNS", "Foo", class_ZendTestNS_Foo_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ return class_entry;
+}
+
+zend_class_entry *register_class_ZendTestNS2_Foo()
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_NS_CLASS_ENTRY(ce, "ZendTestNS2", "Foo", class_ZendTestNS2_Foo_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ return class_entry;
+}
+
diff --git a/ext/zip/php_zip.stub.php b/ext/zip/php_zip.stub.php
index 5ae4731ae2..ff7b9d99fb 100644
--- a/ext/zip/php_zip.stub.php
+++ b/ext/zip/php_zip.stub.php
@@ -66,6 +66,9 @@ function zip_entry_compressionmethod($zip_entry): string|false {}
class ZipArchive
{
+ /** @var string|null */
+ public $name;
+
/** @return bool|int */
public function open(string $filename, int $flags = 0) {}
diff --git a/ext/zip/php_zip_arginfo.h b/ext/zip/php_zip_arginfo.h
index ba72e52aa8..104fac05a0 100644
--- a/ext/zip/php_zip_arginfo.h
+++ b/ext/zip/php_zip_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 095084d2a2df557398191af5dd6c8bea6bb7c338 */
+ * Stub hash: a5b8a10dbaeddf5d0d1ac751ff64a5d7ff235562 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)