Skip to content

Commit

Permalink
Merge pull request #1727 from sjinks/1.2.5
Browse files Browse the repository at this point in the history
[1.2.5] Test case for #1683 + bug fixes
  • Loading branch information
Phalcon committed Dec 23, 2013
2 parents 92e61f0 + dc8f765 commit d6d4aaf
Show file tree
Hide file tree
Showing 14 changed files with 133 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 24 additions & 1 deletion build/32bits/phalcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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);
}




Expand Down Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 2 additions & 0 deletions build/32bits/phalcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
25 changes: 24 additions & 1 deletion build/64bits/phalcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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);
}




Expand Down Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 2 additions & 0 deletions build/64bits/phalcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
25 changes: 24 additions & 1 deletion build/safe/phalcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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);
}




Expand Down Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 2 additions & 0 deletions build/safe/phalcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions ext/kernel/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions ext/kernel/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
3 changes: 2 additions & 1 deletion ext/mvc/view/engine/volt/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down
16 changes: 16 additions & 0 deletions ext/session/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
Expand Down
2 changes: 2 additions & 0 deletions ext/session/adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions ext/tests/issue-1683.phpt
Original file line number Diff line number Diff line change
@@ -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--
<?php include('skipif.inc'); ?>
--FILE--
<?php
error_reporting(E_ALL);

$debug = new \Phalcon\Debug();
$debug->listen();

throw new \Exception();
?>
--EXPECTREGEX--
^<html><head>.*$
12 changes: 12 additions & 0 deletions ext/tests/issue-1723.phpt
Original file line number Diff line number Diff line change
@@ -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--
<?php include('skipif.inc'); ?>
--FILE--
<?php
$volt = new \Phalcon\Mvc\View\Engine\Volt\Compiler();
echo $volt->compileString('{{ email_field("email", "placeholder": "E-mail") }}' . PHP_EOL . '{{ password_field("password", "placeholder": "Password") }}' . PHP_EOL);
?>
--EXPECT--
<?php echo $this->tag->emailField(array('email', 'placeholder' => 'E-mail')); ?>
<?php echo $this->tag->passwordField(array('password', 'placeholder' => 'Password')); ?>

0 comments on commit d6d4aaf

Please sign in to comment.