diff --git a/CHANGELOG b/CHANGELOG index 76c95b391f5..d928f931871 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -19,6 +19,8 @@ - Bug fix: no arguments were passed to beforeMatch handler in Phalcon\Mvc\Router (#1556) - Phalcon\Logger\Adapter::setLogLevel() is honored by transactions (#1716) - Bug fixes in Phalcon\Db\Adapter\Pdo::describeColumns() (#1562) + - Phalcon\Session\Adapter::__destruct() now calls session_write_close() (#1624) + - Volt: fixed bug in email_filed() (#1723) 1.2.4 - Fixed broken ACL inheritance (#905) diff --git a/build/32bits/phalcon.c b/build/32bits/phalcon.c index 648a4dddfc7..f25af13949c 100644 --- a/build/32bits/phalcon.c +++ b/build/32bits/phalcon.c @@ -2100,6 +2100,7 @@ static void phalcon_session_start(TSRMLS_D); static void phalcon_session_destroy(TSRMLS_D); static void phalcon_get_session_id(zval *return_value TSRMLS_DC); static void phalcon_set_session_id(zval *sid TSRMLS_DC); +static void phalcon_session_write_close(TSRMLS_D); #endif /* KERNEL_SESSION_H */ @@ -10453,6 +10454,11 @@ static void phalcon_set_session_id(zval *sid TSRMLS_DC) #endif } +static void phalcon_session_write_close(TSRMLS_D) +{ + phalcon_call_func_params_w(NULL, SL("session_write_close"), 0, NULL TSRMLS_CC); +} + @@ -74842,7 +74848,7 @@ static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ phalcon_read_property_this_quick(&array_helpers, this_ptr, SL("_arrayHelpers"), 3087512406UL, PH_NOISY_CC); if (Z_TYPE_P(array_helpers) != IS_ARRAY) { PHALCON_INIT_NVAR(array_helpers); - array_init_size(array_helpers, 15); + array_init_size(array_helpers, 16); add_assoc_bool_ex(array_helpers, SS("link_to"), 1); add_assoc_bool_ex(array_helpers, SS("image"), 1); add_assoc_bool_ex(array_helpers, SS("form"), 1); @@ -74858,6 +74864,7 @@ static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ add_assoc_bool_ex(array_helpers, SS("text_field"), 1); add_assoc_bool_ex(array_helpers, SS("date_field"), 1); add_assoc_bool_ex(array_helpers, SS("numeric_field"), 1); + add_assoc_bool_ex(array_helpers, SS("email_field"), 1); phalcon_update_property_this_quick(this_ptr, SL("_arrayHelpers"), array_helpers, 3087512406UL TSRMLS_CC); } @@ -93597,6 +93604,22 @@ static PHP_METHOD(Phalcon_Session_Adapter, __construct){ PHALCON_MM_RESTORE(); } +static PHP_METHOD(Phalcon_Session_Adapter, __destruct) { + + zval *started; + + PHALCON_MM_GROW(); + + PHALCON_OBS_VAR(started); + phalcon_read_property_this(&started, getThis(), SL("_started"), PH_NOISY TSRMLS_CC); + if (zend_is_true(started)) { + phalcon_session_write_close(TSRMLS_C); + phalcon_update_property_bool(this_ptr, SL("_started"), 0 TSRMLS_CC); + } + + PHALCON_MM_RESTORE(); +} + static PHP_METHOD(Phalcon_Session_Adapter, start){ if (!SG(headers_sent)) { diff --git a/build/32bits/phalcon.h b/build/32bits/phalcon.h index 865173476db..88250e0bfea 100644 --- a/build/32bits/phalcon.h +++ b/build/32bits/phalcon.h @@ -5467,6 +5467,7 @@ zend_class_entry *phalcon_session_adapter_ce; PHALCON_INIT_CLASS(Phalcon_Session_Adapter); static PHP_METHOD(Phalcon_Session_Adapter, __construct); +static PHP_METHOD(Phalcon_Session_Adapter, __destruct); static PHP_METHOD(Phalcon_Session_Adapter, start); static PHP_METHOD(Phalcon_Session_Adapter, setOptions); static PHP_METHOD(Phalcon_Session_Adapter, getOptions); @@ -5506,6 +5507,7 @@ ZEND_END_ARG_INFO() PHALCON_INIT_FUNCS(phalcon_session_adapter_method_entry){ PHP_ME(Phalcon_Session_Adapter, __construct, arginfo_phalcon_session_adapter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(Phalcon_Session_Adapter, __destruct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_DTOR) PHP_ME(Phalcon_Session_Adapter, start, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Session_Adapter, setOptions, arginfo_phalcon_session_adapter_setoptions, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Session_Adapter, getOptions, NULL, ZEND_ACC_PUBLIC) diff --git a/build/64bits/phalcon.c b/build/64bits/phalcon.c index 0caafa9da1d..0d03edaa126 100644 --- a/build/64bits/phalcon.c +++ b/build/64bits/phalcon.c @@ -2100,6 +2100,7 @@ static void phalcon_session_start(TSRMLS_D); static void phalcon_session_destroy(TSRMLS_D); static void phalcon_get_session_id(zval *return_value TSRMLS_DC); static void phalcon_set_session_id(zval *sid TSRMLS_DC); +static void phalcon_session_write_close(TSRMLS_D); #endif /* KERNEL_SESSION_H */ @@ -10453,6 +10454,11 @@ static void phalcon_set_session_id(zval *sid TSRMLS_DC) #endif } +static void phalcon_session_write_close(TSRMLS_D) +{ + phalcon_call_func_params_w(NULL, SL("session_write_close"), 0, NULL TSRMLS_CC); +} + @@ -74842,7 +74848,7 @@ static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ phalcon_read_property_this_quick(&array_helpers, this_ptr, SL("_arrayHelpers"), 15584335196500505430UL, PH_NOISY_CC); if (Z_TYPE_P(array_helpers) != IS_ARRAY) { PHALCON_INIT_NVAR(array_helpers); - array_init_size(array_helpers, 15); + array_init_size(array_helpers, 16); add_assoc_bool_ex(array_helpers, SS("link_to"), 1); add_assoc_bool_ex(array_helpers, SS("image"), 1); add_assoc_bool_ex(array_helpers, SS("form"), 1); @@ -74858,6 +74864,7 @@ static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ add_assoc_bool_ex(array_helpers, SS("text_field"), 1); add_assoc_bool_ex(array_helpers, SS("date_field"), 1); add_assoc_bool_ex(array_helpers, SS("numeric_field"), 1); + add_assoc_bool_ex(array_helpers, SS("email_field"), 1); phalcon_update_property_this_quick(this_ptr, SL("_arrayHelpers"), array_helpers, 15584335196500505430UL TSRMLS_CC); } @@ -93597,6 +93604,22 @@ static PHP_METHOD(Phalcon_Session_Adapter, __construct){ PHALCON_MM_RESTORE(); } +static PHP_METHOD(Phalcon_Session_Adapter, __destruct) { + + zval *started; + + PHALCON_MM_GROW(); + + PHALCON_OBS_VAR(started); + phalcon_read_property_this(&started, getThis(), SL("_started"), PH_NOISY TSRMLS_CC); + if (zend_is_true(started)) { + phalcon_session_write_close(TSRMLS_C); + phalcon_update_property_bool(this_ptr, SL("_started"), 0 TSRMLS_CC); + } + + PHALCON_MM_RESTORE(); +} + static PHP_METHOD(Phalcon_Session_Adapter, start){ if (!SG(headers_sent)) { diff --git a/build/64bits/phalcon.h b/build/64bits/phalcon.h index 865173476db..88250e0bfea 100644 --- a/build/64bits/phalcon.h +++ b/build/64bits/phalcon.h @@ -5467,6 +5467,7 @@ zend_class_entry *phalcon_session_adapter_ce; PHALCON_INIT_CLASS(Phalcon_Session_Adapter); static PHP_METHOD(Phalcon_Session_Adapter, __construct); +static PHP_METHOD(Phalcon_Session_Adapter, __destruct); static PHP_METHOD(Phalcon_Session_Adapter, start); static PHP_METHOD(Phalcon_Session_Adapter, setOptions); static PHP_METHOD(Phalcon_Session_Adapter, getOptions); @@ -5506,6 +5507,7 @@ ZEND_END_ARG_INFO() PHALCON_INIT_FUNCS(phalcon_session_adapter_method_entry){ PHP_ME(Phalcon_Session_Adapter, __construct, arginfo_phalcon_session_adapter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(Phalcon_Session_Adapter, __destruct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_DTOR) PHP_ME(Phalcon_Session_Adapter, start, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Session_Adapter, setOptions, arginfo_phalcon_session_adapter_setoptions, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Session_Adapter, getOptions, NULL, ZEND_ACC_PUBLIC) diff --git a/build/safe/phalcon.c b/build/safe/phalcon.c index 5e6ccfa0e06..c6d33a77d64 100644 --- a/build/safe/phalcon.c +++ b/build/safe/phalcon.c @@ -2100,6 +2100,7 @@ static void phalcon_session_start(TSRMLS_D); static void phalcon_session_destroy(TSRMLS_D); static void phalcon_get_session_id(zval *return_value TSRMLS_DC); static void phalcon_set_session_id(zval *sid TSRMLS_DC); +static void phalcon_session_write_close(TSRMLS_D); #endif /* KERNEL_SESSION_H */ @@ -10453,6 +10454,11 @@ static void phalcon_set_session_id(zval *sid TSRMLS_DC) #endif } +static void phalcon_session_write_close(TSRMLS_D) +{ + phalcon_call_func_params_w(NULL, SL("session_write_close"), 0, NULL TSRMLS_CC); +} + @@ -74842,7 +74848,7 @@ static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ phalcon_read_property_this(&array_helpers, this_ptr, SL("_arrayHelpers"), PH_NOISY_CC); if (Z_TYPE_P(array_helpers) != IS_ARRAY) { PHALCON_INIT_NVAR(array_helpers); - array_init_size(array_helpers, 15); + array_init_size(array_helpers, 16); add_assoc_bool_ex(array_helpers, SS("link_to"), 1); add_assoc_bool_ex(array_helpers, SS("image"), 1); add_assoc_bool_ex(array_helpers, SS("form"), 1); @@ -74858,6 +74864,7 @@ static PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ add_assoc_bool_ex(array_helpers, SS("text_field"), 1); add_assoc_bool_ex(array_helpers, SS("date_field"), 1); add_assoc_bool_ex(array_helpers, SS("numeric_field"), 1); + add_assoc_bool_ex(array_helpers, SS("email_field"), 1); phalcon_update_property_this(this_ptr, SL("_arrayHelpers"), array_helpers TSRMLS_CC); } @@ -93597,6 +93604,22 @@ static PHP_METHOD(Phalcon_Session_Adapter, __construct){ PHALCON_MM_RESTORE(); } +static PHP_METHOD(Phalcon_Session_Adapter, __destruct) { + + zval *started; + + PHALCON_MM_GROW(); + + PHALCON_OBS_VAR(started); + phalcon_read_property_this(&started, getThis(), SL("_started"), PH_NOISY TSRMLS_CC); + if (zend_is_true(started)) { + phalcon_session_write_close(TSRMLS_C); + phalcon_update_property_bool(this_ptr, SL("_started"), 0 TSRMLS_CC); + } + + PHALCON_MM_RESTORE(); +} + static PHP_METHOD(Phalcon_Session_Adapter, start){ if (!SG(headers_sent)) { diff --git a/build/safe/phalcon.h b/build/safe/phalcon.h index 865173476db..88250e0bfea 100644 --- a/build/safe/phalcon.h +++ b/build/safe/phalcon.h @@ -5467,6 +5467,7 @@ zend_class_entry *phalcon_session_adapter_ce; PHALCON_INIT_CLASS(Phalcon_Session_Adapter); static PHP_METHOD(Phalcon_Session_Adapter, __construct); +static PHP_METHOD(Phalcon_Session_Adapter, __destruct); static PHP_METHOD(Phalcon_Session_Adapter, start); static PHP_METHOD(Phalcon_Session_Adapter, setOptions); static PHP_METHOD(Phalcon_Session_Adapter, getOptions); @@ -5506,6 +5507,7 @@ ZEND_END_ARG_INFO() PHALCON_INIT_FUNCS(phalcon_session_adapter_method_entry){ PHP_ME(Phalcon_Session_Adapter, __construct, arginfo_phalcon_session_adapter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(Phalcon_Session_Adapter, __destruct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_DTOR) PHP_ME(Phalcon_Session_Adapter, start, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Session_Adapter, setOptions, arginfo_phalcon_session_adapter_setoptions, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Session_Adapter, getOptions, NULL, ZEND_ACC_PUBLIC) diff --git a/ext/kernel/session.c b/ext/kernel/session.c index fa90b9546d1..9a200aa1e23 100644 --- a/ext/kernel/session.c +++ b/ext/kernel/session.c @@ -87,3 +87,8 @@ void phalcon_set_session_id(zval *sid TSRMLS_DC) phalcon_call_func_params_w(NULL, SL("session_id"), 1, params TSRMLS_CC); #endif } + +void phalcon_session_write_close(TSRMLS_D) +{ + phalcon_call_func_params_w(NULL, SL("session_write_close"), 0, NULL TSRMLS_CC); +} diff --git a/ext/kernel/session.h b/ext/kernel/session.h index 2f539e6e0d9..7c6ceadbed2 100644 --- a/ext/kernel/session.h +++ b/ext/kernel/session.h @@ -24,5 +24,6 @@ void phalcon_session_start(TSRMLS_D); void phalcon_session_destroy(TSRMLS_D); void phalcon_get_session_id(zval *return_value TSRMLS_DC); void phalcon_set_session_id(zval *sid TSRMLS_DC); +void phalcon_session_write_close(TSRMLS_D); #endif /* KERNEL_SESSION_H */ diff --git a/ext/mvc/view/engine/volt/compiler.c b/ext/mvc/view/engine/volt/compiler.c index 2f996221794..0d3d341bbde 100644 --- a/ext/mvc/view/engine/volt/compiler.c +++ b/ext/mvc/view/engine/volt/compiler.c @@ -784,7 +784,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ phalcon_read_property_this(&array_helpers, this_ptr, SL("_arrayHelpers"), PH_NOISY_CC); if (Z_TYPE_P(array_helpers) != IS_ARRAY) { PHALCON_INIT_NVAR(array_helpers); - array_init_size(array_helpers, 15); + array_init_size(array_helpers, 16); add_assoc_bool_ex(array_helpers, SS("link_to"), 1); add_assoc_bool_ex(array_helpers, SS("image"), 1); add_assoc_bool_ex(array_helpers, SS("form"), 1); @@ -800,6 +800,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ add_assoc_bool_ex(array_helpers, SS("text_field"), 1); add_assoc_bool_ex(array_helpers, SS("date_field"), 1); add_assoc_bool_ex(array_helpers, SS("numeric_field"), 1); + add_assoc_bool_ex(array_helpers, SS("email_field"), 1); phalcon_update_property_this(this_ptr, SL("_arrayHelpers"), array_helpers TSRMLS_CC); } diff --git a/ext/session/adapter.c b/ext/session/adapter.c index f365a01fb48..2b2470ebd22 100644 --- a/ext/session/adapter.c +++ b/ext/session/adapter.c @@ -87,6 +87,22 @@ PHP_METHOD(Phalcon_Session_Adapter, __construct){ PHALCON_MM_RESTORE(); } +PHP_METHOD(Phalcon_Session_Adapter, __destruct) { + + zval *started; + + PHALCON_MM_GROW(); + + PHALCON_OBS_VAR(started); + phalcon_read_property_this(&started, getThis(), SL("_started"), PH_NOISY TSRMLS_CC); + if (zend_is_true(started)) { + phalcon_session_write_close(TSRMLS_C); + phalcon_update_property_bool(this_ptr, SL("_started"), 0 TSRMLS_CC); + } + + PHALCON_MM_RESTORE(); +} + /** * Starts the session (if headers are already sent the session will not be started) * diff --git a/ext/session/adapter.h b/ext/session/adapter.h index 53b590dd98c..1186d218a86 100644 --- a/ext/session/adapter.h +++ b/ext/session/adapter.h @@ -22,6 +22,7 @@ extern zend_class_entry *phalcon_session_adapter_ce; PHALCON_INIT_CLASS(Phalcon_Session_Adapter); PHP_METHOD(Phalcon_Session_Adapter, __construct); +PHP_METHOD(Phalcon_Session_Adapter, __destruct); PHP_METHOD(Phalcon_Session_Adapter, start); PHP_METHOD(Phalcon_Session_Adapter, setOptions); PHP_METHOD(Phalcon_Session_Adapter, getOptions); @@ -61,6 +62,7 @@ ZEND_END_ARG_INFO() PHALCON_INIT_FUNCS(phalcon_session_adapter_method_entry){ PHP_ME(Phalcon_Session_Adapter, __construct, arginfo_phalcon_session_adapter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(Phalcon_Session_Adapter, __destruct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_DTOR) PHP_ME(Phalcon_Session_Adapter, start, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Session_Adapter, setOptions, arginfo_phalcon_session_adapter_setoptions, ZEND_ACC_PUBLIC) PHP_ME(Phalcon_Session_Adapter, getOptions, NULL, ZEND_ACC_PUBLIC) diff --git a/ext/tests/issue-1683.phpt b/ext/tests/issue-1683.phpt new file mode 100644 index 00000000000..eaaa669130f --- /dev/null +++ b/ext/tests/issue-1683.phpt @@ -0,0 +1,15 @@ +--TEST-- +Phalcon\Debug - Notice: Array to string conversion in Unknown on line 0 - https://github.com/phalcon/cphalcon/issues/1683 +--SKIPIF-- + +--FILE-- +listen(); + +throw new \Exception(); +?> +--EXPECTREGEX-- +^.*$ diff --git a/ext/tests/issue-1723.phpt b/ext/tests/issue-1723.phpt new file mode 100644 index 00000000000..f57f0925726 --- /dev/null +++ b/ext/tests/issue-1723.phpt @@ -0,0 +1,12 @@ +--TEST-- +email_field() Volt function doesn't work properly in case of a placeholder parameter - https://github.com/phalcon/cphalcon/issues/1723 +--SKIPIF-- + +--FILE-- +compileString('{{ email_field("email", "placeholder": "E-mail") }}' . PHP_EOL . '{{ password_field("password", "placeholder": "Password") }}' . PHP_EOL); +?> +--EXPECT-- +tag->emailField(array('email', 'placeholder' => 'E-mail')); ?> +tag->passwordField(array('password', 'placeholder' => 'Password')); ?>