From 755534b5544bbf0116657ddd9f21dd5129a85ebf Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 22 Aug 2022 11:01:42 +0100 Subject: [PATCH 1/7] #16023 - Bump `ZEPHIR_VERSION` to `0.16.1` --- .github/workflows/main.yml | 2 +- docker/7.4/.bashrc | 2 +- docker/8.0/.bashrc | 2 +- docker/8.1/.bashrc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6e5beb48e53..b1b8b3f8f4f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ env: # All versions should be declared here PHALCON_VERSION: 5.0.0RC4 ZEPHIR_PARSER_VERSION: 1.5.0 - ZEPHIR_VERSION: 0.16.0 + ZEPHIR_VERSION: 0.16.1 # For tests LANG: en_US.UTF-8 diff --git a/docker/7.4/.bashrc b/docker/7.4/.bashrc index efe64453051..d3a90d0ad92 100644 --- a/docker/7.4/.bashrc +++ b/docker/7.4/.bashrc @@ -1,6 +1,6 @@ #!/bin/bash -ZEPHIR_VERSION="0.16.0" +ZEPHIR_VERSION="0.16.1" # Easier navigation: .., ..., ...., ....., ~ and - alias ..="cd .." diff --git a/docker/8.0/.bashrc b/docker/8.0/.bashrc index efe64453051..d3a90d0ad92 100644 --- a/docker/8.0/.bashrc +++ b/docker/8.0/.bashrc @@ -1,6 +1,6 @@ #!/bin/bash -ZEPHIR_VERSION="0.16.0" +ZEPHIR_VERSION="0.16.1" # Easier navigation: .., ..., ...., ....., ~ and - alias ..="cd .." diff --git a/docker/8.1/.bashrc b/docker/8.1/.bashrc index 47fa4435711..d3a90d0ad92 100644 --- a/docker/8.1/.bashrc +++ b/docker/8.1/.bashrc @@ -1,6 +1,6 @@ #!/bin/bash -ZEPHIR_VERSION="0.15.2" +ZEPHIR_VERSION="0.16.1" # Easier navigation: .., ..., ...., ....., ~ and - alias ..="cd .." From 0dc450a4196eacd6406609d3cde60f08145d4413 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 22 Aug 2022 11:03:07 +0100 Subject: [PATCH 2/7] #16023 - Adjust condition --- phalcon/Events/Event.zep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phalcon/Events/Event.zep b/phalcon/Events/Event.zep index 27142b0df9c..1d0d5b6060c 100644 --- a/phalcon/Events/Event.zep +++ b/phalcon/Events/Event.zep @@ -67,7 +67,7 @@ class Event implements EventInterface */ public function __construct(string! type, var source = null, var data = null, bool cancelable = true) { - if unlikely null !== source && typeof source != "object" { + if unlikely null !== source && typeof source !== "object" { throw new Exception( "The source of " . type . " event must be an object, got " . (typeof source) ); From 9e95039671d5edbbd87f5753ea239494be0375a9 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 22 Aug 2022 11:04:35 +0100 Subject: [PATCH 3/7] #16023 - Declare `Event:getSource()` method with correct signature --- phalcon/Events/Event.zep | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/phalcon/Events/Event.zep b/phalcon/Events/Event.zep index 1d0d5b6060c..0b491e2967c 100644 --- a/phalcon/Events/Event.zep +++ b/phalcon/Events/Event.zep @@ -44,7 +44,7 @@ class Event implements EventInterface * * @var object|null */ - protected source { get }; + protected source = null; /** * Is event propagation stopped? @@ -100,6 +100,11 @@ class Event implements EventInterface return this->stopped; } + public function getSource() -> object | null + { + return this->source; + } + /** * Sets event data. */ From a56f204f51417e51a7ef8400a44bc7275afd6be3 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 22 Aug 2022 23:31:43 +0100 Subject: [PATCH 4/7] #16023 - Bump `ZEPHIR_VERSION` to `0.16.2` --- .github/workflows/main.yml | 2 +- docker/7.4/.bashrc | 2 +- docker/8.0/.bashrc | 2 +- docker/8.1/.bashrc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b1b8b3f8f4f..f18c0cec789 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ env: # All versions should be declared here PHALCON_VERSION: 5.0.0RC4 ZEPHIR_PARSER_VERSION: 1.5.0 - ZEPHIR_VERSION: 0.16.1 + ZEPHIR_VERSION: 0.16.2 # For tests LANG: en_US.UTF-8 diff --git a/docker/7.4/.bashrc b/docker/7.4/.bashrc index d3a90d0ad92..c41a273e86c 100644 --- a/docker/7.4/.bashrc +++ b/docker/7.4/.bashrc @@ -1,6 +1,6 @@ #!/bin/bash -ZEPHIR_VERSION="0.16.1" +ZEPHIR_VERSION="0.16.2" # Easier navigation: .., ..., ...., ....., ~ and - alias ..="cd .." diff --git a/docker/8.0/.bashrc b/docker/8.0/.bashrc index d3a90d0ad92..c41a273e86c 100644 --- a/docker/8.0/.bashrc +++ b/docker/8.0/.bashrc @@ -1,6 +1,6 @@ #!/bin/bash -ZEPHIR_VERSION="0.16.1" +ZEPHIR_VERSION="0.16.2" # Easier navigation: .., ..., ...., ....., ~ and - alias ..="cd .." diff --git a/docker/8.1/.bashrc b/docker/8.1/.bashrc index d3a90d0ad92..c41a273e86c 100644 --- a/docker/8.1/.bashrc +++ b/docker/8.1/.bashrc @@ -1,6 +1,6 @@ #!/bin/bash -ZEPHIR_VERSION="0.16.1" +ZEPHIR_VERSION="0.16.2" # Easier navigation: .., ..., ...., ....., ~ and - alias ..="cd .." From 1cca79de3297a754c780f580697ced4af1250639 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Mon, 22 Aug 2022 23:32:36 +0100 Subject: [PATCH 5/7] #16023 - Regenerate ext/ directory --- .../pdo/connection/abstractconnection.zep.h | 6 ++++- .../pdo/connection/connectioninterface.zep.h | 6 ++++- ext/phalcon/events/event.zep.c | 23 ++++++++----------- ext/phalcon/events/event.zep.h | 14 +++++++---- ext/phalcon/http/cookie.zep.c | 4 +++- ext/phalcon/mvc/micro/lazyloader.zep.h | 6 ++++- ext/phalcon/support/helper/arr/toobject.zep.h | 6 ++++- ext/php_phalcon.h | 2 +- 8 files changed, 43 insertions(+), 24 deletions(-) diff --git a/ext/phalcon/datamapper/pdo/connection/abstractconnection.zep.h b/ext/phalcon/datamapper/pdo/connection/abstractconnection.zep.h index 14c3cbbc90d..9a30fe1d0c9 100644 --- a/ext/phalcon/datamapper/pdo/connection/abstractconnection.zep.h +++ b/ext/phalcon/datamapper/pdo/connection/abstractconnection.zep.h @@ -114,7 +114,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connectio ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_abstractconnection_fetchobject, 0, 1, NULL, 0) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phalcon_datamapper_pdo_connection_abstractconnection_fetchobject, 0, 1, MAY_BE_OBJECT) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_abstractconnection_fetchobject, 0, 1, IS_OBJECT, 0) +#endif ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0) #if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, values, IS_ARRAY, 0, "[]") diff --git a/ext/phalcon/datamapper/pdo/connection/connectioninterface.zep.h b/ext/phalcon/datamapper/pdo/connection/connectioninterface.zep.h index 63c9ab99cf5..1e3563c7fa2 100644 --- a/ext/phalcon/datamapper/pdo/connection/connectioninterface.zep.h +++ b/ext/phalcon/datamapper/pdo/connection/connectioninterface.zep.h @@ -56,7 +56,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connectio ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_connectioninterface_fetchobject, 0, 1, NULL, 0) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phalcon_datamapper_pdo_connection_connectioninterface_fetchobject, 0, 1, MAY_BE_OBJECT) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_datamapper_pdo_connection_connectioninterface_fetchobject, 0, 1, IS_OBJECT, 0) +#endif ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0) #if PHP_VERSION_ID >= 80000 ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, values, IS_ARRAY, 0, "[]") diff --git a/ext/phalcon/events/event.zep.c b/ext/phalcon/events/event.zep.c index 7fdec350012..2c6ef515b96 100644 --- a/ext/phalcon/events/event.zep.c +++ b/ext/phalcon/events/event.zep.c @@ -92,18 +92,6 @@ PHP_METHOD(Phalcon_Events_Event, getData) RETURN_MEMBER(getThis(), "data"); } -/** - * Event source - */ -PHP_METHOD(Phalcon_Events_Event, getSource) -{ - zval *this_ptr = getThis(); - - - - RETURN_MEMBER(getThis(), "source"); -} - /** * Event type */ @@ -235,6 +223,15 @@ PHP_METHOD(Phalcon_Events_Event, isStopped) RETURN_MEMBER(getThis(), "stopped"); } +PHP_METHOD(Phalcon_Events_Event, getSource) +{ + zval *this_ptr = getThis(); + + + + RETURN_MEMBER(getThis(), "source"); +} + /** * Sets event data. */ @@ -323,7 +320,7 @@ PHP_METHOD(Phalcon_Events_Event, stop) zephir_read_property(&_0, this_ptr, ZEND_STRL("cancelable"), PH_NOISY_CC | PH_READONLY); if (UNEXPECTED(!zephir_is_true(&_0))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_events_exception_ce, "Trying to cancel a non-cancelable event", "phalcon/Events/Event.zep", 135); + ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_events_exception_ce, "Trying to cancel a non-cancelable event", "phalcon/Events/Event.zep", 140); return; } if (1) { diff --git a/ext/phalcon/events/event.zep.h b/ext/phalcon/events/event.zep.h index 23d54cb8271..032be6f3693 100644 --- a/ext/phalcon/events/event.zep.h +++ b/ext/phalcon/events/event.zep.h @@ -4,11 +4,11 @@ extern zend_class_entry *phalcon_events_event_ce; ZEPHIR_INIT_CLASS(Phalcon_Events_Event); PHP_METHOD(Phalcon_Events_Event, getData); -PHP_METHOD(Phalcon_Events_Event, getSource); PHP_METHOD(Phalcon_Events_Event, getType); PHP_METHOD(Phalcon_Events_Event, __construct); PHP_METHOD(Phalcon_Events_Event, isCancelable); PHP_METHOD(Phalcon_Events_Event, isStopped); +PHP_METHOD(Phalcon_Events_Event, getSource); PHP_METHOD(Phalcon_Events_Event, setData); PHP_METHOD(Phalcon_Events_Event, setType); PHP_METHOD(Phalcon_Events_Event, stop); @@ -16,9 +16,6 @@ PHP_METHOD(Phalcon_Events_Event, stop); ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_events_event_getdata, 0, 0, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_events_event_getsource, 0, 0, NULL, 1) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_events_event_gettype, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -35,6 +32,13 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_events_event_isstopped, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phalcon_events_event_getsource, 0, 0, MAY_BE_NULL|MAY_BE_OBJECT) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_events_event_getsource, 0, 0, IS_OBJECT, 1) +#endif +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_events_event_setdata, 0, 0, Phalcon\\Events\\EventInterface, 0) ZEND_ARG_INFO(0, data) ZEND_END_ARG_INFO() @@ -52,11 +56,11 @@ ZEPHIR_INIT_FUNCS(phalcon_events_event_method_entry) { #else PHP_ME(Phalcon_Events_Event, getData, NULL, ZEND_ACC_PUBLIC) #endif - PHP_ME(Phalcon_Events_Event, getSource, arginfo_phalcon_events_event_getsource, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Events_Event, getType, arginfo_phalcon_events_event_gettype, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Events_Event, __construct, arginfo_phalcon_events_event___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(Phalcon_Events_Event, isCancelable, arginfo_phalcon_events_event_iscancelable, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Events_Event, isStopped, arginfo_phalcon_events_event_isstopped, ZEND_ACC_PUBLIC) + PHP_ME(Phalcon_Events_Event, getSource, arginfo_phalcon_events_event_getsource, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Events_Event, setData, arginfo_phalcon_events_event_setdata, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Events_Event, setType, arginfo_phalcon_events_event_settype, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Events_Event, stop, arginfo_phalcon_events_event_stop, ZEND_ACC_PUBLIC) diff --git a/ext/phalcon/http/cookie.zep.c b/ext/phalcon/http/cookie.zep.c index 6e474cc2742..1b89cbeaf41 100644 --- a/ext/phalcon/http/cookie.zep.c +++ b/ext/phalcon/http/cookie.zep.c @@ -334,7 +334,9 @@ PHP_METHOD(Phalcon_Http_Cookie, delete) ZEPHIR_CALL_METHOD(&_12, this_ptr, "getarrval", NULL, 332, &options, &_8, &httpOnly); zephir_check_call_status(); zephir_array_update_string(&options, SL("httponly"), &_12, PH_COPY | PH_SEPARATE); - ZEPHIR_CALL_FUNCTION(NULL, "setcookie", NULL, 333, &name, &__$null, &options); + ZEPHIR_INIT_NVAR(&_8); + ZVAL_STRING(&_8, ""); + ZEPHIR_CALL_FUNCTION(NULL, "setcookie", NULL, 333, &name, &_8, &options); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); } diff --git a/ext/phalcon/mvc/micro/lazyloader.zep.h b/ext/phalcon/mvc/micro/lazyloader.zep.h index 5d5cd933cc2..639001b5689 100644 --- a/ext/phalcon/mvc/micro/lazyloader.zep.h +++ b/ext/phalcon/mvc/micro/lazyloader.zep.h @@ -8,7 +8,11 @@ PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, getDefinition); PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, __construct); PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, callMethod); -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_mvc_micro_lazyloader_gethandler, 0, 0, NULL, 1) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phalcon_mvc_micro_lazyloader_gethandler, 0, 0, MAY_BE_NULL|MAY_BE_OBJECT) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_micro_lazyloader_gethandler, 0, 0, IS_OBJECT, 1) +#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_micro_lazyloader_getdefinition, 0, 0, IS_STRING, 0) diff --git a/ext/phalcon/support/helper/arr/toobject.zep.h b/ext/phalcon/support/helper/arr/toobject.zep.h index df4d3649136..9201f906fae 100644 --- a/ext/phalcon/support/helper/arr/toobject.zep.h +++ b/ext/phalcon/support/helper/arr/toobject.zep.h @@ -5,7 +5,11 @@ ZEPHIR_INIT_CLASS(Phalcon_Support_Helper_Arr_ToObject); PHP_METHOD(Phalcon_Support_Helper_Arr_ToObject, __invoke); -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_support_helper_arr_toobject___invoke, 0, 1, NULL, 0) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phalcon_support_helper_arr_toobject___invoke, 0, 1, MAY_BE_OBJECT) +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_support_helper_arr_toobject___invoke, 0, 1, IS_OBJECT, 0) +#endif ZEND_ARG_ARRAY_INFO(0, collection, 0) ZEND_END_ARG_INFO() diff --git a/ext/php_phalcon.h b/ext/php_phalcon.h index daaac13d96a..c7f03f18ba0 100644 --- a/ext/php_phalcon.h +++ b/ext/php_phalcon.h @@ -14,7 +14,7 @@ #define PHP_PHALCON_VERSION "5.0.0RC4" #define PHP_PHALCON_EXTNAME "phalcon" #define PHP_PHALCON_AUTHOR "Phalcon Team and contributors" -#define PHP_PHALCON_ZEPVERSION "0.16.0-4fac47b" +#define PHP_PHALCON_ZEPVERSION "0.16.2-3e961ab" #define PHP_PHALCON_DESCRIPTION "Phalcon is a full stack PHP framework, delivered as a PHP extension, offering lower resource consumption and high performance." typedef struct _zephir_struct_db { From ef003b1d83d5f871f41bd691d40af942bdf6cb47 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 23 Aug 2022 00:01:32 +0100 Subject: [PATCH 6/7] #16023 - Update CHANGELOG-5.0.md --- CHANGELOG-5.0.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 4b7e0c2c901..48f4b1cd279 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -1,3 +1,8 @@ +# [x.x.x](https://github.com/phalcon/cphalcon/releases/tag/vx.x.x) (xxxx-xx-xx) + +## Fixed +- Fixed and improved return type of `object` & `?object` [#16023](https://github.com/phalcon/cphalcon/issues/16023) + # [5.0.0rc4](https://github.com/phalcon/cphalcon/releases/tag/v5.0.0RC4) (2022-08-08) ## Fixed From b87f9cc399558d6827e989976f47284e317e762c Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Tue, 23 Aug 2022 00:03:33 +0100 Subject: [PATCH 7/7] #16023 - Adjust comments style --- phalcon/Tag.zep | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phalcon/Tag.zep b/phalcon/Tag.zep index b52c584bcfd..e066e2d25fd 100644 --- a/phalcon/Tag.zep +++ b/phalcon/Tag.zep @@ -1477,8 +1477,8 @@ class Tag } /** - * Automatically assign the id if the name is not an array - */ + * Automatically assign the id if the name is not an array + */ if !strpos(id, "[") { if !isset params["id"] { let params["id"] = id; @@ -1502,15 +1502,15 @@ class Tag let value = self::getValue(id, params); /** - * Evaluate the value in POST - */ + * Evaluate the value in POST + */ if value != null { let params["checked"] = "checked"; } /** - * Update the value anyways - */ + * Update the value anyways + */ let params["value"] = value; }