Skip to content

Commit

Permalink
Merged origin/1.2.4 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Oct 22, 2013
2 parents 5a91957 + a1f990a commit e9f8507
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 40 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
- Fixed invalid memory reads/writes across the code (#1340)
- Fixed HAVING handling in Phalcon\Mvc\QueryBuilder (#1396)
- Bug fixes in \Phalcon\Logger\{Adapter,Formatter}\FirePhp (#1333)
- Bug fixes in Phalcon\Cache\Backend\Xcache (#1406)
- Phalcon\Forms\Element::__toString() does not throw exceptions anymore (#1413)
- Other bug fixes (#947, #1131, #1040, #1275, #1392, #1396, #1399, backported patches from 1.3.0 etc)

1.2.3
Expand Down
43 changes: 33 additions & 10 deletions build/32bits/phalcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -89117,13 +89117,11 @@ static PHP_METHOD(Phalcon_Cache_Backend_Xcache, save){
array_init(keys);
}

if (!zend_is_true(keys)) {
phalcon_array_update_zval(&keys, last_key, &ttl, PH_COPY | PH_SEPARATE);

PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}
phalcon_array_update_zval(&keys, last_key, &ttl, PH_COPY | PH_SEPARATE);

PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}

PHALCON_MM_RESTORE();
Expand Down Expand Up @@ -89158,7 +89156,7 @@ static PHP_METHOD(Phalcon_Cache_Backend_Xcache, delete){
if (Z_TYPE_P(keys) == IS_ARRAY) {
PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_array_unset(&keys, special_key, PH_SEPARATE);
phalcon_array_unset(&keys, prefixed_key, PH_SEPARATE);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}

Expand Down Expand Up @@ -90969,10 +90967,26 @@ static PHP_METHOD(Phalcon_Forms_Element, clear){

static PHP_METHOD(Phalcon_Forms_Element, __toString){


PHALCON_MM_GROW();

phalcon_call_method_key(return_value, this_ptr, "render", 1053215877UL);
if (phalcon_call_method_params(return_value, this_ptr, SL("render"), 0, NULL, zend_inline_hash_func(SS("render")), 1 TSRMLS_CC) == FAILURE) {
if (EG(exception)) {
zval *e = EG(exception);
zval *m = zend_read_property(Z_OBJCE_P(e), e, SL("message"), 1 TSRMLS_CC);

Z_ADDREF_P(m);
if (Z_TYPE_P(m) != IS_STRING) {
convert_to_string_ex(&m);
}

zend_clear_exception(TSRMLS_C);
zend_error(E_ERROR, "%s", Z_STRVAL_P(m));
zval_ptr_dtor(&m);
}

return;
}

RETURN_MM();
}

Expand Down Expand Up @@ -97268,6 +97282,9 @@ static void phalcon_tag_write_attributes(zval *code, zval *attributes TSRMLS_DC)

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, attributes TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

if (escaper) {
for (
Expand Down Expand Up @@ -97658,6 +97675,9 @@ static PHP_METHOD(Phalcon_Tag, _inputField){

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, params TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

phalcon_array_update_quick_string(&params, SS("type"), 276192743UL, &type, PH_COPY | PH_SEPARATE);

Expand Down Expand Up @@ -97999,6 +98019,9 @@ static PHP_METHOD(Phalcon_Tag, textArea){

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, params TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

if (escaper) {
PHALCON_INIT_VAR(escaped);
Expand Down
43 changes: 33 additions & 10 deletions build/64bits/phalcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -89117,13 +89117,11 @@ static PHP_METHOD(Phalcon_Cache_Backend_Xcache, save){
array_init(keys);
}

if (!zend_is_true(keys)) {
phalcon_array_update_zval(&keys, last_key, &ttl, PH_COPY | PH_SEPARATE);

PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}
phalcon_array_update_zval(&keys, last_key, &ttl, PH_COPY | PH_SEPARATE);

PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}

PHALCON_MM_RESTORE();
Expand Down Expand Up @@ -89158,7 +89156,7 @@ static PHP_METHOD(Phalcon_Cache_Backend_Xcache, delete){
if (Z_TYPE_P(keys) == IS_ARRAY) {
PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_array_unset(&keys, special_key, PH_SEPARATE);
phalcon_array_unset(&keys, prefixed_key, PH_SEPARATE);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}

Expand Down Expand Up @@ -90969,10 +90967,26 @@ static PHP_METHOD(Phalcon_Forms_Element, clear){

static PHP_METHOD(Phalcon_Forms_Element, __toString){


PHALCON_MM_GROW();

phalcon_call_method_key(return_value, this_ptr, "render", 229481155841157UL);
if (phalcon_call_method_params(return_value, this_ptr, SL("render"), 0, NULL, zend_inline_hash_func(SS("render")), 1 TSRMLS_CC) == FAILURE) {
if (EG(exception)) {
zval *e = EG(exception);
zval *m = zend_read_property(Z_OBJCE_P(e), e, SL("message"), 1 TSRMLS_CC);

Z_ADDREF_P(m);
if (Z_TYPE_P(m) != IS_STRING) {
convert_to_string_ex(&m);
}

zend_clear_exception(TSRMLS_C);
zend_error(E_ERROR, "%s", Z_STRVAL_P(m));
zval_ptr_dtor(&m);
}

return;
}

RETURN_MM();
}

Expand Down Expand Up @@ -97268,6 +97282,9 @@ static void phalcon_tag_write_attributes(zval *code, zval *attributes TSRMLS_DC)

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, attributes TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

if (escaper) {
for (
Expand Down Expand Up @@ -97658,6 +97675,9 @@ static PHP_METHOD(Phalcon_Tag, _inputField){

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, params TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

phalcon_array_update_quick_string(&params, SS("type"), 210729590247UL, &type, PH_COPY | PH_SEPARATE);

Expand Down Expand Up @@ -97999,6 +98019,9 @@ static PHP_METHOD(Phalcon_Tag, textArea){

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, params TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

if (escaper) {
PHALCON_INIT_VAR(escaped);
Expand Down
43 changes: 33 additions & 10 deletions build/safe/phalcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -89117,13 +89117,11 @@ static PHP_METHOD(Phalcon_Cache_Backend_Xcache, save){
array_init(keys);
}

if (!zend_is_true(keys)) {
phalcon_array_update_zval(&keys, last_key, &ttl, PH_COPY | PH_SEPARATE);

PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}
phalcon_array_update_zval(&keys, last_key, &ttl, PH_COPY | PH_SEPARATE);

PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}

PHALCON_MM_RESTORE();
Expand Down Expand Up @@ -89158,7 +89156,7 @@ static PHP_METHOD(Phalcon_Cache_Backend_Xcache, delete){
if (Z_TYPE_P(keys) == IS_ARRAY) {
PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_array_unset(&keys, special_key, PH_SEPARATE);
phalcon_array_unset(&keys, prefixed_key, PH_SEPARATE);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}

Expand Down Expand Up @@ -90969,10 +90967,26 @@ static PHP_METHOD(Phalcon_Forms_Element, clear){

static PHP_METHOD(Phalcon_Forms_Element, __toString){


PHALCON_MM_GROW();

phalcon_call_method(return_value, this_ptr, "render");
if (phalcon_call_method_params(return_value, this_ptr, SL("render"), 0, NULL, zend_inline_hash_func(SS("render")), 1 TSRMLS_CC) == FAILURE) {
if (EG(exception)) {
zval *e = EG(exception);
zval *m = zend_read_property(Z_OBJCE_P(e), e, SL("message"), 1 TSRMLS_CC);

Z_ADDREF_P(m);
if (Z_TYPE_P(m) != IS_STRING) {
convert_to_string_ex(&m);
}

zend_clear_exception(TSRMLS_C);
zend_error(E_ERROR, "%s", Z_STRVAL_P(m));
zval_ptr_dtor(&m);
}

return;
}

RETURN_MM();
}

Expand Down Expand Up @@ -97268,6 +97282,9 @@ static void phalcon_tag_write_attributes(zval *code, zval *attributes TSRMLS_DC)

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, attributes TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

if (escaper) {
for (
Expand Down Expand Up @@ -97658,6 +97675,9 @@ static PHP_METHOD(Phalcon_Tag, _inputField){

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, params TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

phalcon_array_update_string(&params, SL("type"), &type, PH_COPY | PH_SEPARATE);

Expand Down Expand Up @@ -97999,6 +98019,9 @@ static PHP_METHOD(Phalcon_Tag, textArea){

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, params TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

if (escaper) {
PHALCON_INIT_VAR(escaped);
Expand Down
14 changes: 6 additions & 8 deletions ext/cache/backend/xcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,11 @@ PHP_METHOD(Phalcon_Cache_Backend_Xcache, save){
array_init(keys);
}

if (!zend_is_true(keys)) {
phalcon_array_update_zval(&keys, last_key, &ttl, PH_COPY | PH_SEPARATE);

PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}
phalcon_array_update_zval(&keys, last_key, &ttl, PH_COPY | PH_SEPARATE);

PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}

PHALCON_MM_RESTORE();
Expand Down Expand Up @@ -322,7 +320,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Xcache, delete){
if (Z_TYPE_P(keys) == IS_ARRAY) {
PHALCON_INIT_VAR(zero);
ZVAL_LONG(zero, 0);
phalcon_array_unset(&keys, special_key, PH_SEPARATE);
phalcon_array_unset(&keys, prefixed_key, PH_SEPARATE);
phalcon_call_func_p3_noret("xcache_set", special_key, keys, zero);
}

Expand Down
20 changes: 18 additions & 2 deletions ext/forms/element.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,10 +824,26 @@ PHP_METHOD(Phalcon_Forms_Element, clear){
*/
PHP_METHOD(Phalcon_Forms_Element, __toString){


PHALCON_MM_GROW();

phalcon_call_method(return_value, this_ptr, "render");
if (phalcon_call_method_params(return_value, this_ptr, SL("render"), 0, NULL, zend_inline_hash_func(SS("render")), 1 TSRMLS_CC) == FAILURE) {
if (EG(exception)) {
zval *e = EG(exception);
zval *m = zend_read_property(Z_OBJCE_P(e), e, SL("message"), 1 TSRMLS_CC);

Z_ADDREF_P(m);
if (Z_TYPE_P(m) != IS_STRING) {
convert_to_string_ex(&m);
}

zend_clear_exception(TSRMLS_C);
zend_error(E_ERROR, "%s", Z_STRVAL_P(m));
zval_ptr_dtor(&m);
}

return;
}

RETURN_MM();
}

9 changes: 9 additions & 0 deletions ext/tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ static void phalcon_tag_write_attributes(zval *code, zval *attributes TSRMLS_DC)

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, attributes TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

if (escaper) {
for (
Expand Down Expand Up @@ -629,6 +632,9 @@ PHP_METHOD(Phalcon_Tag, _inputField){

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, params TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

phalcon_array_update_string(&params, SL("type"), &type, PH_COPY | PH_SEPARATE);

Expand Down Expand Up @@ -1163,6 +1169,9 @@ PHP_METHOD(Phalcon_Tag, textArea){

PHALCON_OBS_VAR(escaper);
phalcon_tag_get_escaper(&escaper, params TSRMLS_CC);
if (EG(exception)) {
RETURN_MM();
}

if (escaper) {
PHALCON_INIT_VAR(escaped);
Expand Down
11 changes: 11 additions & 0 deletions ext/tests/issue-1413.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
Phalcon\Forms\Element::toString() throws exceptions - https://github.com/phalcon/cphalcon/issues/1413
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
$e = new \Phalcon\Forms\Element\Text('name', array('value' => '&&&'));
echo $e, PHP_EOL;
?>
--EXPECTF--
Fatal error: A dependency injector container is required to obtain the "escaper" service in %s on line %d
Loading

0 comments on commit e9f8507

Please sign in to comment.