summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2021-02-09 23:21:26 +0100
committerMáté Kocsis <kocsismate@woohoolabs.com>2021-02-16 14:46:19 +0100
commitcad66533f0cb936154caca6e6857a3490887cc11 (patch)
treec3767207793b4b271ebf724f60b38e4c1607720a
parent8b4ae72efbbc46d374b28dfe34f12611556c3efb (diff)
downloadphp-git-cad66533f0cb936154caca6e6857a3490887cc11.tar.gz
Generate class entries from stubs for ldap, libxml, mbstring and mysqli
Closes GH-6684
-rwxr-xr-xbuild/gen_stub.php5
-rw-r--r--ext/ldap/ldap.stub.php2
-rw-r--r--ext/ldap/ldap_arginfo.h2
-rw-r--r--ext/libxml/libxml.stub.php1
-rw-r--r--ext/libxml/libxml_arginfo.h2
-rw-r--r--ext/mbstring/mbstring.stub.php2
-rw-r--r--ext/mbstring/mbstring_arginfo.h2
-rw-r--r--ext/mysqli/mysqli.c88
-rw-r--r--ext/mysqli/mysqli.stub.php126
-rw-r--r--ext/mysqli/mysqli_arginfo.h319
-rw-r--r--ext/mysqli/php_mysqli_structs.h7
11 files changed, 471 insertions, 85 deletions
diff --git a/build/gen_stub.php b/build/gen_stub.php
index 71fe1f4f18..ee4033ab10 100755
--- a/build/gen_stub.php
+++ b/build/gen_stub.php
@@ -1114,10 +1114,11 @@ class PropertyInfo
break;
case "string":
- if (empty($value)) {
+ if ($value === "") {
$code .= "\tZVAL_EMPTY_STRING(&$zvalName);\n";
} else {
- $code .= "\tZVAL_STRING(&$zvalName, \"$value\");\n";
+ $code .= "\tzend_string *{$zvalName}_str = zend_string_init(\"$value\", sizeof(\"$value\") - 1, 1);\n";
+ $code .= "\tZVAL_STR(&$zvalName, {$zvalName}_str);\n";
}
break;
diff --git a/ext/ldap/ldap.stub.php b/ext/ldap/ldap.stub.php
index d859c69af3..65634372fd 100644
--- a/ext/ldap/ldap.stub.php
+++ b/ext/ldap/ldap.stub.php
@@ -1,6 +1,6 @@
<?php
-/** @generate-function-entries */
+/** @generate-class-entries */
#ifdef HAVE_ORALDAP
/** @return resource|false */
diff --git a/ext/ldap/ldap_arginfo.h b/ext/ldap/ldap_arginfo.h
index 15e41afe72..643d94a82d 100644
--- a/ext/ldap/ldap_arginfo.h
+++ b/ext/ldap/ldap_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 9d6315aeee2e3a1be51c05b65a960ed433bbe4ec */
+ * Stub hash: 056fa51afdd7d40f9866ebd67837f5ddfa2c6236 */
#if defined(HAVE_ORALDAP)
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0)
diff --git a/ext/libxml/libxml.stub.php b/ext/libxml/libxml.stub.php
index 5159a7d946..dc55815e6c 100644
--- a/ext/libxml/libxml.stub.php
+++ b/ext/libxml/libxml.stub.php
@@ -1,6 +1,7 @@
<?php
/** @generate-class-entries */
+
class LibXMLError
{
public int $level;
diff --git a/ext/libxml/libxml_arginfo.h b/ext/libxml/libxml_arginfo.h
index e18e2c67b7..ff179c3028 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: f07180b33955d802c40f3f52f6199605508df87b */
+ * Stub hash: 252fdc1cd83d2d3322cc040baf2bf3c7fde29254 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_set_streams_context, 0, 1, IS_VOID, 0)
ZEND_ARG_INFO(0, context)
diff --git a/ext/mbstring/mbstring.stub.php b/ext/mbstring/mbstring.stub.php
index 46a4c59bd5..e355b5ba1e 100644
--- a/ext/mbstring/mbstring.stub.php
+++ b/ext/mbstring/mbstring.stub.php
@@ -1,6 +1,6 @@
<?php
-/** @generate-function-entries */
+/** @generate-class-entries */
function mb_language(?string $language = null): string|bool {}
diff --git a/ext/mbstring/mbstring_arginfo.h b/ext/mbstring/mbstring_arginfo.h
index 46cc3adf77..459bfe1317 100644
--- a/ext/mbstring/mbstring_arginfo.h
+++ b/ext/mbstring/mbstring_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 51f0769423c046d612adf81091192165ad265456 */
+ * Stub hash: eef196b29323ceb0a5d67703e62b11d0004c615b */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_language, 0, 0, MAY_BE_STRING|MAY_BE_BOOL)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, language, IS_STRING, 1, "null")
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index a007bc0e33..d4143e5564 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -530,8 +530,6 @@ static PHP_GINIT_FUNCTION(mysqli)
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(mysqli)
{
- zend_class_entry *ce,cex;
-
REGISTER_INI_ENTRIES();
#ifndef MYSQLI_USE_MYSQLND
if (mysql_server_init(0, NULL, NULL)) {
@@ -564,86 +562,38 @@ PHP_MINIT_FUNCTION(mysqli)
le_pmysqli = zend_register_list_destructors_ex(NULL, php_mysqli_dtor,
"MySqli persistent connection", module_number);
- INIT_CLASS_ENTRY(cex, "mysqli_sql_exception", class_mysqli_sql_exception_methods);
- mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException);
- mysqli_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
- zend_declare_property_long(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED);
- zend_declare_property_string(mysqli_exception_class_entry, "sqlstate", sizeof("sqlstate")-1, "00000", ZEND_ACC_PROTECTED);
+ mysqli_exception_class_entry = register_class_mysqli_sql_exception(spl_ce_RuntimeException);
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli_driver", mysqli_driver_class_entry, class_mysqli_driver_methods);
- ce = mysqli_driver_class_entry;
+ mysqli_driver_class_entry = register_class_mysqli_driver();
+ mysqli_driver_class_entry->create_object = mysqli_objects_new;
zend_hash_init(&mysqli_driver_properties, 0, NULL, free_prop_handler, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_driver_properties, mysqli_driver_property_entries);
- zend_declare_property_null(ce, "client_info", sizeof("client_info") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "client_version", sizeof("client_version") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "driver_version", sizeof("driver_version") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "reconnect", sizeof("reconnect") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "report_mode", sizeof("report_mode") - 1, ZEND_ACC_PUBLIC);
- ce->ce_flags |= ZEND_ACC_FINAL;
- zend_hash_add_ptr(&classes, ce->name, &mysqli_driver_properties);
-
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, class_mysqli_methods);
- ce = mysqli_link_class_entry;
+ zend_hash_add_ptr(&classes, mysqli_driver_class_entry->name, &mysqli_driver_properties);
+
+ mysqli_link_class_entry = register_class_mysqli();
+ mysqli_link_class_entry->create_object = mysqli_objects_new;
zend_hash_init(&mysqli_link_properties, 0, NULL, free_prop_handler, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_link_properties, mysqli_link_property_entries);
- zend_declare_property_null(ce, "affected_rows", sizeof("affected_rows") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "client_info", sizeof("client_info") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "client_version", sizeof("client_version") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "connect_errno", sizeof("connect_errno") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "connect_error", sizeof("connect_error") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "errno", sizeof("errno") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "error", sizeof("error") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "error_list", sizeof("error_list") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "field_count", sizeof("field_count") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "host_info", sizeof("host_info") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "info", sizeof("info") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "insert_id", sizeof("insert_id") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "server_info", sizeof("server_info") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "server_version", sizeof("server_version") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "sqlstate", sizeof("sqlstate") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "protocol_version", sizeof("protocol_version") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "thread_id", sizeof("thread_id") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "warning_count", sizeof("warning_count") - 1, ZEND_ACC_PUBLIC);
- zend_hash_add_ptr(&classes, ce->name, &mysqli_link_properties);
-
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli_warning", mysqli_warning_class_entry, class_mysqli_warning_methods);
- ce = mysqli_warning_class_entry;
- ce->ce_flags |= ZEND_ACC_FINAL;
+ zend_hash_add_ptr(&classes, mysqli_link_class_entry->name, &mysqli_link_properties);
+
+ mysqli_warning_class_entry = register_class_mysqli_warning();
+ mysqli_warning_class_entry->create_object = mysqli_objects_new;
zend_hash_init(&mysqli_warning_properties, 0, NULL, free_prop_handler, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_warning_properties, mysqli_warning_property_entries);
- zend_declare_property_null(ce, "message", sizeof("message") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "sqlstate", sizeof("sqlstate") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "errno", sizeof("errno") - 1, ZEND_ACC_PUBLIC);
- zend_hash_add_ptr(&classes, ce->name, &mysqli_warning_properties);
+ zend_hash_add_ptr(&classes, mysqli_warning_class_entry->name, &mysqli_warning_properties);
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli_result", mysqli_result_class_entry, class_mysqli_result_methods);
- ce = mysqli_result_class_entry;
+ mysqli_result_class_entry = register_class_mysqli_result(zend_ce_aggregate);
+ mysqli_result_class_entry->create_object = mysqli_objects_new;
+ mysqli_result_class_entry->get_iterator = php_mysqli_result_get_iterator;
zend_hash_init(&mysqli_result_properties, 0, NULL, free_prop_handler, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_result_properties, mysqli_result_property_entries);
- zend_declare_property_null(ce, "current_field", sizeof("current_field") - 1,ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "field_count", sizeof("field_count") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "lengths", sizeof("lengths") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "num_rows", sizeof("num_rows") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "type", sizeof("type") - 1, ZEND_ACC_PUBLIC);
- mysqli_result_class_entry->get_iterator = php_mysqli_result_get_iterator;
- zend_class_implements(mysqli_result_class_entry, 1, zend_ce_aggregate);
- zend_hash_add_ptr(&classes, ce->name, &mysqli_result_properties);
+ zend_hash_add_ptr(&classes, mysqli_result_class_entry->name, &mysqli_result_properties);
- REGISTER_MYSQLI_CLASS_ENTRY("mysqli_stmt", mysqli_stmt_class_entry, class_mysqli_stmt_methods);
- ce = mysqli_stmt_class_entry;
+ mysqli_stmt_class_entry = register_class_mysqli_stmt();
+ mysqli_stmt_class_entry->create_object = mysqli_objects_new;
zend_hash_init(&mysqli_stmt_properties, 0, NULL, free_prop_handler, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_stmt_properties, mysqli_stmt_property_entries);
- zend_declare_property_null(ce, "affected_rows", sizeof("affected_rows") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "insert_id", sizeof("insert_id") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "num_rows", sizeof("num_rows") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "param_count", sizeof("param_count") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "field_count", sizeof("field_count") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "errno", sizeof("errno") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "error", sizeof("error") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "error_list", sizeof("error_list") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "sqlstate", sizeof("sqlstate") - 1, ZEND_ACC_PUBLIC);
- zend_declare_property_null(ce, "id", sizeof("id") - 1, ZEND_ACC_PUBLIC);
- zend_hash_add_ptr(&classes, ce->name, &mysqli_stmt_properties);
+ zend_hash_add_ptr(&classes, mysqli_stmt_class_entry->name, &mysqli_stmt_properties);
/* mysqli_options */
REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT);
diff --git a/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php
index 0fa4e194b7..7bb10b3aa3 100644
--- a/ext/mysqli/mysqli.stub.php
+++ b/ext/mysqli/mysqli.stub.php
@@ -1,13 +1,81 @@
<?php
-/** @generate-function-entries */
+/** @generate-class-entries */
final class mysqli_driver
{
+ /** @var string|null */
+ public $client_info;
+
+ /** @var int|null */
+ public $client_version;
+
+ /** @var int|null */
+ public $driver_version;
+
+ /** @var bool|null */
+ public $reconnect;
+
+ /** @var int|null */
+ public $report_mode;
}
class mysqli
{
+ /** @var int|string|null */
+ public $affected_rows;
+
+ /** @var string|null */
+ public $client_info;
+
+ /** @var string|null */
+ public $client_version;
+
+ /** @var int|null */
+ public $connect_errno;
+
+ /** @var string|null */
+ public $connect_error;
+
+ /** @var int|string|null */
+ public $errno;
+
+ /** @var string|null */
+ public $error;
+
+ /** @var array|null */
+ public $error_list;
+
+ /** @var int|null */
+ public $field_count;
+
+ /** @var string|null */
+ public $host_info;
+
+ /** @var string|null */
+ public $info;
+
+ /** @var int|string|null */
+ public $insert_id;
+
+ /** @var string|null */
+ public $server_info;
+
+ /** @var int|string|null */
+ public $server_version;
+
+ /** @var string|null */
+ public $sqlstate;
+
+ /** @var int|string|null */
+ public $protocol_version;
+
+ /** @var int|string|null */
+ public $thread_id;
+
+ /** @var int|string|null */
+ public $warning_count;
+
public function __construct(
?string $hostname = null,
?string $username = null,
@@ -302,6 +370,21 @@ class mysqli
class mysqli_result implements IteratorAggregate
{
+ /** @var int|string|null */
+ public $current_field;
+
+ /** @var int|string|null */
+ public $field_count;
+
+ /** @var array|null */
+ public $lengths;
+
+ /** @var int|string|null */
+ public $num_rows;
+
+ /** @var int|null */
+ public $type;
+
public function __construct(mysqli $mysql, int $result_mode = MYSQLI_STORE_RESULT) {}
/**
@@ -387,6 +470,36 @@ class mysqli_result implements IteratorAggregate
class mysqli_stmt
{
+ /** @var int|string|null */
+ public $affected_rows;
+
+ /** @var int|string|null */
+ public $insert_id;
+
+ /** @var int|string|null */
+ public $num_rows;
+
+ /** @var int|string|null */
+ public $param_count;
+
+ /** @var int|string|null */
+ public $field_count;
+
+ /** @var int|string|null */
+ public $errno;
+
+ /** @var string|null */
+ public $error;
+
+ /** @var array|null */
+ public $error_list;
+
+ /** @var string|null */
+ public $sqlstate;
+
+ /** @var int|null */
+ public $id;
+
public function __construct(mysqli $mysql, ?string $query = null) {}
/**
@@ -510,6 +623,15 @@ class mysqli_stmt
final class mysqli_warning
{
+ /** @var string|null */
+ public $message;
+
+ /** @var string|null */
+ public $sqlstate;
+
+ /** @var int|null */
+ public $errno;
+
private function __construct() {}
public function next(): bool {}
@@ -517,6 +639,8 @@ final class mysqli_warning
final class mysqli_sql_exception extends RuntimeException
{
+ /** @var string */
+ protected $sqlstate = "00000";
}
function mysqli_affected_rows(mysqli $mysql): int|string {}
diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h
index e3db6e98d2..5fe2cd74d9 100644
--- a/ext/mysqli/mysqli_arginfo.h
+++ b/ext/mysqli/mysqli_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: cd44441ccae3d04e4691e0b1b040cafd8db8b521 */
+ * Stub hash: efd018f81d09a704e3a9cea00dd562feb48ca0bb */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
@@ -1039,3 +1039,320 @@ static const zend_function_entry class_mysqli_warning_methods[] = {
static const zend_function_entry class_mysqli_sql_exception_methods[] = {
ZEND_FE_END
};
+
+static zend_class_entry *register_class_mysqli_driver(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli_driver", class_mysqli_driver_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ class_entry->ce_flags |= ZEND_ACC_FINAL;
+
+ zval property_client_info_default_value;
+ ZVAL_NULL(&property_client_info_default_value);
+ zend_string *property_client_info_name = zend_string_init("client_info", sizeof("client_info") - 1, 1);
+ zend_declare_property_ex(class_entry, property_client_info_name, &property_client_info_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_client_info_name);
+
+ zval property_client_version_default_value;
+ ZVAL_NULL(&property_client_version_default_value);
+ zend_string *property_client_version_name = zend_string_init("client_version", sizeof("client_version") - 1, 1);
+ zend_declare_property_ex(class_entry, property_client_version_name, &property_client_version_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_client_version_name);
+
+ zval property_driver_version_default_value;
+ ZVAL_NULL(&property_driver_version_default_value);
+ zend_string *property_driver_version_name = zend_string_init("driver_version", sizeof("driver_version") - 1, 1);
+ zend_declare_property_ex(class_entry, property_driver_version_name, &property_driver_version_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_driver_version_name);
+
+ zval property_reconnect_default_value;
+ ZVAL_NULL(&property_reconnect_default_value);
+ zend_string *property_reconnect_name = zend_string_init("reconnect", sizeof("reconnect") - 1, 1);
+ zend_declare_property_ex(class_entry, property_reconnect_name, &property_reconnect_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_reconnect_name);
+
+ zval property_report_mode_default_value;
+ ZVAL_NULL(&property_report_mode_default_value);
+ zend_string *property_report_mode_name = zend_string_init("report_mode", sizeof("report_mode") - 1, 1);
+ zend_declare_property_ex(class_entry, property_report_mode_name, &property_report_mode_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_report_mode_name);
+
+ return class_entry;
+}
+
+static zend_class_entry *register_class_mysqli(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli", class_mysqli_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ zval property_affected_rows_default_value;
+ ZVAL_NULL(&property_affected_rows_default_value);
+ zend_string *property_affected_rows_name = zend_string_init("affected_rows", sizeof("affected_rows") - 1, 1);
+ zend_declare_property_ex(class_entry, property_affected_rows_name, &property_affected_rows_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_affected_rows_name);
+
+ zval property_client_info_default_value;
+ ZVAL_NULL(&property_client_info_default_value);
+ zend_string *property_client_info_name = zend_string_init("client_info", sizeof("client_info") - 1, 1);
+ zend_declare_property_ex(class_entry, property_client_info_name, &property_client_info_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_client_info_name);
+
+ zval property_client_version_default_value;
+ ZVAL_NULL(&property_client_version_default_value);
+ zend_string *property_client_version_name = zend_string_init("client_version", sizeof("client_version") - 1, 1);
+ zend_declare_property_ex(class_entry, property_client_version_name, &property_client_version_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_client_version_name);
+
+ zval property_connect_errno_default_value;
+ ZVAL_NULL(&property_connect_errno_default_value);
+ zend_string *property_connect_errno_name = zend_string_init("connect_errno", sizeof("connect_errno") - 1, 1);
+ zend_declare_property_ex(class_entry, property_connect_errno_name, &property_connect_errno_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_connect_errno_name);
+
+ zval property_connect_error_default_value;
+ ZVAL_NULL(&property_connect_error_default_value);
+ zend_string *property_connect_error_name = zend_string_init("connect_error", sizeof("connect_error") - 1, 1);
+ zend_declare_property_ex(class_entry, property_connect_error_name, &property_connect_error_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_connect_error_name);
+
+ zval property_errno_default_value;
+ ZVAL_NULL(&property_errno_default_value);
+ zend_string *property_errno_name = zend_string_init("errno", sizeof("errno") - 1, 1);
+ zend_declare_property_ex(class_entry, property_errno_name, &property_errno_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_errno_name);
+
+ zval property_error_default_value;
+ ZVAL_NULL(&property_error_default_value);
+ zend_string *property_error_name = zend_string_init("error", sizeof("error") - 1, 1);
+ zend_declare_property_ex(class_entry, property_error_name, &property_error_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_error_name);
+
+ zval property_error_list_default_value;
+ ZVAL_NULL(&property_error_list_default_value);
+ zend_string *property_error_list_name = zend_string_init("error_list", sizeof("error_list") - 1, 1);
+ zend_declare_property_ex(class_entry, property_error_list_name, &property_error_list_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_error_list_name);
+
+ zval property_field_count_default_value;
+ ZVAL_NULL(&property_field_count_default_value);
+ zend_string *property_field_count_name = zend_string_init("field_count", sizeof("field_count") - 1, 1);
+ zend_declare_property_ex(class_entry, property_field_count_name, &property_field_count_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_field_count_name);
+
+ zval property_host_info_default_value;
+ ZVAL_NULL(&property_host_info_default_value);
+ zend_string *property_host_info_name = zend_string_init("host_info", sizeof("host_info") - 1, 1);
+ zend_declare_property_ex(class_entry, property_host_info_name, &property_host_info_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_host_info_name);
+
+ zval property_info_default_value;
+ ZVAL_NULL(&property_info_default_value);
+ zend_string *property_info_name = zend_string_init("info", sizeof("info") - 1, 1);
+ zend_declare_property_ex(class_entry, property_info_name, &property_info_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_info_name);
+
+ zval property_insert_id_default_value;
+ ZVAL_NULL(&property_insert_id_default_value);
+ zend_string *property_insert_id_name = zend_string_init("insert_id", sizeof("insert_id") - 1, 1);
+ zend_declare_property_ex(class_entry, property_insert_id_name, &property_insert_id_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_insert_id_name);
+
+ zval property_server_info_default_value;
+ ZVAL_NULL(&property_server_info_default_value);
+ zend_string *property_server_info_name = zend_string_init("server_info", sizeof("server_info") - 1, 1);
+ zend_declare_property_ex(class_entry, property_server_info_name, &property_server_info_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_server_info_name);
+
+ zval property_server_version_default_value;
+ ZVAL_NULL(&property_server_version_default_value);
+ zend_string *property_server_version_name = zend_string_init("server_version", sizeof("server_version") - 1, 1);
+ zend_declare_property_ex(class_entry, property_server_version_name, &property_server_version_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_server_version_name);
+
+ zval property_sqlstate_default_value;
+ ZVAL_NULL(&property_sqlstate_default_value);
+ zend_string *property_sqlstate_name = zend_string_init("sqlstate", sizeof("sqlstate") - 1, 1);
+ zend_declare_property_ex(class_entry, property_sqlstate_name, &property_sqlstate_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_sqlstate_name);
+
+ zval property_protocol_version_default_value;
+ ZVAL_NULL(&property_protocol_version_default_value);
+ zend_string *property_protocol_version_name = zend_string_init("protocol_version", sizeof("protocol_version") - 1, 1);
+ zend_declare_property_ex(class_entry, property_protocol_version_name, &property_protocol_version_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_protocol_version_name);
+
+ zval property_thread_id_default_value;
+ ZVAL_NULL(&property_thread_id_default_value);
+ zend_string *property_thread_id_name = zend_string_init("thread_id", sizeof("thread_id") - 1, 1);
+ zend_declare_property_ex(class_entry, property_thread_id_name, &property_thread_id_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_thread_id_name);
+
+ zval property_warning_count_default_value;
+ ZVAL_NULL(&property_warning_count_default_value);
+ zend_string *property_warning_count_name = zend_string_init("warning_count", sizeof("warning_count") - 1, 1);
+ zend_declare_property_ex(class_entry, property_warning_count_name, &property_warning_count_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_warning_count_name);
+
+ return class_entry;
+}
+
+static zend_class_entry *register_class_mysqli_result(zend_class_entry *class_entry_IteratorAggregate)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli_result", class_mysqli_result_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ zend_class_implements(class_entry, 1, class_entry_IteratorAggregate);
+
+ zval property_current_field_default_value;
+ ZVAL_NULL(&property_current_field_default_value);
+ zend_string *property_current_field_name = zend_string_init("current_field", sizeof("current_field") - 1, 1);
+ zend_declare_property_ex(class_entry, property_current_field_name, &property_current_field_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_current_field_name);
+
+ zval property_field_count_default_value;
+ ZVAL_NULL(&property_field_count_default_value);
+ zend_string *property_field_count_name = zend_string_init("field_count", sizeof("field_count") - 1, 1);
+ zend_declare_property_ex(class_entry, property_field_count_name, &property_field_count_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_field_count_name);
+
+ zval property_lengths_default_value;
+ ZVAL_NULL(&property_lengths_default_value);
+ zend_string *property_lengths_name = zend_string_init("lengths", sizeof("lengths") - 1, 1);
+ zend_declare_property_ex(class_entry, property_lengths_name, &property_lengths_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_lengths_name);
+
+ zval property_num_rows_default_value;
+ ZVAL_NULL(&property_num_rows_default_value);
+ zend_string *property_num_rows_name = zend_string_init("num_rows", sizeof("num_rows") - 1, 1);
+ zend_declare_property_ex(class_entry, property_num_rows_name, &property_num_rows_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_num_rows_name);
+
+ zval property_type_default_value;
+ ZVAL_NULL(&property_type_default_value);
+ zend_string *property_type_name = zend_string_init("type", sizeof("type") - 1, 1);
+ zend_declare_property_ex(class_entry, property_type_name, &property_type_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_type_name);
+
+ return class_entry;
+}
+
+static zend_class_entry *register_class_mysqli_stmt(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli_stmt", class_mysqli_stmt_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ zval property_affected_rows_default_value;
+ ZVAL_NULL(&property_affected_rows_default_value);
+ zend_string *property_affected_rows_name = zend_string_init("affected_rows", sizeof("affected_rows") - 1, 1);
+ zend_declare_property_ex(class_entry, property_affected_rows_name, &property_affected_rows_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_affected_rows_name);
+
+ zval property_insert_id_default_value;
+ ZVAL_NULL(&property_insert_id_default_value);
+ zend_string *property_insert_id_name = zend_string_init("insert_id", sizeof("insert_id") - 1, 1);
+ zend_declare_property_ex(class_entry, property_insert_id_name, &property_insert_id_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_insert_id_name);
+
+ zval property_num_rows_default_value;
+ ZVAL_NULL(&property_num_rows_default_value);
+ zend_string *property_num_rows_name = zend_string_init("num_rows", sizeof("num_rows") - 1, 1);
+ zend_declare_property_ex(class_entry, property_num_rows_name, &property_num_rows_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_num_rows_name);
+
+ zval property_param_count_default_value;
+ ZVAL_NULL(&property_param_count_default_value);
+ zend_string *property_param_count_name = zend_string_init("param_count", sizeof("param_count") - 1, 1);
+ zend_declare_property_ex(class_entry, property_param_count_name, &property_param_count_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_param_count_name);
+
+ zval property_field_count_default_value;
+ ZVAL_NULL(&property_field_count_default_value);
+ zend_string *property_field_count_name = zend_string_init("field_count", sizeof("field_count") - 1, 1);
+ zend_declare_property_ex(class_entry, property_field_count_name, &property_field_count_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_field_count_name);
+
+ zval property_errno_default_value;
+ ZVAL_NULL(&property_errno_default_value);
+ zend_string *property_errno_name = zend_string_init("errno", sizeof("errno") - 1, 1);
+ zend_declare_property_ex(class_entry, property_errno_name, &property_errno_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_errno_name);
+
+ zval property_error_default_value;
+ ZVAL_NULL(&property_error_default_value);
+ zend_string *property_error_name = zend_string_init("error", sizeof("error") - 1, 1);
+ zend_declare_property_ex(class_entry, property_error_name, &property_error_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_error_name);
+
+ zval property_error_list_default_value;
+ ZVAL_NULL(&property_error_list_default_value);
+ zend_string *property_error_list_name = zend_string_init("error_list", sizeof("error_list") - 1, 1);
+ zend_declare_property_ex(class_entry, property_error_list_name, &property_error_list_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_error_list_name);
+
+ zval property_sqlstate_default_value;
+ ZVAL_NULL(&property_sqlstate_default_value);
+ zend_string *property_sqlstate_name = zend_string_init("sqlstate", sizeof("sqlstate") - 1, 1);
+ zend_declare_property_ex(class_entry, property_sqlstate_name, &property_sqlstate_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_sqlstate_name);
+
+ 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;
+}
+
+static zend_class_entry *register_class_mysqli_warning(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli_warning", class_mysqli_warning_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+ class_entry->ce_flags |= ZEND_ACC_FINAL;
+
+ zval property_message_default_value;
+ ZVAL_NULL(&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_PUBLIC, NULL);
+ zend_string_release(property_message_name);
+
+ zval property_sqlstate_default_value;
+ ZVAL_NULL(&property_sqlstate_default_value);
+ zend_string *property_sqlstate_name = zend_string_init("sqlstate", sizeof("sqlstate") - 1, 1);
+ zend_declare_property_ex(class_entry, property_sqlstate_name, &property_sqlstate_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_sqlstate_name);
+
+ zval property_errno_default_value;
+ ZVAL_NULL(&property_errno_default_value);
+ zend_string *property_errno_name = zend_string_init("errno", sizeof("errno") - 1, 1);
+ zend_declare_property_ex(class_entry, property_errno_name, &property_errno_default_value, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(property_errno_name);
+
+ return class_entry;
+}
+
+static zend_class_entry *register_class_mysqli_sql_exception(zend_class_entry *class_entry_RuntimeException)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "mysqli_sql_exception", class_mysqli_sql_exception_methods);
+ class_entry = zend_register_internal_class_ex(&ce, class_entry_RuntimeException);
+ class_entry->ce_flags |= ZEND_ACC_FINAL;
+
+ zval property_sqlstate_default_value;
+ zend_string *property_sqlstate_default_value_str = zend_string_init("00000", sizeof("00000") - 1, 1);
+ ZVAL_STR(&property_sqlstate_default_value, property_sqlstate_default_value_str);
+ zend_string *property_sqlstate_name = zend_string_init("sqlstate", sizeof("sqlstate") - 1, 1);
+ zend_declare_property_ex(class_entry, property_sqlstate_name, &property_sqlstate_default_value, ZEND_ACC_PROTECTED, NULL);
+ zend_string_release(property_sqlstate_name);
+
+ return class_entry;
+}
diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h
index 6ab9615985..a39e68b276 100644
--- a/ext/mysqli/php_mysqli_structs.h
+++ b/ext/mysqli/php_mysqli_structs.h
@@ -186,13 +186,6 @@ extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * resul
mysql->multi_query = 1; \
}
-#define REGISTER_MYSQLI_CLASS_ENTRY(name, mysqli_entry, class_functions) { \
- zend_class_entry ce; \
- INIT_CLASS_ENTRY(ce, name,class_functions); \
- ce.create_object = mysqli_objects_new; \
- mysqli_entry = zend_register_internal_class(&ce); \
-} \
-
#define MYSQLI_REGISTER_RESOURCE_EX(__ptr, __zval) \
(Z_MYSQLI_P(__zval))->ptr = __ptr;