From fd6e5f1e8139d7f1e88fa370da6aeaa3b650a855 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Sun, 20 Mar 2022 15:13:42 +0000 Subject: [PATCH] Regenerate `ext/` directory --- ext/config.m4 | 1 + ext/config.w32 | 2 +- ext/php_stub.h | 2 +- ext/stub.c | 4 +- ext/stub.h | 1 + ext/stub/arrayaccessarr.zep.c | 156 ++++++++++++++++++++++++++++++++++ ext/stub/arrayaccessarr.zep.h | 49 +++++++++++ ext/stub/fannkuch.zep.c | 2 +- ext/stub/mcall.zep.c | 7 +- ext/stub/types/maybe.zep.c | 56 ++++++++++++ ext/stub/types/maybe.zep.h | 28 ++++++ 11 files changed, 299 insertions(+), 9 deletions(-) create mode 100644 ext/stub/arrayaccessarr.zep.c create mode 100644 ext/stub/arrayaccessarr.zep.h create mode 100644 ext/stub/types/maybe.zep.c create mode 100644 ext/stub/types/maybe.zep.h diff --git a/ext/config.m4 b/ext/config.m4 index 0239a4080..f654c649f 100644 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -213,6 +213,7 @@ if test "$PHP_STUB" = "yes"; then stub/typehinting/testabstract.zep.c stub/typeinstances.zep.c stub/typeoff.zep.c + stub/types/maybe.zep.c stub/types/mixedtype.zep.c stub/unknownclass.zep.c stub/unsettest.zep.c diff --git a/ext/config.w32 b/ext/config.w32 index 9eabe0792..cea2bd118 100644 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -38,7 +38,7 @@ if (PHP_STUB != "no") { ADD_SOURCES(configure_module_dirname + "/stub/requires", "external3.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/router", "exception.zep.c route.zep.c", "stub"); ADD_SOURCES(configure_module_dirname + "/stub/typehinting", "testabstract.zep.c", "stub"); - ADD_SOURCES(configure_module_dirname + "/stub/types", "mixedtype.zep.c", "stub"); + ADD_SOURCES(configure_module_dirname + "/stub/types", "maybe.zep.c mixedtype.zep.c", "stub"); ADD_FLAG("CFLAGS_STUB", "/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL"); ADD_FLAG("CFLAGS", "/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL"); ADD_FLAG("LDFLAGS", "/LTCG"); diff --git a/ext/php_stub.h b/ext/php_stub.h index f77c451e7..1b5391c9f 100644 --- a/ext/php_stub.h +++ b/ext/php_stub.h @@ -14,7 +14,7 @@ #define PHP_STUB_VERSION "1.0.0" #define PHP_STUB_EXTNAME "stub" #define PHP_STUB_AUTHOR "Phalcon Team and contributors" -#define PHP_STUB_ZEPVERSION "0.15.2-$Id$" +#define PHP_STUB_ZEPVERSION "0.16.0-$Id$" #define PHP_STUB_DESCRIPTION "Description test for
Test Extension." typedef struct _zephir_struct_db { diff --git a/ext/stub.c b/ext/stub.c index ba694c7e7..aa6294f0a 100644 --- a/ext/stub.c +++ b/ext/stub.c @@ -241,6 +241,7 @@ zend_class_entry *stub_trytest_ce; zend_class_entry *stub_typehinting_testabstract_ce; zend_class_entry *stub_typeinstances_ce; zend_class_entry *stub_typeoff_ce; +zend_class_entry *stub_types_maybe_ce; zend_class_entry *stub_types_mixedtype_ce; zend_class_entry *stub_unknownclass_ce; zend_class_entry *stub_unsettest_ce; @@ -470,6 +471,7 @@ static PHP_MINIT_FUNCTION(stub) ZEPHIR_INIT(Stub_TypeHinting_TestAbstract); ZEPHIR_INIT(Stub_TypeInstances); ZEPHIR_INIT(Stub_Typeoff); + ZEPHIR_INIT(Stub_Types_MayBe); ZEPHIR_INIT(Stub_Types_MixedType); ZEPHIR_INIT(Stub_UnknownClass); ZEPHIR_INIT(Stub_Unsettest); @@ -582,7 +584,7 @@ static PHP_MINFO_FUNCTION(stub) php_info_print_table_start(); php_info_print_table_header(2, "Test Extension support", "Value"); php_info_print_table_row(2, "Lifecycle hooks", "PHP provides several lifecycle events, which extensions can use to perform common initialization or shutdown tasks."); - php_info_print_table_row(2, "Static Analysis", "Test extensions' compiler provides static analysis of the compiled code."); + php_info_print_table_row(2, "Static Analysis", "Test extensions' compiler provides static analysis of the compiled code."); php_info_print_table_end(); php_info_print_table_start(); php_info_print_table_header(2, "Test variable", "Value"); diff --git a/ext/stub.h b/ext/stub.h index 2e49dd800..942bbaba8 100644 --- a/ext/stub.h +++ b/ext/stub.h @@ -208,6 +208,7 @@ #include "stub/typehinting/testabstract.zep.h" #include "stub/typeinstances.zep.h" #include "stub/typeoff.zep.h" +#include "stub/types/maybe.zep.h" #include "stub/types/mixedtype.zep.h" #include "stub/unknownclass.zep.h" #include "stub/unsettest.zep.h" diff --git a/ext/stub/arrayaccessarr.zep.c b/ext/stub/arrayaccessarr.zep.c new file mode 100644 index 000000000..e498d4e96 --- /dev/null +++ b/ext/stub/arrayaccessarr.zep.c @@ -0,0 +1,156 @@ + +#ifdef HAVE_CONFIG_H +#include "../ext_config.h" +#endif + +#include +#include "../php_ext.h" +#include "../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/memory.h" +#include "kernel/array.h" +#include "kernel/object.h" + + +ZEPHIR_INIT_CLASS(Stub_ArrayAccessArr) +{ + ZEPHIR_REGISTER_CLASS(Stub, ArrayAccessArr, stub, arrayaccessarr, stub_arrayaccessarr_method_entry, 0); + + zend_declare_property_null(stub_arrayaccessarr_ce, SL("test"), ZEND_ACC_PROTECTED); + zend_class_implements(stub_arrayaccessarr_ce, 1, zend_ce_arrayaccess); + return SUCCESS; +} + +PHP_METHOD(Stub_ArrayAccessArr, __construct) +{ + zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + + + ZEPHIR_MM_GROW(); + + ZEPHIR_INIT_VAR(&_0); + zephir_create_array(&_0, 3, 0); + add_assoc_long_ex(&_0, SL("one"), 1); + add_assoc_long_ex(&_0, SL("two"), 2); + add_assoc_long_ex(&_0, SL("three"), 3); + zephir_update_property_zval(this_ptr, ZEND_STRL("test"), &_0); + ZEPHIR_MM_RESTORE(); +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetSet) +{ + zval offset_sub, value_sub; + zval *offset, *value; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&offset_sub); + ZVAL_UNDEF(&value_sub); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(2, 2) + Z_PARAM_ZVAL(offset) + Z_PARAM_ZVAL(value) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(2, 0, &offset, &value); + + + if (Z_TYPE_P(offset) == IS_NULL) { + zephir_update_property_array_append(this_ptr, SL("test"), value); + } else { + zephir_update_property_array(this_ptr, SL("test"), offset, value); + } +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetExists) +{ + zval offset_sub, _0; + zval *offset; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&offset_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(offset) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &offset); + + + zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(zephir_array_isset(&_0, offset)); +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetUnset) +{ + zval offset_sub, _0; + zval *offset; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&offset_sub); + ZVAL_UNDEF(&_0); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(offset) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &offset); + + + zephir_unset_property_array(this_ptr, ZEND_STRL("test"), offset); + zephir_read_property(&_0, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_0, offset, PH_SEPARATE); +} + +PHP_METHOD(Stub_ArrayAccessArr, offsetGet) +{ + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval offset_sub, _0, _1, _2; + zval *offset; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&offset_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(offset) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &offset); + + + ZEPHIR_INIT_VAR(&_0); + zephir_read_property(&_1, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset(&_1, offset)) { + zephir_read_property(&_2, this_ptr, ZEND_STRL("test"), PH_NOISY_CC | PH_READONLY); + zephir_array_fetch(&_0, &_2, offset, PH_NOISY, "stub/arrayaccessarr.zep", 37); + } else { + ZVAL_NULL(&_0); + } + RETURN_CCTOR(&_0); +} + diff --git a/ext/stub/arrayaccessarr.zep.h b/ext/stub/arrayaccessarr.zep.h new file mode 100644 index 000000000..0a5755c1a --- /dev/null +++ b/ext/stub/arrayaccessarr.zep.h @@ -0,0 +1,49 @@ + +extern zend_class_entry *stub_arrayaccessarr_ce; + +ZEPHIR_INIT_CLASS(Stub_ArrayAccessArr); + +PHP_METHOD(Stub_ArrayAccessArr, __construct); +PHP_METHOD(Stub_ArrayAccessArr, offsetSet); +PHP_METHOD(Stub_ArrayAccessArr, offsetExists); +PHP_METHOD(Stub_ArrayAccessArr, offsetUnset); +PHP_METHOD(Stub_ArrayAccessArr, offsetGet); + +ZEND_BEGIN_ARG_INFO_EX(arginfo_stub_arrayaccessarr___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetset, 0, 2, IS_VOID, 0) + + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetexists, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetunset, 0, 1, IS_VOID, 0) + + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetget, 0, 1, IS_MIXED, 0) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_arrayaccessarr_offsetget, 0, 1, IS_NULL, 0) +#endif + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_arrayaccessarr_method_entry) { +#if PHP_VERSION_ID >= 80000 + PHP_ME(Stub_ArrayAccessArr, __construct, arginfo_stub_arrayaccessarr___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) +#else + PHP_ME(Stub_ArrayAccessArr, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) +#endif + PHP_ME(Stub_ArrayAccessArr, offsetSet, arginfo_stub_arrayaccessarr_offsetset, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessArr, offsetExists, arginfo_stub_arrayaccessarr_offsetexists, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessArr, offsetUnset, arginfo_stub_arrayaccessarr_offsetunset, ZEND_ACC_PUBLIC) + PHP_ME(Stub_ArrayAccessArr, offsetGet, arginfo_stub_arrayaccessarr_offsetget, ZEND_ACC_PUBLIC) + PHP_FE_END +}; diff --git a/ext/stub/fannkuch.zep.c b/ext/stub/fannkuch.zep.c index cff9afa05..91d53018b 100644 --- a/ext/stub/fannkuch.zep.c +++ b/ext/stub/fannkuch.zep.c @@ -23,7 +23,7 @@ * * Fannkuch Redux in Zephir * - * @see https://disciple-devel.blogspot.mx/2010/11/shootout-fannkuch-redux.html + * @see http://disciple-devel.blogspot.mx/2010/11/shootout-fannkuch-redux.html */ ZEPHIR_INIT_CLASS(Stub_Fannkuch) { diff --git a/ext/stub/mcall.zep.c b/ext/stub/mcall.zep.c index bc706450c..4c277c33e 100644 --- a/ext/stub/mcall.zep.c +++ b/ext/stub/mcall.zep.c @@ -1208,11 +1208,8 @@ PHP_METHOD(Stub_Mcall, issue1136) if (zephir_is_true(&_3)) { ZEPHIR_INIT_VAR(&_finfo); object_init_ex(&_finfo, zephir_get_internal_ce(SL("finfo"))); - if (zephir_has_constructor(&_finfo)) { - ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); - zephir_check_call_status(); - } - + ZEPHIR_CALL_METHOD(NULL, &_finfo, "__construct", NULL, 0); + zephir_check_call_status(); } else { ZEPHIR_CALL_FUNCTION(&_finfo, "finfo_open", NULL, 59); zephir_check_call_status(); diff --git a/ext/stub/types/maybe.zep.c b/ext/stub/types/maybe.zep.c new file mode 100644 index 000000000..559628295 --- /dev/null +++ b/ext/stub/types/maybe.zep.c @@ -0,0 +1,56 @@ + +#ifdef HAVE_CONFIG_H +#include "../../ext_config.h" +#endif + +#include +#include "../../php_ext.h" +#include "../../ext.h" + +#include +#include +#include + +#include "kernel/main.h" +#include "kernel/operators.h" +#include "kernel/memory.h" +#include "kernel/object.h" + + +ZEPHIR_INIT_CLASS(Stub_Types_MayBe) +{ + ZEPHIR_REGISTER_CLASS(Stub\\Types, MayBe, stub, types_maybe, stub_types_maybe_method_entry, 0); + + return SUCCESS; +} + +PHP_METHOD(Stub_Types_MayBe, gc) +{ + zval *maxlifetime_param = NULL; + zend_long maxlifetime; + zval *this_ptr = getThis(); + +#if PHP_VERSION_ID >= 80000 + bool is_null_true = 1; + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(maxlifetime) + ZEND_PARSE_PARAMETERS_END(); +#endif + + + zephir_fetch_params_without_memory_grow(1, 0, &maxlifetime_param); + maxlifetime = zephir_get_intval(maxlifetime_param); + + + RETURN_LONG(1); +} + +PHP_METHOD(Stub_Types_MayBe, gcFalse) +{ + zval *this_ptr = getThis(); + + + + RETURN_BOOL(0); +} + diff --git a/ext/stub/types/maybe.zep.h b/ext/stub/types/maybe.zep.h new file mode 100644 index 000000000..3730deddc --- /dev/null +++ b/ext/stub/types/maybe.zep.h @@ -0,0 +1,28 @@ + +extern zend_class_entry *stub_types_maybe_ce; + +ZEPHIR_INIT_CLASS(Stub_Types_MayBe); + +PHP_METHOD(Stub_Types_MayBe, gc); +PHP_METHOD(Stub_Types_MayBe, gcFalse); + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_maybe_gc, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_maybe_gc, 0, 1, IS_LONG, 0) +#endif + ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stub_types_maybe_gcfalse, 0, 0, MAY_BE_LONG|MAY_BE_FALSE) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stub_types_maybe_gcfalse, 0, 0, IS_LONG, 0) +#endif +ZEND_END_ARG_INFO() + +ZEPHIR_INIT_FUNCS(stub_types_maybe_method_entry) { + PHP_ME(Stub_Types_MayBe, gc, arginfo_stub_types_maybe_gc, ZEND_ACC_PUBLIC) + PHP_ME(Stub_Types_MayBe, gcFalse, arginfo_stub_types_maybe_gcfalse, ZEND_ACC_PUBLIC) + PHP_FE_END +};