From 09d49705d7ea05027e17b48e4cbe8a4e867d09de Mon Sep 17 00:00:00 2001 From: phalcon Date: Thu, 11 Jul 2013 19:37:31 -0500 Subject: [PATCH] Taking advantage of return_value when possible, adding Forms\ElementInterface [ci skip] --- ext/cache/backend/apc.c | 7 +- ext/cache/backend/memcache.c | 15 +- ext/cache/backend/memory.c | 9 +- ext/cache/backend/mongo.c | 23 +- ext/cache/frontend/base64.c | 14 +- ext/cache/frontend/data.c | 14 +- ext/cache/frontend/igbinary.c | 14 +- ext/cache/frontend/json.c | 14 +- ext/config.m4 | 1 + ext/config.w32 | 2 +- ext/db/adapter.c | 4 +- ext/db/adapter/pdo.c | 4 +- ext/db/column.c | 9 +- ext/db/dialect/oracle.c | 12 +- ext/db/profiler/item.c | 8 +- ext/di/injectable.c | 2 +- ext/di/service.c | 9 +- ext/di/service/builder.c | 13 +- ext/escaper.c | 50 ++-- ext/flash.c | 34 ++- ext/forms/element.c | 6 +- ext/forms/element/check.c | 2 + ext/forms/element/date.c | 2 + ext/forms/element/email.c | 2 + ext/forms/element/file.c | 2 + ext/forms/element/hidden.c | 2 + ext/forms/element/numeric.c | 2 + ext/forms/element/password.c | 2 + ext/forms/element/select.c | 2 + ext/forms/element/submit.c | 2 + ext/forms/element/text.c | 2 + ext/forms/element/textarea.c | 2 + ext/forms/elementinterface.c | 282 +++++++++++++++++++++++ ext/forms/elementinterface.h | 136 +++++++++++ ext/forms/form.c | 9 +- ext/http/request/file.c | 8 +- ext/kernel/alternative/fcall.h | 4 +- ext/logger/adapter/file.c | 8 +- ext/logger/adapter/stream.c | 8 +- ext/logger/formatter/json.c | 7 +- ext/logger/formatter/line.c | 6 +- ext/logger/formatter/syslog.c | 15 +- ext/mvc/collection.c | 6 +- ext/mvc/collection/document.c | 6 +- ext/mvc/dispatcher.c | 14 +- ext/mvc/micro/collection.c | 64 ++---- ext/mvc/micro/lazyloader.c | 8 +- ext/mvc/model.c | 47 ++-- ext/mvc/model/query.c | 14 +- ext/mvc/model/resultset/complex.c | 2 +- ext/mvc/model/resultset/simple.c | 2 +- ext/mvc/model/row.c | 4 +- ext/mvc/model/validator.c | 6 +- ext/mvc/url.c | 13 +- ext/mvc/view/engine/volt.c | 36 ++- ext/mvc/view/engine/volt/compiler.c | 338 +++++++++++----------------- ext/phalcon.c | 280 +++++++++++------------ ext/phalcon.h | 111 ++++----- ext/queue/beanstalk.c | 35 ++- ext/validation.c | 4 +- ext/validation/message/group.c | 18 +- 61 files changed, 1018 insertions(+), 759 deletions(-) create mode 100644 ext/forms/elementinterface.c create mode 100644 ext/forms/elementinterface.h diff --git a/ext/cache/backend/apc.c b/ext/cache/backend/apc.c index 1cbb1f3c294..4a6d27b2e31 100644 --- a/ext/cache/backend/apc.c +++ b/ext/cache/backend/apc.c @@ -270,7 +270,6 @@ PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys){ #else zval *itkey = NULL; #endif - zend_object_iterator *it; PHALCON_MM_GROW(); @@ -305,7 +304,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys){ /* APCIterator implements Iterator */ assert(instanceof_function_ex(ce0, zend_ce_iterator, 1 TSRMLS_CC)); - it = ce0->get_iterator(ce0, iterator, 0 TSRMLS_CC); + zend_object_iterator* it = ce0->get_iterator(ce0, iterator, 0 TSRMLS_CC); /* APCIterator is an iterator */ assert(it != NULL); @@ -324,7 +323,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys){ * Note that str_key_len includes the trailing zero. * Remove the _PHCA prefix. */ - ZVAL_STRINGL(key, str_key+5, str_key_len-5-1, 1); + ZVAL_STRINGL(key, str_key + 5, str_key_len - 5 - 1, 1); phalcon_array_append(&keys, key, PH_SEPARATE); } @@ -332,7 +331,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys){ PHALCON_INIT_NVAR(itkey); it->funcs->get_current_key(it, itkey TSRMLS_CC); if (likely(Z_TYPE_P(itkey) == IS_STRING)) { - ZVAL_STRINGL(key, Z_STRVAL_P(itkey)+5, Z_STRLEN_P(itkey)-5, 1); + ZVAL_STRINGL(key, Z_STRVAL_P(itkey) + 5, Z_STRLEN_P(itkey) - 5, 1); phalcon_array_append(&keys, key, PH_SEPARATE); } #endif diff --git a/ext/cache/backend/memcache.c b/ext/cache/backend/memcache.c index 4aa24fa1973..deb09f2efd7 100644 --- a/ext/cache/backend/memcache.c +++ b/ext/cache/backend/memcache.c @@ -189,7 +189,6 @@ PHP_METHOD(Phalcon_Cache_Backend_Memcache, get){ zval *key_name, *lifetime = NULL, *memcache = NULL, *frontend; zval *prefix, *prefixed_key, *cached_content; - zval *content; PHALCON_MM_GROW(); @@ -224,10 +223,8 @@ PHP_METHOD(Phalcon_Cache_Backend_Memcache, get){ RETURN_MM_NULL(); } - PHALCON_INIT_VAR(content); - phalcon_call_method_p1(content, frontend, "afterretrieve", cached_content); - - RETURN_CCTOR(content); + phalcon_call_method_p1(return_value, frontend, "afterretrieve", cached_content); + RETURN_MM(); } /** @@ -373,7 +370,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Memcache, save){ PHP_METHOD(Phalcon_Cache_Backend_Memcache, delete){ zval *key_name, *memcache = NULL, *prefix, *prefixed_key; - zval *options, *special_key, *keys, *success; + zval *options, *special_key, *keys; PHALCON_MM_GROW(); @@ -410,10 +407,8 @@ PHP_METHOD(Phalcon_Cache_Backend_Memcache, delete){ /** * Delete the key from memcached */ - PHALCON_INIT_VAR(success); - phalcon_call_method_p1(success, memcache, "delete", prefixed_key); - - RETURN_CCTOR(success); + phalcon_call_method_p1(return_value, memcache, "delete", prefixed_key); + RETURN_MM(); } /** diff --git a/ext/cache/backend/memory.c b/ext/cache/backend/memory.c index 6f771c8acf9..181f6a1f9ed 100644 --- a/ext/cache/backend/memory.c +++ b/ext/cache/backend/memory.c @@ -84,7 +84,7 @@ PHALCON_INIT_CLASS(Phalcon_Cache_Backend_Memory){ PHP_METHOD(Phalcon_Cache_Backend_Memory, get){ zval *key_name, *lifetime = NULL, *last_key = NULL, *prefix, *data; - zval *cached_content, *frontend, *processed; + zval *cached_content, *frontend; PHALCON_MM_GROW(); @@ -119,11 +119,8 @@ PHP_METHOD(Phalcon_Cache_Backend_Memory, get){ PHALCON_OBS_VAR(frontend); phalcon_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC); - - PHALCON_INIT_VAR(processed); - phalcon_call_method_p1(processed, frontend, "afterretrieve", cached_content); - - RETURN_CCTOR(processed); + phalcon_call_method_p1(return_value, frontend, "afterretrieve", cached_content); + RETURN_MM(); } /** diff --git a/ext/cache/backend/mongo.c b/ext/cache/backend/mongo.c index 527b3121883..aa631b7b301 100644 --- a/ext/cache/backend/mongo.c +++ b/ext/cache/backend/mongo.c @@ -217,7 +217,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Mongo, get){ zval *key_name, *lifetime = NULL, *frontend, *prefix, *prefixed_key; zval *collection, *conditions, *document, *timestamp; zval *ttl = NULL, *modified_time, *difference, *not_expired; - zval *cached_content, *content; + zval *cached_content; PHALCON_MM_GROW(); @@ -295,11 +295,8 @@ PHP_METHOD(Phalcon_Cache_Backend_Mongo, get){ PHALCON_OBS_VAR(cached_content); phalcon_array_fetch_string(&cached_content, document, SL("data"), PH_NOISY); - - PHALCON_INIT_VAR(content); - phalcon_call_method_p1(content, frontend, "afterretrieve", cached_content); - - RETURN_CCTOR(content); + phalcon_call_method_p1(return_value, frontend, "afterretrieve", cached_content); + RETURN_MM(); } } @@ -427,7 +424,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Mongo, save){ PHP_METHOD(Phalcon_Cache_Backend_Mongo, delete){ zval *key_name, *prefix, *prefixed_key, *collection; - zval *conditions, *success; + zval *conditions; PHALCON_MM_GROW(); @@ -445,9 +442,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Mongo, delete){ PHALCON_INIT_VAR(conditions); array_init_size(conditions, 1); phalcon_array_update_string(&conditions, SL("key"), &prefixed_key, PH_COPY | PH_SEPARATE); - - PHALCON_INIT_VAR(success); - phalcon_call_method_p1(success, collection, "remove", conditions); + phalcon_call_method_p1_noret(collection, "remove", conditions); RETURN_MM_TRUE; } @@ -539,7 +534,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Mongo, queryKeys){ PHP_METHOD(Phalcon_Cache_Backend_Mongo, exists){ zval *key_name = NULL, *lifetime = NULL, *last_key = NULL, *prefix, *collection; - zval *conditions, *number, *zero, *exists; + zval *conditions, *number, *zero; PHALCON_MM_GROW(); @@ -576,10 +571,8 @@ PHP_METHOD(Phalcon_Cache_Backend_Mongo, exists){ PHALCON_INIT_VAR(zero); ZVAL_LONG(zero, 0); - - PHALCON_INIT_VAR(exists); - is_smaller_function(exists, zero, number TSRMLS_CC); - RETURN_NCTOR(exists); + is_smaller_function(return_value, zero, number TSRMLS_CC); + RETURN_MM(); } RETURN_MM_FALSE; diff --git a/ext/cache/frontend/base64.c b/ext/cache/frontend/base64.c index 3aca3d8a5f3..0ea346e3616 100644 --- a/ext/cache/frontend/base64.c +++ b/ext/cache/frontend/base64.c @@ -182,15 +182,14 @@ PHP_METHOD(Phalcon_Cache_Frontend_Base64, stop){ */ PHP_METHOD(Phalcon_Cache_Frontend_Base64, beforeStore){ - zval *data, *serialized; + zval *data; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &data); - PHALCON_INIT_VAR(serialized); - phalcon_base64_encode(serialized, data); - RETURN_CTOR(serialized); + phalcon_base64_encode(return_value, data); + RETURN_MM(); } /** @@ -201,14 +200,13 @@ PHP_METHOD(Phalcon_Cache_Frontend_Base64, beforeStore){ */ PHP_METHOD(Phalcon_Cache_Frontend_Base64, afterRetrieve){ - zval *data, *unserialized; + zval *data; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &data); - PHALCON_INIT_VAR(unserialized); - phalcon_base64_decode(unserialized, data); - RETURN_CTOR(unserialized); + phalcon_base64_decode(return_value, data); + RETURN_MM(); } diff --git a/ext/cache/frontend/data.c b/ext/cache/frontend/data.c index 10be197ad16..c6cb9a69b14 100644 --- a/ext/cache/frontend/data.c +++ b/ext/cache/frontend/data.c @@ -186,15 +186,14 @@ PHP_METHOD(Phalcon_Cache_Frontend_Data, stop){ */ PHP_METHOD(Phalcon_Cache_Frontend_Data, beforeStore){ - zval *data, *serialized; + zval *data; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &data); - PHALCON_INIT_VAR(serialized); - phalcon_serialize(serialized, &data TSRMLS_CC); - RETURN_CTOR(serialized); + phalcon_serialize(return_value, &data TSRMLS_CC); + RETURN_MM(); } /** @@ -205,14 +204,13 @@ PHP_METHOD(Phalcon_Cache_Frontend_Data, beforeStore){ */ PHP_METHOD(Phalcon_Cache_Frontend_Data, afterRetrieve){ - zval *data, *unserialized; + zval *data; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &data); - PHALCON_INIT_VAR(unserialized); - phalcon_unserialize(unserialized, data TSRMLS_CC); - RETURN_CTOR(unserialized); + phalcon_unserialize(return_value, data TSRMLS_CC); + RETURN_MM(); } diff --git a/ext/cache/frontend/igbinary.c b/ext/cache/frontend/igbinary.c index d8b8db8203f..58e0d0d0c23 100644 --- a/ext/cache/frontend/igbinary.c +++ b/ext/cache/frontend/igbinary.c @@ -95,15 +95,14 @@ PHALCON_INIT_CLASS(Phalcon_Cache_Frontend_Igbinary){ */ PHP_METHOD(Phalcon_Cache_Frontend_Igbinary, beforeStore){ - zval *data, *serialized; + zval *data; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &data); - PHALCON_INIT_VAR(serialized); - phalcon_call_func_p1(serialized, "igbinary_serialize", data); - RETURN_CCTOR(serialized); + phalcon_call_func_p1(return_value, "igbinary_serialize", data); + RETURN_MM(); } /** @@ -114,14 +113,13 @@ PHP_METHOD(Phalcon_Cache_Frontend_Igbinary, beforeStore){ */ PHP_METHOD(Phalcon_Cache_Frontend_Igbinary, afterRetrieve){ - zval *data, *unserialized; + zval *data; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &data); - PHALCON_INIT_VAR(unserialized); - phalcon_call_func_p1(unserialized, "igbinary_unserialize", data); - RETURN_CCTOR(unserialized); + phalcon_call_func_p1(return_value, "igbinary_unserialize", data); + RETURN_MM(); } diff --git a/ext/cache/frontend/json.c b/ext/cache/frontend/json.c index 9784d8568e0..0b294aeecaa 100644 --- a/ext/cache/frontend/json.c +++ b/ext/cache/frontend/json.c @@ -178,15 +178,14 @@ PHP_METHOD(Phalcon_Cache_Frontend_Json, stop){ */ PHP_METHOD(Phalcon_Cache_Frontend_Json, beforeStore){ - zval *data, *serialized; + zval *data; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &data); - PHALCON_INIT_VAR(serialized); - phalcon_call_func_p1(serialized, "json_encode", data); - RETURN_CCTOR(serialized); + phalcon_call_func_p1(return_value, "json_encode", data); + RETURN_MM(); } /** @@ -197,14 +196,13 @@ PHP_METHOD(Phalcon_Cache_Frontend_Json, beforeStore){ */ PHP_METHOD(Phalcon_Cache_Frontend_Json, afterRetrieve){ - zval *data, *unserialized; + zval *data; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &data); - PHALCON_INIT_VAR(unserialized); - phalcon_call_func_p1(unserialized, "json_decode", data); - RETURN_CCTOR(unserialized); + phalcon_call_func_p1(return_value, "json_decode", data); + RETURN_MM(); } diff --git a/ext/config.m4 b/ext/config.m4 index 31d7a8597d8..9a51870b1cf 100755 --- a/ext/config.m4 +++ b/ext/config.m4 @@ -75,6 +75,7 @@ forms/element/submit.c \ forms/element/date.c \ forms/exception.c \ forms/element.c \ +forms/elementinterface.c \ http/response.c \ http/requestinterface.c \ http/request.c \ diff --git a/ext/config.w32 b/ext/config.w32 index 8eb5018daf1..265983a2db5 100755 --- a/ext/config.w32 +++ b/ext/config.w32 @@ -20,7 +20,7 @@ if (PHP_PHALCON != "no") { ADD_SOURCES("ext/phalcon/db/profiler", "item.c", "phalcon") ADD_SOURCES("ext/phalcon/db/adapter/pdo", "sqlite.c mysql.c oracle.c postgresql.c", "phalcon") ADD_SOURCES("ext/phalcon/db/adapter", "pdo.c", "phalcon") - ADD_SOURCES("ext/phalcon/forms", "form.c manager.c exception.c element.c", "phalcon") + ADD_SOURCES("ext/phalcon/forms", "form.c manager.c exception.c element.c elementinterface.c", "phalcon") ADD_SOURCES("ext/phalcon/forms/element", "file.c email.c hidden.c password.c text.c select.c textarea.c check.c numeric.c submit.c date.c", "phalcon") ADD_SOURCES("ext/phalcon/http", "response.c requestinterface.c request.c cookie.c responseinterface.c", "phalcon") ADD_SOURCES("ext/phalcon/http/request", "file.c exception.c fileinterface.c", "phalcon") diff --git a/ext/db/adapter.c b/ext/db/adapter.c index 263753c4714..b6b67c753cd 100644 --- a/ext/db/adapter.c +++ b/ext/db/adapter.c @@ -637,7 +637,7 @@ PHP_METHOD(Phalcon_Db_Adapter, update){ if (phalcon_array_isset_string(where_condition, SS("bind"))) { PHALCON_OBS_VAR(where_bind); phalcon_array_fetch_string(&where_bind, where_condition, SL("bind"), PH_NOISY); - phalcon_merge_append(update_values, where_bind); + phalcon_merge_append(update_values, where_bind TSRMLS_CC); } /** @@ -647,7 +647,7 @@ PHP_METHOD(Phalcon_Db_Adapter, update){ if (phalcon_array_isset_string(where_condition, SS("bindTypes"))) { PHALCON_OBS_VAR(where_types); phalcon_array_fetch_string(&where_types, where_condition, SL("bindTypes"), PH_NOISY); - phalcon_merge_append(bind_data_types, where_types); + phalcon_merge_append(bind_data_types, where_types TSRMLS_CC); } } } else { diff --git a/ext/db/adapter/pdo.c b/ext/db/adapter/pdo.c index 642cab9e986..50566f43a4a 100644 --- a/ext/db/adapter/pdo.c +++ b/ext/db/adapter/pdo.c @@ -185,7 +185,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, connect){ PHALCON_INIT_VAR(dsn_parts); array_init(dsn_parts); - if (!phalcon_is_iterable_ex(descriptor, &ah0, &hp0, 0, 0)) { + if (!phalcon_is_iterable_ex(descriptor, &ah0, &hp0, 0, 0 TSRMLS_CC)) { return; } @@ -302,7 +302,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared){ PHALCON_INIT_VAR(one); ZVAL_LONG(one, 1); - if (!phalcon_is_iterable_ex(placeholders, &ah0, &hp0, 0, 0)) { + if (!phalcon_is_iterable_ex(placeholders, &ah0, &hp0, 0, 0 TSRMLS_CC)) { return; } diff --git a/ext/db/column.c b/ext/db/column.c index b9f47865083..b5250d1e36e 100644 --- a/ext/db/column.c +++ b/ext/db/column.c @@ -400,7 +400,7 @@ PHP_METHOD(Phalcon_Db_Column, __set_state){ zval *data, *definition, *column_name, *column_type; zval *not_null, *primary, *size, *dunsigned, *after; - zval *is_numeric, *first, *bind_type, *column; + zval *is_numeric, *first, *bind_type; PHALCON_MM_GROW(); @@ -474,10 +474,9 @@ PHP_METHOD(Phalcon_Db_Column, __set_state){ phalcon_array_update_string(&definition, SL("bindType"), &bind_type, PH_COPY | PH_SEPARATE); } - PHALCON_INIT_VAR(column); - object_init_ex(column, phalcon_db_column_ce); - phalcon_call_method_p2_noret(column, "__construct", column_name, definition); + object_init_ex(return_value, phalcon_db_column_ce); + phalcon_call_method_p2_noret(return_value, "__construct", column_name, definition); - RETURN_CTOR(column); + RETURN_MM(); } diff --git a/ext/db/dialect/oracle.c b/ext/db/dialect/oracle.c index 66ed9bd4043..0cfe78f3b0b 100644 --- a/ext/db/dialect/oracle.c +++ b/ext/db/dialect/oracle.c @@ -892,7 +892,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Oracle, select){ PHALCON_INIT_VAR(selected_columns); array_init(selected_columns); - if (!phalcon_is_iterable_ex(columns, &ah0, &hp0, 0, 0)) { + if (!phalcon_is_iterable_ex(columns, &ah0, &hp0, 0, 0 TSRMLS_CC)) { return; } @@ -986,7 +986,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Oracle, select){ PHALCON_INIT_VAR(selected_tables); array_init(selected_tables); - if (!phalcon_is_iterable_ex(tables, &ah1, &hp1, 0, 0)) { + if (!phalcon_is_iterable_ex(tables, &ah1, &hp1, 0, 0 TSRMLS_CC)) { return; } @@ -1018,7 +1018,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Oracle, select){ PHALCON_OBS_VAR(joins); phalcon_array_fetch_string(&joins, definition, SL("joins"), PH_NOISY); - if (!phalcon_is_iterable_ex(joins, &ah2, &hp2, 0, 0)) { + if (!phalcon_is_iterable_ex(joins, &ah2, &hp2, 0, 0 TSRMLS_CC)) { return; } @@ -1051,7 +1051,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Oracle, select){ PHALCON_INIT_NVAR(join_expressions); array_init(join_expressions); - if (!phalcon_is_iterable_ex(join_conditions_array, &ah3, &hp3, 0, 0)) { + if (!phalcon_is_iterable_ex(join_conditions_array, &ah3, &hp3, 0, 0 TSRMLS_CC)) { return; } @@ -1106,7 +1106,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Oracle, select){ PHALCON_OBS_VAR(group_fields); phalcon_array_fetch_string(&group_fields, definition, SL("group"), PH_NOISY); - if (!phalcon_is_iterable_ex(group_fields, &ah4, &hp4, 0, 0)) { + if (!phalcon_is_iterable_ex(group_fields, &ah4, &hp4, 0, 0 TSRMLS_CC)) { return; } @@ -1152,7 +1152,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Oracle, select){ PHALCON_INIT_VAR(order_items); array_init(order_items); - if (!phalcon_is_iterable_ex(order_fields, &ah5, &hp5, 0, 0)) { + if (!phalcon_is_iterable_ex(order_fields, &ah5, &hp5, 0, 0 TSRMLS_CC)) { return; } diff --git a/ext/db/profiler/item.c b/ext/db/profiler/item.c index 975a098174c..afcdcd1435d 100644 --- a/ext/db/profiler/item.c +++ b/ext/db/profiler/item.c @@ -141,7 +141,7 @@ PHP_METHOD(Phalcon_Db_Profiler_Item, getFinalTime){ */ PHP_METHOD(Phalcon_Db_Profiler_Item, getTotalElapsedSeconds){ - zval *final_time, *initial_time, *elapsed; + zval *final_time, *initial_time; PHALCON_MM_GROW(); @@ -150,9 +150,7 @@ PHP_METHOD(Phalcon_Db_Profiler_Item, getTotalElapsedSeconds){ PHALCON_OBS_VAR(initial_time); phalcon_read_property_this(&initial_time, this_ptr, SL("_initialTime"), PH_NOISY_CC); - - PHALCON_INIT_VAR(elapsed); - sub_function(elapsed, final_time, initial_time TSRMLS_CC); - RETURN_CTOR(elapsed); + sub_function(return_value, final_time, initial_time TSRMLS_CC); + RETURN_MM(); } diff --git a/ext/di/injectable.c b/ext/di/injectable.c index bd9d3389bf4..75015a5250b 100644 --- a/ext/di/injectable.c +++ b/ext/di/injectable.c @@ -183,7 +183,7 @@ PHP_METHOD(Phalcon_DI_Injectable, __get){ PHALCON_INIT_VAR(arguments); array_init_size(arguments, 1); - phalcon_array_append(&arguments, class_name, PH_SEPARATE); + phalcon_array_append(&arguments, class_name, PH_SEPARATE TSRMLS_CC); PHALCON_INIT_NVAR(service); ZVAL_STRING(service, "sessionBag", 1); diff --git a/ext/di/service.c b/ext/di/service.c index f50873fc36b..02dfe380211 100644 --- a/ext/di/service.c +++ b/ext/di/service.c @@ -413,7 +413,7 @@ PHP_METHOD(Phalcon_DI_Service, getParameter){ */ PHP_METHOD(Phalcon_DI_Service, __set_state){ - zval *attributes, *name, *definition, *shared, *service; + zval *attributes, *name, *definition, *shared; PHALCON_MM_GROW(); @@ -442,10 +442,9 @@ PHP_METHOD(Phalcon_DI_Service, __set_state){ return; } - PHALCON_INIT_VAR(service); - object_init_ex(service, phalcon_di_service_ce); - phalcon_call_method_p3_noret(service, "__construct", name, definition, shared); + object_init_ex(return_value, phalcon_di_service_ce); + phalcon_call_method_p3_noret(return_value, "__construct", name, definition, shared); - RETURN_CTOR(service); + RETURN_MM(); } diff --git a/ext/di/service/builder.c b/ext/di/service/builder.c index 68f478cd497..0e3e96f2ffb 100644 --- a/ext/di/service/builder.c +++ b/ext/di/service/builder.c @@ -115,11 +115,8 @@ PHP_METHOD(Phalcon_DI_Service_Builder, _buildParameter){ PHALCON_OBS_VAR(name); phalcon_array_fetch_string(&name, argument, SL("name"), PH_NOISY); - - PHALCON_INIT_VAR(value); - phalcon_call_method_p1(value, dependency_injector, "get", name); - - RETURN_CCTOR(value); + phalcon_call_method_p1(return_value, dependency_injector, "get", name); + RETURN_MM(); } /** @@ -133,7 +130,7 @@ PHP_METHOD(Phalcon_DI_Service_Builder, _buildParameter){ return; } - PHALCON_OBS_NVAR(value); + PHALCON_OBS_VAR(value); phalcon_array_fetch_string(&value, argument, SL("value"), PH_NOISY); RETURN_CCTOR(value); @@ -169,8 +166,8 @@ PHP_METHOD(Phalcon_DI_Service_Builder, _buildParameter){ /** * Build the instance with arguments */ - PHALCON_INIT_NVAR(value); - phalcon_call_method_p2(value, dependency_injector, "get", name, instance_arguments); + phalcon_call_method_p2(return_value, dependency_injector, "get", name, instance_arguments); + RETURN_MM(); } RETURN_CCTOR(value); diff --git a/ext/escaper.c b/ext/escaper.c index 5d6b7067423..678256b67ad 100644 --- a/ext/escaper.c +++ b/ext/escaper.c @@ -228,10 +228,8 @@ PHP_METHOD(Phalcon_Escaper, detectEncoding){ /** * Fallback to global detection */ - PHALCON_INIT_NVAR(charset); - phalcon_call_func_p1(charset, "mb_detect_encoding", str); - - RETURN_CCTOR(charset); + phalcon_call_func_p1(return_value, "mb_detect_encoding", str); + RETURN_MM(); } /** @@ -242,7 +240,7 @@ PHP_METHOD(Phalcon_Escaper, detectEncoding){ */ PHP_METHOD(Phalcon_Escaper, normalizeEncoding){ - zval *str, *encoding, *charset, *encoded; + zval *str, *encoding, *charset; PHALCON_MM_GROW(); @@ -266,10 +264,8 @@ PHP_METHOD(Phalcon_Escaper, normalizeEncoding){ * Convert to UTF-32 (4 byte characters, regardless of actual number of bytes in * the character). */ - PHALCON_INIT_VAR(encoded); - phalcon_call_func_p3(encoded, "mb_convert_encoding", str, charset, encoding); - - RETURN_CCTOR(encoded); + phalcon_call_func_p3(return_value, "mb_convert_encoding", str, charset, encoding); + RETURN_MM(); } /** @@ -280,7 +276,7 @@ PHP_METHOD(Phalcon_Escaper, normalizeEncoding){ */ PHP_METHOD(Phalcon_Escaper, escapeHtml){ - zval *text, *html_quote_type, *encoding, *escaped; + zval *text, *html_quote_type, *encoding; PHALCON_MM_GROW(); @@ -292,10 +288,8 @@ PHP_METHOD(Phalcon_Escaper, escapeHtml){ PHALCON_OBS_VAR(encoding); phalcon_read_property_this(&encoding, this_ptr, SL("_encoding"), PH_NOISY_CC); - - PHALCON_INIT_VAR(escaped); - phalcon_call_func_p3(escaped, "htmlspecialchars", text, html_quote_type, encoding); - RETURN_CCTOR(escaped); + phalcon_call_func_p3(return_value, "htmlspecialchars", text, html_quote_type, encoding); + RETURN_MM(); } RETURN_MM_NULL(); } @@ -308,7 +302,7 @@ PHP_METHOD(Phalcon_Escaper, escapeHtml){ */ PHP_METHOD(Phalcon_Escaper, escapeHtmlAttr){ - zval *attribute, *normalized, *sanitized; + zval *attribute, *normalized; PHALCON_MM_GROW(); @@ -325,9 +319,8 @@ PHP_METHOD(Phalcon_Escaper, escapeHtmlAttr){ /** * Escape the string */ - PHALCON_INIT_VAR(sanitized); - phalcon_escape_htmlattr(sanitized, normalized); - RETURN_CTOR(sanitized); + phalcon_escape_htmlattr(return_value, normalized); + RETURN_MM(); } } RETURN_MM_NULL(); @@ -341,7 +334,7 @@ PHP_METHOD(Phalcon_Escaper, escapeHtmlAttr){ */ PHP_METHOD(Phalcon_Escaper, escapeCss){ - zval *css, *normalized, *sanitized; + zval *css, *normalized; PHALCON_MM_GROW(); @@ -358,9 +351,8 @@ PHP_METHOD(Phalcon_Escaper, escapeCss){ /** * Escape the string */ - PHALCON_INIT_VAR(sanitized); - phalcon_escape_css(sanitized, normalized); - RETURN_CTOR(sanitized); + phalcon_escape_css(return_value, normalized); + RETURN_MM(); } } RETURN_MM_NULL(); @@ -374,7 +366,7 @@ PHP_METHOD(Phalcon_Escaper, escapeCss){ */ PHP_METHOD(Phalcon_Escaper, escapeJs){ - zval *js, *normalized, *sanitized; + zval *js, *normalized; PHALCON_MM_GROW(); @@ -391,9 +383,8 @@ PHP_METHOD(Phalcon_Escaper, escapeJs){ /** * Escape the string */ - PHALCON_INIT_VAR(sanitized); - phalcon_escape_js(sanitized, normalized); - RETURN_CTOR(sanitized); + phalcon_escape_js(return_value, normalized); + RETURN_MM(); } } RETURN_MM_NULL(); @@ -409,8 +400,11 @@ PHP_METHOD(Phalcon_Escaper, escapeUrl){ zval *url; - phalcon_fetch_params(0, 1, 0, &url); + PHALCON_MM_GROW(); + + phalcon_fetch_params(1, 1, 0, &url); - phalcon_raw_url_encode(return_value, url); + phalcon_raw_url_encode(return_value, url TSRMLS_CC); + RETURN_MM(); } diff --git a/ext/flash.c b/ext/flash.c index 8ea6c3d09b8..36324390ac2 100755 --- a/ext/flash.c +++ b/ext/flash.c @@ -162,7 +162,7 @@ PHP_METHOD(Phalcon_Flash, setCssClasses){ */ PHP_METHOD(Phalcon_Flash, error){ - zval *message, *type, *flash_message; + zval *message, *type; PHALCON_MM_GROW(); @@ -170,10 +170,8 @@ PHP_METHOD(Phalcon_Flash, error){ PHALCON_INIT_VAR(type); ZVAL_STRING(type, "error", 1); - - PHALCON_INIT_VAR(flash_message); - phalcon_call_method_p2(flash_message, this_ptr, "message", type, message); - RETURN_CCTOR(flash_message); + phalcon_call_method_p2(return_value, this_ptr, "message", type, message); + RETURN_MM(); } /** @@ -188,7 +186,7 @@ PHP_METHOD(Phalcon_Flash, error){ */ PHP_METHOD(Phalcon_Flash, notice){ - zval *message, *type, *flash_message; + zval *message, *type; PHALCON_MM_GROW(); @@ -196,10 +194,8 @@ PHP_METHOD(Phalcon_Flash, notice){ PHALCON_INIT_VAR(type); ZVAL_STRING(type, "notice", 1); - - PHALCON_INIT_VAR(flash_message); - phalcon_call_method_p2(flash_message, this_ptr, "message", type, message); - RETURN_CCTOR(flash_message); + phalcon_call_method_p2(return_value, this_ptr, "message", type, message); + RETURN_MM(); } /** @@ -214,7 +210,7 @@ PHP_METHOD(Phalcon_Flash, notice){ */ PHP_METHOD(Phalcon_Flash, success){ - zval *message, *type, *flash_message; + zval *message, *type; PHALCON_MM_GROW(); @@ -222,10 +218,8 @@ PHP_METHOD(Phalcon_Flash, success){ PHALCON_INIT_VAR(type); ZVAL_STRING(type, "success", 1); - - PHALCON_INIT_VAR(flash_message); - phalcon_call_method_p2(flash_message, this_ptr, "message", type, message); - RETURN_CCTOR(flash_message); + phalcon_call_method_p2(return_value, this_ptr, "message", type, message); + RETURN_MM(); } /** @@ -240,7 +234,7 @@ PHP_METHOD(Phalcon_Flash, success){ */ PHP_METHOD(Phalcon_Flash, warning){ - zval *message, *type, *flash_message; + zval *message, *type; PHALCON_MM_GROW(); @@ -248,10 +242,8 @@ PHP_METHOD(Phalcon_Flash, warning){ PHALCON_INIT_VAR(type); ZVAL_STRING(type, "warning", 1); - - PHALCON_INIT_VAR(flash_message); - phalcon_call_method_p2(flash_message, this_ptr, "message", type, message); - RETURN_CCTOR(flash_message); + phalcon_call_method_p2(return_value, this_ptr, "message", type, message); + RETURN_MM(); } /** @@ -289,7 +281,7 @@ PHP_METHOD(Phalcon_Flash, outputMessage){ if (phalcon_array_isset(classes, type)) { PHALCON_OBS_VAR(type_classes); - phalcon_array_fetch(&type_classes, classes, type, PH_NOISY); + phalcon_array_fetch(&type_classes, classes, type, PH_NOISY_CC); if (Z_TYPE_P(type_classes) == IS_ARRAY) { PHALCON_INIT_VAR(joined_classes); phalcon_fast_join_str(joined_classes, SL(" "), type_classes TSRMLS_CC); diff --git a/ext/forms/element.c b/ext/forms/element.c index 2779b03df02..2231ded2ca2 100644 --- a/ext/forms/element.c +++ b/ext/forms/element.c @@ -817,12 +817,10 @@ PHP_METHOD(Phalcon_Forms_Element, clear){ */ PHP_METHOD(Phalcon_Forms_Element, __toString){ - zval *content; PHALCON_MM_GROW(); - PHALCON_INIT_VAR(content); - phalcon_call_method(content, this_ptr, "render"); - RETURN_CCTOR(content); + phalcon_call_method(return_value, this_ptr, "render"); + RETURN_MM(); } diff --git a/ext/forms/element/check.c b/ext/forms/element/check.c index 3ad606ae825..a86a95c86b0 100644 --- a/ext/forms/element/check.c +++ b/ext/forms/element/check.c @@ -48,6 +48,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_Check){ PHALCON_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Check, forms_element_check, "phalcon\\forms\\element", phalcon_forms_element_check_method_entry, 0); + zend_class_implements(phalcon_forms_element_check_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/element/date.c b/ext/forms/element/date.c index ed45a030eac..087bb1fd19c 100644 --- a/ext/forms/element/date.c +++ b/ext/forms/element/date.c @@ -48,6 +48,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_Date){ PHALCON_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Date, forms_element_date, "phalcon\\forms\\element", phalcon_forms_element_date_method_entry, 0); + zend_class_implements(phalcon_forms_element_date_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/element/email.c b/ext/forms/element/email.c index 7749602ed42..ec3410ed4d0 100644 --- a/ext/forms/element/email.c +++ b/ext/forms/element/email.c @@ -48,6 +48,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_Email){ PHALCON_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Email, forms_element_email, "phalcon\\forms\\element", phalcon_forms_element_email_method_entry, 0); + zend_class_implements(phalcon_forms_element_email_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/element/file.c b/ext/forms/element/file.c index c47354a3b9a..e38a0ef07a1 100644 --- a/ext/forms/element/file.c +++ b/ext/forms/element/file.c @@ -48,6 +48,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_File){ PHALCON_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, File, forms_element_file, "phalcon\\forms\\element", phalcon_forms_element_file_method_entry, 0); + zend_class_implements(phalcon_forms_element_file_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/element/hidden.c b/ext/forms/element/hidden.c index d68359a1c72..1ef4cf75121 100644 --- a/ext/forms/element/hidden.c +++ b/ext/forms/element/hidden.c @@ -48,6 +48,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_Hidden){ PHALCON_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Hidden, forms_element_hidden, "phalcon\\forms\\element", phalcon_forms_element_hidden_method_entry, 0); + zend_class_implements(phalcon_forms_element_hidden_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/element/numeric.c b/ext/forms/element/numeric.c index 5ee5fff7cc2..2af89589937 100644 --- a/ext/forms/element/numeric.c +++ b/ext/forms/element/numeric.c @@ -48,6 +48,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_Numeric){ PHALCON_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Numeric, forms_element_numeric, "phalcon\\forms\\element", phalcon_forms_element_numeric_method_entry, 0); + zend_class_implements(phalcon_forms_element_numeric_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/element/password.c b/ext/forms/element/password.c index ae3b38e3d37..87274b1901a 100644 --- a/ext/forms/element/password.c +++ b/ext/forms/element/password.c @@ -48,6 +48,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_Password){ PHALCON_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Password, forms_element_password, "phalcon\\forms\\element", phalcon_forms_element_password_method_entry, 0); + zend_class_implements(phalcon_forms_element_password_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/element/select.c b/ext/forms/element/select.c index d59a6d4764e..72d6c9a6ad8 100644 --- a/ext/forms/element/select.c +++ b/ext/forms/element/select.c @@ -51,6 +51,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_Select){ zend_declare_property_null(phalcon_forms_element_select_ce, SL("_optionsValues"), ZEND_ACC_PROTECTED TSRMLS_CC); + zend_class_implements(phalcon_forms_element_select_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/element/submit.c b/ext/forms/element/submit.c index 7dc7469c09c..c19108a4278 100644 --- a/ext/forms/element/submit.c +++ b/ext/forms/element/submit.c @@ -48,6 +48,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_Submit){ PHALCON_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Submit, forms_element_submit, "phalcon\\forms\\element", phalcon_forms_element_submit_method_entry, 0); + zend_class_implements(phalcon_forms_element_submit_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/element/text.c b/ext/forms/element/text.c index 1e53b1948d3..a84592f8f5f 100644 --- a/ext/forms/element/text.c +++ b/ext/forms/element/text.c @@ -48,6 +48,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_Text){ PHALCON_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, Text, forms_element_text, "phalcon\\forms\\element", phalcon_forms_element_text_method_entry, 0); + zend_class_implements(phalcon_forms_element_text_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/element/textarea.c b/ext/forms/element/textarea.c index ee5446b11ce..54a6ca72d24 100644 --- a/ext/forms/element/textarea.c +++ b/ext/forms/element/textarea.c @@ -48,6 +48,8 @@ PHALCON_INIT_CLASS(Phalcon_Forms_Element_TextArea){ PHALCON_REGISTER_CLASS_EX(Phalcon\\Forms\\Element, TextArea, forms_element_textarea, "phalcon\\forms\\element", phalcon_forms_element_textarea_method_entry, 0); + zend_class_implements(phalcon_forms_element_textarea_ce TSRMLS_CC, 1, phalcon_forms_elementinterface_ce); + return SUCCESS; } diff --git a/ext/forms/elementinterface.c b/ext/forms/elementinterface.c new file mode 100644 index 00000000000..64f012bf951 --- /dev/null +++ b/ext/forms/elementinterface.c @@ -0,0 +1,282 @@ + +/* + +------------------------------------------------------------------------+ + | Phalcon Framework | + +------------------------------------------------------------------------+ + | Copyright (c) 2011-2013 Phalcon Team (http://www.phalconphp.com) | + +------------------------------------------------------------------------+ + | This source file is subject to the New BSD License that is bundled | + | with this package in the file docs/LICENSE.txt. | + | | + | If you did not receive a copy of the license and are unable to | + | obtain it through the world-wide-web, please send an email | + | to license@phalconphp.com so we can send you a copy immediately. | + +------------------------------------------------------------------------+ + | Authors: Andres Gutierrez | + | Eduar Carvajal | + +------------------------------------------------------------------------+ +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#include "php_phalcon.h" +#include "phalcon.h" + +#include "kernel/main.h" + +/** + * Phalcon\Forms\ElementInterface initializer + */ +PHALCON_INIT_CLASS(Phalcon_Forms_ElementInterface){ + + PHALCON_REGISTER_INTERFACE(Phalcon\\Forms, ElementInterface, forms_elementinterface, phalcon_forms_elementinterface_method_entry); + + return SUCCESS; +} + +/** + * Sets the parent form to the element + * + * @param Phalcon\Forms\Form $form + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, setForm); + +/** + * Returns the parent form to the element + * + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getForm); + +/** + * Sets the element's name + * + * @param string $name + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, setName); + +/** + * Returns the element's name + * + * @return string + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getName); + +/** + * Sets the element's filters + * + * @param array|string $filters + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, setFilters); + +/** + * Adds a filter to current list of filters + * + * @param string $filter + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, addFilter); + +/** + * Returns the element's filters + * + * @return mixed + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getFilters); + +/** + * Adds a group of validators + * + * @param Phalcon\Validation\ValidatorInterface[] + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, addValidators); + +/** + * Adds a validator to the element + * + * @param Phalcon\Validation\ValidatorInterface + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, addValidator); + +/** + * Returns the validators registered for the element + * + * @return Phalcon\Validation\ValidatorInterface[] + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getValidators); + +/** + * Returns an array of prepared attributes for Phalcon\Tag helpers + * according to the element's parameters + * + * @param array $attributes + * @param boolean $useChecked + * @return array + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, prepareAttributes); + +/** + * Sets a default attribute for the element + * + * @param string $attribute + * @param mixed $value + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, setAttribute); + +/** + * Returns the value of an attribute if present + * + * @param string $attribute + * @param mixed $defaultValue + * @return mixed + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getAttribute); + +/** + * Sets default attributes for the element + * + * @param array $attributes + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, setAttributes); + +/** + * Returns the default attributes for the element + * + * @return array + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getAttributes); + +/** + * Sets an option for the element + * + * @param string $option + * @param mixed $value + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, setUserOption); + +/** + * Returns the value of an option if present + * + * @param string $option + * @param mixed $defaultValue + * @return mixed + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getUserOption); + +/** + * Sets options for the element + * + * @param array $options + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, setUserOptions); + +/** + * Returns the options for the element + * + * @return array + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getUserOptions); + +/** + * Sets the element label + * + * @param string $label + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, setLabel); + +/** + * Returns the element's label + * + * @return string + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getLabel); + +/** + * Generate the HTML to label the element + * + * @return string + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, label); + +/** + * Sets a default value in case the form does not use an entity + * or there is no value available for the element in $_POST + * + * @param mixed $value + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, setDefault); + +/** + * Returns the default value assigned to the element + * + * @return mixed + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getDefault); + +/** + * Returns the element's value + * + * @return mixed + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getValue); + +/** + * Returns the messages that belongs to the element + * The element needs to be attached to a form + * + * @return Phalcon\Validation\Message\Group + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, getMessages); + +/** + * Checks whether there are messages attached to the element + * + * @return boolean + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, hasMessages); + +/** + * Sets the validation messages related to the element + * + * @param Phalcon\Validation\Message\Group $group + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, setMessages); + +/** + * Appends a message to the internal message list + * + * @param Phalcon\Validation\Message $message + * @return Phalcon\Forms\ElementInterface + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, appendMessage); + +/** + * Clears every element in the form to its default value + * + * @return Phalcon\Forms\Element + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, clear); + +/** + * Renders the element widget + * + * @param array $attributes + * @return string + */ +PHALCON_DOC_METHOD(Phalcon_Forms_ElementInterface, render); + diff --git a/ext/forms/elementinterface.h b/ext/forms/elementinterface.h new file mode 100644 index 00000000000..e3e983cbd50 --- /dev/null +++ b/ext/forms/elementinterface.h @@ -0,0 +1,136 @@ + +/* + +------------------------------------------------------------------------+ + | Phalcon Framework | + +------------------------------------------------------------------------+ + | Copyright (c) 2011-2013 Phalcon Team (http://www.phalconphp.com) | + +------------------------------------------------------------------------+ + | This source file is subject to the New BSD License that is bundled | + | with this package in the file docs/LICENSE.txt. | + | | + | If you did not receive a copy of the license and are unable to | + | obtain it through the world-wide-web, please send an email | + | to license@phalconphp.com so we can send you a copy immediately. | + +------------------------------------------------------------------------+ + | Authors: Andres Gutierrez | + | Eduar Carvajal | + +------------------------------------------------------------------------+ +*/ + +extern zend_class_entry *phalcon_forms_elementinterface_ce; + +PHALCON_INIT_CLASS(Phalcon_Forms_ElementInterface); + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_setform, 0, 0, 1) + ZEND_ARG_INFO(0, form) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_setname, 0, 0, 1) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_setfilters, 0, 0, 1) + ZEND_ARG_INFO(0, filters) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_addfilter, 0, 0, 1) + ZEND_ARG_INFO(0, filter) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_addvalidators, 0, 0, 1) + ZEND_ARG_INFO(0, validators) + ZEND_ARG_INFO(0, merge) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_addvalidator, 0, 0, 1) + ZEND_ARG_INFO(0, validator) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_prepareattributes, 0, 0, 0) + ZEND_ARG_INFO(0, attributes) + ZEND_ARG_INFO(0, useChecked) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_setattribute, 0, 0, 2) + ZEND_ARG_INFO(0, attribute) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_getattribute, 0, 0, 1) + ZEND_ARG_INFO(0, attribute) + ZEND_ARG_INFO(0, defaultValue) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_setattributes, 0, 0, 1) + ZEND_ARG_INFO(0, attributes) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_setuseroption, 0, 0, 2) + ZEND_ARG_INFO(0, option) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_getuseroption, 0, 0, 1) + ZEND_ARG_INFO(0, option) + ZEND_ARG_INFO(0, defaultValue) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_setuseroptions, 0, 0, 1) + ZEND_ARG_INFO(0, options) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_setlabel, 0, 0, 1) + ZEND_ARG_INFO(0, label) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_setdefault, 0, 0, 1) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_setmessages, 0, 0, 1) + ZEND_ARG_INFO(0, group) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_appendmessage, 0, 0, 1) + ZEND_ARG_INFO(0, message) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_forms_elementinterface_render, 0, 0, 0) + ZEND_ARG_INFO(0, attributes) +ZEND_END_ARG_INFO() + +PHALCON_INIT_FUNCS(phalcon_forms_elementinterface_method_entry){ + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, setForm, arginfo_phalcon_forms_elementinterface_setform) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getForm, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, setName, arginfo_phalcon_forms_elementinterface_setname) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getName, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, setFilters, arginfo_phalcon_forms_elementinterface_setfilters) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, addFilter, arginfo_phalcon_forms_elementinterface_addfilter) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getFilters, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, addValidators, arginfo_phalcon_forms_elementinterface_addvalidators) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, addValidator, arginfo_phalcon_forms_elementinterface_addvalidator) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getValidators, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, prepareAttributes, arginfo_phalcon_forms_elementinterface_prepareattributes) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, setAttribute, arginfo_phalcon_forms_elementinterface_setattribute) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getAttribute, arginfo_phalcon_forms_elementinterface_getattribute) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, setAttributes, arginfo_phalcon_forms_elementinterface_setattributes) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getAttributes, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, setUserOption, arginfo_phalcon_forms_elementinterface_setuseroption) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getUserOption, arginfo_phalcon_forms_elementinterface_getuseroption) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, setUserOptions, arginfo_phalcon_forms_elementinterface_setuseroptions) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getUserOptions, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, setLabel, arginfo_phalcon_forms_elementinterface_setlabel) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getLabel, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, label, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, setDefault, arginfo_phalcon_forms_elementinterface_setdefault) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getDefault, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getValue, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, getMessages, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, hasMessages, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, setMessages, arginfo_phalcon_forms_elementinterface_setmessages) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, appendMessage, arginfo_phalcon_forms_elementinterface_appendmessage) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, clear, NULL) + PHP_ABSTRACT_ME(Phalcon_Forms_ElementInterface, render, arginfo_phalcon_forms_elementinterface_render) + PHP_FE_END +}; + diff --git a/ext/forms/form.c b/ext/forms/form.c index 2ec3fee8b09..d19ecba36bd 100644 --- a/ext/forms/form.c +++ b/ext/forms/form.c @@ -868,16 +868,15 @@ PHP_METHOD(Phalcon_Forms_Form, getValue){ PHALCON_INIT_VAR(method); PHALCON_CONCAT_SV(method, "get", name); if (phalcon_method_exists(entity, method TSRMLS_CC) == SUCCESS) { - PHALCON_INIT_VAR(value); - phalcon_call_method_zval(value, entity, method); - RETURN_CCTOR(value); + phalcon_call_method_zval(return_value, entity, method); + RETURN_MM(); } /** * Check if the entity has a public property */ - if (phalcon_isset_property_zval(entity, name TSRMLS_CC)) { - PHALCON_OBS_NVAR(value); + if (phalcon_isset_property_zval(entity, name)) { + PHALCON_OBS_VAR(value); phalcon_read_property_zval(&value, entity, name, PH_NOISY_CC); RETURN_CCTOR(value); } diff --git a/ext/http/request/file.c b/ext/http/request/file.c index 2624f18be23..f861a3c74e8 100644 --- a/ext/http/request/file.c +++ b/ext/http/request/file.c @@ -187,7 +187,7 @@ PHP_METHOD(Phalcon_Http_Request_File, getRealType){ */ PHP_METHOD(Phalcon_Http_Request_File, moveTo){ - zval *destination, *temp_file, *success; + zval *destination, *temp_file; PHALCON_MM_GROW(); @@ -195,9 +195,7 @@ PHP_METHOD(Phalcon_Http_Request_File, moveTo){ PHALCON_OBS_VAR(temp_file); phalcon_read_property_this(&temp_file, this_ptr, SL("_tmp"), PH_NOISY_CC); - - PHALCON_INIT_VAR(success); - phalcon_call_func_p2(success, "move_uploaded_file", temp_file, destination); - RETURN_CCTOR(success); + phalcon_call_func_p2(return_value, "move_uploaded_file", temp_file, destination); + RETURN_MM(); } diff --git a/ext/kernel/alternative/fcall.h b/ext/kernel/alternative/fcall.h index 6a149a545e4..4f97a8126be 100644 --- a/ext/kernel/alternative/fcall.h +++ b/ext/kernel/alternative/fcall.h @@ -27,5 +27,5 @@ #endif extern int phalcon_alt_call_user_method(zend_class_entry *ce, zval **object_pp, char *method_name, unsigned int method_len, zval *retval_ptr, zend_uint param_count, zval *params[], unsigned long method_key TSRMLS_DC); -/*int phalcon_alt_call_user_method_ex(zend_class_entry *ce, zval **object_pp, char *method_name, unsigned int method_len, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], unsigned long method_key TSRMLS_DC);*/ -int phalcon_alt_call_method(zend_fcall_info *fci, zend_class_entry *ce, unsigned long hash_key, char *method_name, unsigned int method_len, unsigned long method_key TSRMLS_DC); +int phalcon_alt_call_user_method_ex(zend_class_entry *ce, zval **object_pp, char *method_name, unsigned int method_len, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], unsigned long method_key TSRMLS_DC); +int phalcon_alt_call_method(zend_fcall_info *fci, zend_class_entry *ce, unsigned long hash_key, char *method_name, unsigned int method_len, unsigned long method_key TSRMLS_DC); \ No newline at end of file diff --git a/ext/logger/adapter/file.c b/ext/logger/adapter/file.c index a63a5ac86e2..89ff2ed7445 100644 --- a/ext/logger/adapter/file.c +++ b/ext/logger/adapter/file.c @@ -184,16 +184,14 @@ PHP_METHOD(Phalcon_Logger_Adapter_File, logInternal){ */ PHP_METHOD(Phalcon_Logger_Adapter_File, close){ - zval *file_handler, *success; + zval *file_handler; PHALCON_MM_GROW(); PHALCON_OBS_VAR(file_handler); phalcon_read_property_this(&file_handler, this_ptr, SL("_fileHandler"), PH_NOISY_CC); - - PHALCON_INIT_VAR(success); - phalcon_call_func_p1(success, "fclose", file_handler); - RETURN_CCTOR(success); + phalcon_call_func_p1(return_value, "fclose", file_handler); + RETURN_MM(); } /** diff --git a/ext/logger/adapter/stream.c b/ext/logger/adapter/stream.c index f8b5275db75..4f2cf56dcac 100644 --- a/ext/logger/adapter/stream.c +++ b/ext/logger/adapter/stream.c @@ -178,15 +178,13 @@ PHP_METHOD(Phalcon_Logger_Adapter_Stream, logInternal){ */ PHP_METHOD(Phalcon_Logger_Adapter_Stream, close){ - zval *stream, *success; + zval *stream; PHALCON_MM_GROW(); PHALCON_OBS_VAR(stream); phalcon_read_property_this(&stream, this_ptr, SL("_stream"), PH_NOISY_CC); - - PHALCON_INIT_VAR(success); - phalcon_call_func_p1(success, "fclose", stream); - RETURN_CCTOR(success); + phalcon_call_func_p1(return_value, "fclose", stream); + RETURN_MM(); } diff --git a/ext/logger/formatter/json.c b/ext/logger/formatter/json.c index 2f137779568..b0fcd6bd687 100644 --- a/ext/logger/formatter/json.c +++ b/ext/logger/formatter/json.c @@ -65,7 +65,6 @@ PHALCON_INIT_CLASS(Phalcon_Logger_Formatter_Json){ PHP_METHOD(Phalcon_Logger_Formatter_Json, format){ zval *message, *type, *timestamp, *type_str, *log; - zval *encoded; PHALCON_MM_GROW(); @@ -79,9 +78,7 @@ PHP_METHOD(Phalcon_Logger_Formatter_Json, format){ phalcon_array_update_string(&log, SL("type"), &type_str, PH_COPY | PH_SEPARATE); phalcon_array_update_string(&log, SL("message"), &message, PH_COPY | PH_SEPARATE); phalcon_array_update_string(&log, SL("timestamp"), ×tamp, PH_COPY | PH_SEPARATE); - - PHALCON_INIT_VAR(encoded); - phalcon_call_func_p1(encoded, "json_encode", log); - RETURN_CCTOR(encoded); + phalcon_call_func_p1(return_value, "json_encode", log); + RETURN_MM(); } diff --git a/ext/logger/formatter/line.c b/ext/logger/formatter/line.c index 72f961df213..85c05f241fa 100644 --- a/ext/logger/formatter/line.c +++ b/ext/logger/formatter/line.c @@ -207,10 +207,8 @@ PHP_METHOD(Phalcon_Logger_Formatter_Line, format){ PHALCON_INIT_VAR(eol); ZVAL_STRING(eol, PHP_EOL, 1); + PHALCON_CONCAT_VV(return_value, new_format, eol); - PHALCON_INIT_NVAR(format); - PHALCON_CONCAT_VV(format, new_format, eol); - - RETURN_CCTOR(format); + RETURN_MM(); } diff --git a/ext/logger/formatter/syslog.c b/ext/logger/formatter/syslog.c index 4f4c9ddb143..f46e7b7728f 100644 --- a/ext/logger/formatter/syslog.c +++ b/ext/logger/formatter/syslog.c @@ -63,16 +63,13 @@ PHALCON_INIT_CLASS(Phalcon_Logger_Formatter_Syslog){ */ PHP_METHOD(Phalcon_Logger_Formatter_Syslog, format){ - zval *message, *type, *timestamp, *log; + zval *message, *type, *timestamp; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 3, 0, &message, &type, ×tamp); + phalcon_fetch_params(0, 3, 0, &message, &type, ×tamp); - PHALCON_INIT_VAR(log); - array_init_size(log, 2); - phalcon_array_append(&log, type, PH_SEPARATE); - phalcon_array_append(&log, message, PH_SEPARATE); - RETURN_CTOR(log); + array_init_size(return_value, 2); + phalcon_array_append(&return_value, type, PH_SEPARATE); + phalcon_array_append(&return_value, message, PH_SEPARATE); + return; } diff --git a/ext/mvc/collection.c b/ext/mvc/collection.c index 763ed545cd7..d9273572c32 100644 --- a/ext/mvc/collection.c +++ b/ext/mvc/collection.c @@ -456,7 +456,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, readAttribute){ phalcon_fetch_params(1, 1, 0, &attribute); - if (phalcon_isset_property_zval(this_ptr, attribute TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute)) { PHALCON_OBS_VAR(attribute_value); phalcon_read_property_zval(&attribute_value, this_ptr, attribute, PH_NOISY_CC); RETURN_CCTOR(attribute_value); @@ -1176,7 +1176,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, _exists){ phalcon_fetch_params(1, 1, 0, &collection); - if (phalcon_isset_property(this_ptr, SS("_id") TSRMLS_CC)) { + if (phalcon_isset_property(this_ptr, SS("_id"))) { PHALCON_OBS_VAR(id); phalcon_read_property_this(&id, this_ptr, SL("_id"), PH_NOISY_CC); @@ -1867,7 +1867,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, delete){ PHALCON_MM_GROW(); - if (!phalcon_isset_property(this_ptr, SS("_id") TSRMLS_CC)) { + if (!phalcon_isset_property(this_ptr, SS("_id"))) { PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_collection_exception_ce, "The document cannot be deleted because it doesn't exist"); return; } diff --git a/ext/mvc/collection/document.c b/ext/mvc/collection/document.c index 289a1cd8054..64961ccc7f0 100644 --- a/ext/mvc/collection/document.c +++ b/ext/mvc/collection/document.c @@ -67,7 +67,7 @@ PHP_METHOD(Phalcon_Mvc_Collection_Document, offsetExists){ phalcon_fetch_params(0, 1, 0, &index); - if (phalcon_isset_property_zval(this_ptr, index TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, index)) { RETURN_TRUE; } RETURN_FALSE; @@ -87,7 +87,7 @@ PHP_METHOD(Phalcon_Mvc_Collection_Document, offsetGet){ phalcon_fetch_params(1, 1, 0, &index); - if (phalcon_isset_property_zval(this_ptr, index TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, index)) { PHALCON_OBS_VAR(value); phalcon_read_property_zval(&value, this_ptr, index, PH_NOISY_CC); RETURN_CCTOR(value); @@ -146,7 +146,7 @@ PHP_METHOD(Phalcon_Mvc_Collection_Document, readAttribute){ phalcon_fetch_params(1, 1, 0, &attribute); - if (phalcon_isset_property_zval(this_ptr, attribute TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute)) { PHALCON_OBS_VAR(attribute_value); phalcon_read_property_zval(&attribute_value, this_ptr, attribute, PH_NOISY_CC); RETURN_CCTOR(attribute_value); diff --git a/ext/mvc/dispatcher.c b/ext/mvc/dispatcher.c index 8b720e4060b..09b10defc29 100755 --- a/ext/mvc/dispatcher.c +++ b/ext/mvc/dispatcher.c @@ -143,8 +143,8 @@ PHP_METHOD(Phalcon_Mvc_Dispatcher, getControllerName){ PHP_METHOD(Phalcon_Mvc_Dispatcher, _throwDispatchException){ zval *message, *exception_code = NULL, *dependency_injector; - zval *exception_message, *service, *response; - zval *status_code, *status_message, *exception; + zval *exception_message, *exception = NULL, *service; + zval *response, *status_code, *status_message; zval *events_manager, *event_name, *status; PHALCON_MM_GROW(); @@ -166,10 +166,12 @@ PHP_METHOD(Phalcon_Mvc_Dispatcher, _throwDispatchException){ PHALCON_INIT_VAR(exception_message); ZVAL_STRING(exception_message, "A dependency injection container is required to access the 'response' service", 1); - object_init_ex(return_value, phalcon_mvc_dispatcher_exception_ce); - phalcon_call_method_p2_noret(return_value, "__construct", exception_message, exception_code); - RETURN_MM(); + PHALCON_INIT_VAR(exception); + object_init_ex(exception, phalcon_mvc_dispatcher_exception_ce); + phalcon_call_method_p2_noret(exception, "__construct", exception_message, exception_code); + + RETURN_CTOR(exception); } PHALCON_INIT_VAR(service); @@ -191,7 +193,7 @@ PHP_METHOD(Phalcon_Mvc_Dispatcher, _throwDispatchException){ /** * Create the real exception */ - PHALCON_INIT_VAR(exception); + PHALCON_INIT_NVAR(exception); object_init_ex(exception, phalcon_mvc_dispatcher_exception_ce); phalcon_call_method_p2_noret(exception, "__construct", message, exception_code); diff --git a/ext/mvc/micro/collection.c b/ext/mvc/micro/collection.c index 139ec8ce1ae..ef261efcc73 100644 --- a/ext/mvc/micro/collection.c +++ b/ext/mvc/micro/collection.c @@ -210,17 +210,15 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, getHandler){ */ PHP_METHOD(Phalcon_Mvc_Micro_Collection, map){ - zval *route_pattern, *handler, *method, *route; + zval *route_pattern, *handler, *method; PHALCON_MM_GROW(); phalcon_fetch_params(1, 2, 0, &route_pattern, &handler); PHALCON_INIT_VAR(method); - - PHALCON_INIT_VAR(route); - phalcon_call_method_p3(route, this_ptr, "_addmap", method, route_pattern, handler); - RETURN_CCTOR(route); + phalcon_call_method_p3(return_value, this_ptr, "_addmap", method, route_pattern, handler); + RETURN_MM(); } /** @@ -232,7 +230,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, map){ */ PHP_METHOD(Phalcon_Mvc_Micro_Collection, get){ - zval *route_pattern, *handler, *method, *route; + zval *route_pattern, *handler, *method; PHALCON_MM_GROW(); @@ -240,10 +238,8 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, get){ PHALCON_INIT_VAR(method); ZVAL_STRING(method, "GET", 1); - - PHALCON_INIT_VAR(route); - phalcon_call_method_p3(route, this_ptr, "_addmap", method, route_pattern, handler); - RETURN_CCTOR(route); + phalcon_call_method_p3(return_value, this_ptr, "_addmap", method, route_pattern, handler); + RETURN_MM(); } /** @@ -255,7 +251,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, get){ */ PHP_METHOD(Phalcon_Mvc_Micro_Collection, post){ - zval *route_pattern, *handler, *method, *route; + zval *route_pattern, *handler, *method; PHALCON_MM_GROW(); @@ -263,10 +259,8 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, post){ PHALCON_INIT_VAR(method); ZVAL_STRING(method, "POST", 1); - - PHALCON_INIT_VAR(route); - phalcon_call_method_p3(route, this_ptr, "_addmap", method, route_pattern, handler); - RETURN_CCTOR(route); + phalcon_call_method_p3(return_value, this_ptr, "_addmap", method, route_pattern, handler); + RETURN_MM(); } /** @@ -278,7 +272,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, post){ */ PHP_METHOD(Phalcon_Mvc_Micro_Collection, put){ - zval *route_pattern, *handler, *method, *route; + zval *route_pattern, *handler, *method; PHALCON_MM_GROW(); @@ -286,10 +280,8 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, put){ PHALCON_INIT_VAR(method); ZVAL_STRING(method, "PUT", 1); - - PHALCON_INIT_VAR(route); - phalcon_call_method_p3(route, this_ptr, "_addmap", method, route_pattern, handler); - RETURN_CCTOR(route); + phalcon_call_method_p3(return_value, this_ptr, "_addmap", method, route_pattern, handler); + RETURN_MM(); } /** @@ -301,7 +293,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, put){ */ PHP_METHOD(Phalcon_Mvc_Micro_Collection, patch){ - zval *route_pattern, *handler, *method, *route; + zval *route_pattern, *handler, *method; PHALCON_MM_GROW(); @@ -309,10 +301,8 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, patch){ PHALCON_INIT_VAR(method); ZVAL_STRING(method, "PATCH", 1); - - PHALCON_INIT_VAR(route); - phalcon_call_method_p3(route, this_ptr, "_addmap", method, route_pattern, handler); - RETURN_CCTOR(route); + phalcon_call_method_p3(return_value, this_ptr, "_addmap", method, route_pattern, handler); + RETURN_MM(); } /** @@ -324,7 +314,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, patch){ */ PHP_METHOD(Phalcon_Mvc_Micro_Collection, head){ - zval *route_pattern, *handler, *method, *route; + zval *route_pattern, *handler, *method; PHALCON_MM_GROW(); @@ -332,10 +322,8 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, head){ PHALCON_INIT_VAR(method); ZVAL_STRING(method, "HEAD", 1); - - PHALCON_INIT_VAR(route); - phalcon_call_method_p3(route, this_ptr, "_addmap", method, route_pattern, handler); - RETURN_CCTOR(route); + phalcon_call_method_p3(return_value, this_ptr, "_addmap", method, route_pattern, handler); + RETURN_MM(); } /** @@ -347,7 +335,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, head){ */ PHP_METHOD(Phalcon_Mvc_Micro_Collection, delete){ - zval *route_pattern, *handler, *method, *route; + zval *route_pattern, *handler, *method; PHALCON_MM_GROW(); @@ -355,10 +343,8 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, delete){ PHALCON_INIT_VAR(method); ZVAL_STRING(method, "DELETE", 1); - - PHALCON_INIT_VAR(route); - phalcon_call_method_p3(route, this_ptr, "_addmap", method, route_pattern, handler); - RETURN_CCTOR(route); + phalcon_call_method_p3(return_value, this_ptr, "_addmap", method, route_pattern, handler); + RETURN_MM(); } /** @@ -370,7 +356,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, delete){ */ PHP_METHOD(Phalcon_Mvc_Micro_Collection, options){ - zval *route_pattern, *handler, *method, *route; + zval *route_pattern, *handler, *method; PHALCON_MM_GROW(); @@ -378,9 +364,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_Collection, options){ PHALCON_INIT_VAR(method); ZVAL_STRING(method, "OPTIONS", 1); - - PHALCON_INIT_VAR(route); - phalcon_call_method_p3(route, this_ptr, "_addmap", method, route_pattern, handler); - RETURN_CCTOR(route); + phalcon_call_method_p3(return_value, this_ptr, "_addmap", method, route_pattern, handler); + RETURN_MM(); } diff --git a/ext/mvc/micro/lazyloader.c b/ext/mvc/micro/lazyloader.c index 0c7ad2afbf5..0d3519747dc 100644 --- a/ext/mvc/micro/lazyloader.c +++ b/ext/mvc/micro/lazyloader.c @@ -86,7 +86,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, __construct){ PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, __call){ zval *method, *arguments, *handler = NULL, *definition; - zval *call_handler, *result; + zval *call_handler; zend_class_entry *ce0; PHALCON_MM_GROW(); @@ -116,9 +116,7 @@ PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, __call){ /** * Call the handler */ - PHALCON_INIT_VAR(result); - PHALCON_CALL_USER_FUNC_ARRAY(result, call_handler, arguments); - - RETURN_CCTOR(result); + PHALCON_CALL_USER_FUNC_ARRAY(return_value, call_handler, arguments); + RETURN_MM(); } diff --git a/ext/mvc/model.c b/ext/mvc/model.c index 4d283cfbaab..9b62657942a 100755 --- a/ext/mvc/model.c +++ b/ext/mvc/model.c @@ -1305,7 +1305,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _exists){ /** * If the primary key attribute is set append it to the conditions */ - if (phalcon_isset_property_zval(this_ptr, attribute_field TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute_field)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, attribute_field, PH_NOISY_CC); @@ -2142,7 +2142,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysRestrict){ PHALCON_GET_HKEY(position, ah1, hp1); PHALCON_GET_HVALUE(field); - if (phalcon_isset_property_zval(this_ptr, field TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, field)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, field, PH_NOISY_CC); } else { @@ -2164,7 +2164,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysRestrict){ /** * Create a simple condition */ - if (phalcon_isset_property_zval(this_ptr, fields TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, fields)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, fields, PH_NOISY_CC); } else { @@ -2365,7 +2365,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseRestrict){ PHALCON_GET_HKEY(position, ah1, hp1); PHALCON_GET_HVALUE(field); - if (phalcon_isset_property_zval(this_ptr, field TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, field)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, field, PH_NOISY_CC); } else { @@ -2384,7 +2384,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseRestrict){ } } else { - if (phalcon_isset_property_zval(this_ptr, fields TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, fields)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, fields, PH_NOISY_CC); } else { @@ -2573,7 +2573,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseCascade){ PHALCON_GET_HKEY(position, ah1, hp1); PHALCON_GET_HVALUE(field); - if (phalcon_isset_property_zval(this_ptr, field TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, field)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, field, PH_NOISY_CC); } else { @@ -2592,7 +2592,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseCascade){ } } else { - if (phalcon_isset_property_zval(this_ptr, fields TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, fields)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, fields, PH_NOISY_CC); } else { @@ -2794,7 +2794,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _preSave){ * Field is null when: 1) is not set, 2) is numeric but its value is not numeric, * 3) is null or 4) is empty string */ - if (phalcon_isset_property_zval(this_ptr, attribute_field TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute_field)) { /** * Read the attribute from the this_ptr using the real or renamed name @@ -3093,7 +3093,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert){ /** * This isset checks that the property be defined in the model */ - if (phalcon_isset_property_zval(this_ptr, attribute_field TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute_field)) { /** * Every column must have a bind data type defined @@ -3159,7 +3159,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert){ /** * Check if the developer set an explicit value for the column */ - if (phalcon_isset_property_zval(this_ptr, attribute_field TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute_field)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, attribute_field, PH_NOISY_CC); @@ -3358,7 +3358,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate){ /** * If a field isn't set we pass a null value */ - if (phalcon_isset_property_zval(this_ptr, attribute_field TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute_field)) { /** * Get the field's value @@ -3474,7 +3474,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate){ } else { PHALCON_CPY_WRT(attribute_field, field); } - if (phalcon_isset_property_zval(this_ptr, attribute_field TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute_field)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, attribute_field, PH_NOISY_CC); phalcon_array_append(&unique_params, value, PH_SEPARATE); @@ -3735,7 +3735,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _postSaveRelatedRecords){ PHALCON_CPY_WRT(related_records, record); } - if (!phalcon_isset_property_zval(this_ptr, columns TSRMLS_CC)) { + if (!phalcon_isset_property_zval(this_ptr, columns)) { phalcon_call_method_p1_noret(connection, "rollback", nesting); PHALCON_INIT_NVAR(exception_message); @@ -4650,7 +4650,7 @@ PHP_METHOD(Phalcon_Mvc_Model, delete){ /** * If the attribute is currently set in the object add it to the conditions */ - if (!phalcon_isset_property_zval(this_ptr, attribute_field TSRMLS_CC)) { + if (!phalcon_isset_property_zval(this_ptr, attribute_field)) { PHALCON_INIT_NVAR(exception_message); PHALCON_CONCAT_SVS(exception_message, "Cannot delete the record because the primary key attribute: '", attribute_field, "' wasn't set"); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_mvc_model_exception_ce, exception_message); @@ -4935,7 +4935,7 @@ PHP_METHOD(Phalcon_Mvc_Model, readAttribute){ phalcon_fetch_params(1, 1, 0, &attribute); - if (phalcon_isset_property_zval(this_ptr, attribute TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute)) { PHALCON_OBS_VAR(attribute_value); phalcon_read_property_zval(&attribute_value, this_ptr, attribute, PH_NOISY_CC); RETURN_CCTOR(attribute_value); @@ -5302,7 +5302,6 @@ PHP_METHOD(Phalcon_Mvc_Model, hasManyToMany){ zval *fields, *intermediate_model, *intermediate_fields; zval *intermediate_referenced_fields, *reference_model; zval *referenced_fields, *options = NULL, *manager; - zval *relation; zval *p0[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; PHALCON_MM_GROW(); @@ -5324,10 +5323,8 @@ PHP_METHOD(Phalcon_Mvc_Model, hasManyToMany){ p0[5] = reference_model; p0[6] = referenced_fields; p0[7] = options; - - PHALCON_INIT_VAR(relation); - phalcon_call_method_pn(relation, manager, "addhasmanytomany", 8, p0); - RETURN_CCTOR(relation); + phalcon_call_method_pn(return_value, manager, "addhasmanytomany", 8, p0); + RETURN_MM(); } /** @@ -5610,7 +5607,7 @@ PHP_METHOD(Phalcon_Mvc_Model, hasChanged){ /** * The field is not part of the model, throw exception */ - if (!phalcon_isset_property_zval(this_ptr, field_name TSRMLS_CC)) { + if (!phalcon_isset_property_zval(this_ptr, field_name)) { PHALCON_INIT_NVAR(exception_message); PHALCON_CONCAT_SVS(exception_message, "The field '", field_name, "' is not defined on the model"); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_mvc_model_exception_ce, exception_message); @@ -5664,7 +5661,7 @@ PHP_METHOD(Phalcon_Mvc_Model, hasChanged){ /** * If some attribute is not present in the model, we assume the record as changed */ - if (!phalcon_isset_property_zval(this_ptr, name TSRMLS_CC)) { + if (!phalcon_isset_property_zval(this_ptr, name)) { RETURN_MM_TRUE; } @@ -5770,7 +5767,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getChangedFields){ /** * If some attribute is not present in the model, we assume the record as changed */ - if (!phalcon_isset_property_zval(this_ptr, name TSRMLS_CC)) { + if (!phalcon_isset_property_zval(this_ptr, name)) { phalcon_array_append(&changed, name, PH_SEPARATE); zend_hash_move_forward_ex(ah0, &hp0); continue; @@ -6378,7 +6375,7 @@ PHP_METHOD(Phalcon_Mvc_Model, serialize){ PHALCON_GET_HVALUE(attribute); - if (phalcon_isset_property_zval(this_ptr, attribute TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, attribute, PH_NOISY_CC); phalcon_array_update_zval(&data, attribute, &value, PH_COPY | PH_SEPARATE); @@ -6560,7 +6557,7 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray){ } else { PHALCON_CPY_WRT(attribute_field, attribute); } - if (phalcon_isset_property_zval(this_ptr, attribute_field TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, attribute_field)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, this_ptr, attribute_field, PH_NOISY_CC); phalcon_array_update_zval(&data, attribute_field, &value, PH_COPY | PH_SEPARATE); diff --git a/ext/mvc/model/query.c b/ext/mvc/model/query.c index d57c69edd00..ea03786ff11 100755 --- a/ext/mvc/model/query.c +++ b/ext/mvc/model/query.c @@ -1049,9 +1049,8 @@ PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression){ * Is a qualified column */ if (phalcon_array_isset_string(expr, SS("domain"))) { - PHALCON_INIT_NVAR(expr_return); - phalcon_call_method_p1(expr_return, this_ptr, "_getqualified", expr); - RETURN_CCTOR(expr_return); + phalcon_call_method_p1(return_value, this_ptr, "_getqualified", expr); + RETURN_MM(); } /** @@ -1075,12 +1074,11 @@ PHP_METHOD(Phalcon_Mvc_Model_Query, _getExpression){ zend_hash_move_forward_ex(ah0, &hp0); } - PHALCON_INIT_NVAR(expr_return); - array_init_size(expr_return, 2); - add_assoc_stringl_ex(expr_return, SS("type"), SL("list"), 1); - phalcon_array_append(&expr_return, list_items, PH_SEPARATE); + array_init_size(return_value, 2); + add_assoc_stringl_ex(return_value, SS("type"), SL("list"), 1); + phalcon_array_append(&return_value, list_items, PH_SEPARATE); - RETURN_CCTOR(expr_return); + RETURN_MM(); } PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Unknown expression"); diff --git a/ext/mvc/model/resultset/complex.c b/ext/mvc/model/resultset/complex.c index 6abaf9807d2..f6d6ec14f3e 100755 --- a/ext/mvc/model/resultset/complex.c +++ b/ext/mvc/model/resultset/complex.c @@ -161,7 +161,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, valid){ if (Z_TYPE_P(rows) == IS_ARRAY) { PHALCON_INIT_NVAR(row); - phalcon_array_get_current(row, rows); + phalcon_array_get_current(row, rows TSRMLS_CC); if (Z_TYPE_P(row) == IS_OBJECT) { phalcon_array_next(rows); } diff --git a/ext/mvc/model/resultset/simple.c b/ext/mvc/model/resultset/simple.c index 8da41c9c195..1ba01ab6a4d 100755 --- a/ext/mvc/model/resultset/simple.c +++ b/ext/mvc/model/resultset/simple.c @@ -178,7 +178,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, valid){ if (Z_TYPE_P(rows) == IS_ARRAY) { PHALCON_INIT_NVAR(row); - phalcon_array_get_current(row, rows); + phalcon_array_get_current(row, rows TSRMLS_CC); if (PHALCON_IS_NOT_FALSE(row)) { phalcon_array_next(rows); } diff --git a/ext/mvc/model/row.c b/ext/mvc/model/row.c index 0b4209c9394..7e269db2d54 100755 --- a/ext/mvc/model/row.c +++ b/ext/mvc/model/row.c @@ -81,7 +81,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Row, offsetExists){ phalcon_fetch_params(0, 1, 0, &index); - if (phalcon_isset_property_zval(this_ptr, index TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, index)) { RETURN_TRUE; } RETURN_FALSE; @@ -101,7 +101,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Row, offsetGet){ phalcon_fetch_params(1, 1, 0, &index); - if (phalcon_isset_property_zval(this_ptr, index TSRMLS_CC)) { + if (phalcon_isset_property_zval(this_ptr, index)) { PHALCON_OBS_VAR(value); phalcon_read_property_zval(&value, this_ptr, index, PH_NOISY_CC); RETURN_CCTOR(value); diff --git a/ext/mvc/model/validator.c b/ext/mvc/model/validator.c index f5c9862a14e..649999ab2f3 100644 --- a/ext/mvc/model/validator.c +++ b/ext/mvc/model/validator.c @@ -32,8 +32,8 @@ #include "kernel/main.h" #include "kernel/memory.h" -#include "kernel/object.h" #include "kernel/exception.h" +#include "kernel/object.h" #include "kernel/fcall.h" #include "kernel/string.h" #include "kernel/array.h" @@ -67,10 +67,6 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator, __construct){ zval *options; - phalcon_update_property_empty_array(phalcon_mvc_model_validator_ce, this_ptr, SL("_options") TSRMLS_CC); - - phalcon_update_property_empty_array(phalcon_mvc_model_validator_ce, this_ptr, SL("_messages") TSRMLS_CC); - phalcon_fetch_params(0, 1, 0, &options); if (Z_TYPE_P(options) != IS_ARRAY) { diff --git a/ext/mvc/url.c b/ext/mvc/url.c index 02f4090b89f..85d890535f6 100755 --- a/ext/mvc/url.c +++ b/ext/mvc/url.c @@ -268,7 +268,7 @@ PHP_METHOD(Phalcon_Mvc_Url, get){ zval *uri = NULL, *base_uri, *router = NULL, *dependency_injector; zval *service, *route_name, *route, *exception_message; - zval *pattern, *paths, *processed_uri, *final_uri = NULL; + zval *pattern, *paths, *processed_uri; PHALCON_MM_GROW(); @@ -338,17 +338,14 @@ PHP_METHOD(Phalcon_Mvc_Url, get){ */ PHALCON_INIT_VAR(processed_uri); phalcon_replace_paths(processed_uri, pattern, paths, uri TSRMLS_CC); + PHALCON_CONCAT_VV(return_value, base_uri, processed_uri); - PHALCON_INIT_VAR(final_uri); - PHALCON_CONCAT_VV(final_uri, base_uri, processed_uri); - - RETURN_CTOR(final_uri); + RETURN_MM(); } - PHALCON_INIT_NVAR(final_uri); - PHALCON_CONCAT_VV(final_uri, base_uri, uri); + PHALCON_CONCAT_VV(return_value, base_uri, uri); - RETURN_CTOR(final_uri); + RETURN_MM(); } /** diff --git a/ext/mvc/view/engine/volt.c b/ext/mvc/view/engine/volt.c index 058040def92..8cf3a5f9430 100644 --- a/ext/mvc/view/engine/volt.c +++ b/ext/mvc/view/engine/volt.c @@ -262,7 +262,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, length){ */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, isIncluded){ - zval *needle, *haystack, *included = NULL; + zval *needle, *haystack; PHALCON_MM_GROW(); @@ -274,14 +274,11 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, isIncluded){ } if (Z_TYPE_P(haystack) == IS_STRING) { if (phalcon_function_exists_ex(SS("mb_strpos") TSRMLS_CC) == SUCCESS) { - PHALCON_INIT_VAR(included); - phalcon_call_func_p2(included, "mb_strpos", haystack, needle); - } else { - PHALCON_INIT_NVAR(included); - phalcon_fast_strpos(included, haystack, needle TSRMLS_CC); + phalcon_call_func_p2(return_value, "mb_strpos", haystack, needle); + RETURN_MM(); } - - RETURN_CCTOR(included); + phalcon_fast_strpos(return_value, haystack, needle TSRMLS_CC); + RETURN_MM(); } PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_view_exception_ce, "Invalid haystack"); @@ -354,7 +351,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, convertEncoding){ */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice){ - zval *value, *start, *end = NULL, *slice = NULL, *length = NULL, *position; + zval *value, *start, *end = NULL, *slice, *length = NULL, *position; zval *current = NULL, *one, *range; zval *r0 = NULL; @@ -437,28 +434,23 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice){ */ if (phalcon_function_exists_ex(SS("mb_substr") TSRMLS_CC) == SUCCESS) { if (Z_TYPE_P(length) != IS_NULL) { - PHALCON_INIT_NVAR(slice); - phalcon_call_func_p3(slice, "mb_substr", value, start, length); - } else { - PHALCON_INIT_NVAR(slice); - phalcon_call_func_p2(slice, "mb_substr", value, start); + phalcon_call_func_p3(return_value, "mb_substr", value, start, length); + RETURN_MM(); } - - RETURN_CCTOR(slice); + phalcon_call_func_p2(return_value, "mb_substr", value, start); + RETURN_MM(); } /** * Use the standard substr function */ if (Z_TYPE_P(length) != IS_NULL) { - PHALCON_INIT_NVAR(slice); - phalcon_call_func_p3(slice, "substr", value, start, length); - } else { - PHALCON_INIT_NVAR(slice); - phalcon_call_func_p2(slice, "substr", value, start); + phalcon_call_func_p3(return_value, "substr", value, start, length); + RETURN_MM(); } - RETURN_CCTOR(slice); + phalcon_call_func_p2(return_value, "substr", value, start); + RETURN_MM(); } /** diff --git a/ext/mvc/view/engine/volt/compiler.c b/ext/mvc/view/engine/volt/compiler.c index 22bce421903..a2497f1d787 100644 --- a/ext/mvc/view/engine/volt/compiler.c +++ b/ext/mvc/view/engine/volt/compiler.c @@ -569,8 +569,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ zval *event, *fire_arguments, *functions, *definition; zval *parameters, *line = NULL, *file = NULL, *exception_message = NULL; zval *macros, *extended_blocks, *current_block; - zval *expr_level, *block, *escaped_code = NULL, *str_code = NULL; - zval *camelized, *method, *class_name, *array_helpers = NULL; + zval *expr_level, *block, *escaped_code = NULL, *camelized; + zval *method, *class_name, *array_helpers = NULL; PHALCON_MM_GROW(); @@ -649,9 +649,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ * Use the string as function */ if (Z_TYPE_P(definition) == IS_STRING) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_VSVS(code, definition, "(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); + RETURN_MM(); } /** @@ -663,10 +662,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ array_init_size(parameters, 2); phalcon_array_append(¶meters, arguments, PH_SEPARATE); phalcon_array_append(¶meters, func_arguments, PH_SEPARATE); - - PHALCON_INIT_NVAR(code); - phalcon_call_func_p2(code, "call_user_func_array", definition, parameters); - RETURN_CCTOR(code); + phalcon_call_func_p2(return_value, "call_user_func_array", definition, parameters); + RETURN_MM(); } } @@ -690,18 +687,15 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ * Check if the function name is a macro */ if (phalcon_array_isset(macros, name)) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVSVS(code, "vmacro_", name, "(array(", arguments, "))"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVSVS(return_value, "vmacro_", name, "(array(", arguments, "))"); + RETURN_MM(); } /** * This function includes the previous rendering stage */ if (PHALCON_IS_STRING(name, "get_content")) { - PHALCON_INIT_NVAR(code); - ZVAL_STRING(code, "$this->getContent()", 1); - RETURN_CCTOR(code); + RETURN_MM_STRING("$this->getContent()", 1); } /** @@ -760,13 +754,12 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ * If the super() is the first level we don't escape it */ if (PHALCON_IS_LONG(expr_level, 1)) { - PHALCON_CPY_WRT(str_code, escaped_code); - } else { - PHALCON_INIT_NVAR(str_code); - PHALCON_CONCAT_SVS(str_code, "'", escaped_code, "'"); + RETURN_CCTOR(escaped_code); } - RETURN_CCTOR(str_code); + PHALCON_CONCAT_SVS(return_value, "'", escaped_code, "'"); + + RETURN_MM(); } } @@ -811,14 +804,13 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ } if (phalcon_array_isset(array_helpers, name)) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVSVS(code, "Phalcon\\Tag::", method, "(array(", arguments, "))"); - } else { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVSVS(code, "Phalcon\\Tag::", method, "(", arguments, ")"); + PHALCON_CONCAT_SVSVS(return_value, "Phalcon\\Tag::", method, "(array(", arguments, "))"); + RETURN_MM(); } - RETURN_CCTOR(code); + PHALCON_CONCAT_SVSVS(return_value, "Phalcon\\Tag::", method, "(", arguments, ")"); + + RETURN_MM(); } /** @@ -849,30 +841,24 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ } if (PHALCON_IS_STRING(name, "dump")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "var_dump(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "var_dump(", arguments, ")"); + RETURN_MM(); } if (PHALCON_IS_STRING(name, "version")) { - PHALCON_INIT_NVAR(code); - ZVAL_STRING(code, "Phalcon\\Version::get()", 1); - RETURN_CCTOR(code); + RETURN_MM_STRING("Phalcon\Version::get()", 1); } if (PHALCON_IS_STRING(name, "version_id")) { - PHALCON_INIT_NVAR(code); - ZVAL_STRING(code, "Phalcon\\Version::getId()", 1); - RETURN_CCTOR(code); + RETURN_MM_STRING("Phalcon\Version::getId()", 1); } /** * Read PHP constants in templates */ if (PHALCON_IS_STRING(name, "constant")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "constant(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "constant(", arguments, ")"); + RETURN_MM(); } /** @@ -892,11 +878,9 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ PHALCON_INIT_NVAR(name); phalcon_call_method_p1(name, this_ptr, "expression", name_expr); + PHALCON_CONCAT_VSVS(return_value, name, "(", arguments, ")"); - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_VSVS(code, name, "(", arguments, ")"); - - RETURN_CCTOR(code); + RETURN_MM(); } /** @@ -908,7 +892,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, functionCall){ */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest){ - zval *test, *left, *type, *name = NULL, *code = NULL, *test_name, *test_arguments = NULL; + zval *test, *left, *type, *name = NULL, *test_name, *test_arguments = NULL; zval *arguments = NULL, *right_code; PHALCON_MM_GROW(); @@ -938,54 +922,48 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest){ * Empty uses the PHP's empty operator */ if (PHALCON_IS_STRING(name, "empty")) { - PHALCON_INIT_VAR(code); - PHALCON_CONCAT_SVS(code, "empty(", left, ")"); - RETURN_CTOR(code); + PHALCON_CONCAT_SVS(return_value, "empty(", left, ")"); + RETURN_MM(); } /** * Check if a value is even */ if (PHALCON_IS_STRING(name, "even")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "(((", left, ") % 2) == 0)"); - RETURN_CTOR(code); + PHALCON_CONCAT_SVS(return_value, "(((", left, ") % 2) == 0)"); + RETURN_MM(); } /** * Check if a value is odd */ if (PHALCON_IS_STRING(name, "odd")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "(((", left, ") % 2) != 0)"); - RETURN_CTOR(code); + PHALCON_CONCAT_SVS(return_value, "(((", left, ") % 2) != 0)"); + RETURN_MM(); } /** * Check if a value is numeric */ if (PHALCON_IS_STRING(name, "numeric")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "is_numeric(", left, ")"); - RETURN_CTOR(code); + PHALCON_CONCAT_SVS(return_value, "is_numeric(", left, ")"); + RETURN_MM(); } /** * Check if a value is scalar */ if (PHALCON_IS_STRING(name, "scalar")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "is_scalar(", left, ")"); - RETURN_CTOR(code); + PHALCON_CONCAT_SVS(return_value, "is_scalar(", left, ")"); + RETURN_MM(); } /** * Check if a value is iterable */ if (PHALCON_IS_STRING(name, "iterable")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVSVS(code, "(is_array(", left, ") || (", left, ") instanceof Traversable)"); - RETURN_CTOR(code); + PHALCON_CONCAT_SVSVS(return_value, "(is_array(", left, ") || (", left, ") instanceof Traversable)"); + RETURN_MM(); } } @@ -1009,10 +987,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest){ PHALCON_INIT_VAR(arguments); phalcon_call_method_p1(arguments, this_ptr, "expression", test_arguments); - - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVSVS(code, "(((", left, ") % (", arguments, ")) == 0)"); - RETURN_CTOR(code); + PHALCON_CONCAT_SVSVS(return_value, "(((", left, ") % (", arguments, ")) == 0)"); + RETURN_MM(); } /** @@ -1024,10 +1000,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest){ PHALCON_INIT_NVAR(arguments); phalcon_call_method_p1(arguments, this_ptr, "expression", test_arguments); - - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVSVS(code, "(", left, ") === (", arguments, ")"); - RETURN_CTOR(code); + PHALCON_CONCAT_SVSVS(return_value, "(", left, ") === (", arguments, ")"); + RETURN_MM(); } /** @@ -1039,10 +1013,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest){ PHALCON_INIT_NVAR(arguments); phalcon_call_method_p1(arguments, this_ptr, "expression", test_arguments); - - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVSVS(code, "gettype(", left, ") === (", arguments, ")"); - RETURN_CTOR(code); + PHALCON_CONCAT_SVSVS(return_value, "gettype(", left, ") === (", arguments, ")"); + RETURN_MM(); } } } @@ -1052,11 +1024,9 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveTest){ */ PHALCON_INIT_VAR(right_code); phalcon_call_method_p1(right_code, this_ptr, "expression", test); + PHALCON_CONCAT_VSV(return_value, left, " == ", right_code); - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_VSV(code, left, " == ", right_code); - - RETURN_CTOR(code); + RETURN_MM(); } /** @@ -1206,9 +1176,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter){ * The definition is a string */ if (Z_TYPE_P(definition) == IS_STRING) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_VSVS(code, definition, "(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_VSVS(return_value, definition, "(", arguments, ")"); + RETURN_MM(); } /** @@ -1220,10 +1189,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter){ array_init_size(parameters, 2); phalcon_array_append(¶meters, arguments, PH_SEPARATE); phalcon_array_append(¶meters, func_arguments, PH_SEPARATE); - - PHALCON_INIT_NVAR(code); - phalcon_call_func_p2(code, "call_user_func_array", definition, parameters); - RETURN_CCTOR(code); + phalcon_call_func_p2(return_value, "call_user_func_array", definition, parameters); + RETURN_MM(); } } @@ -1247,144 +1214,128 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter){ * 'length' uses the length method implemented in the Volt adapter */ if (PHALCON_IS_STRING(name, "length")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "$this->length(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "$this->length(", arguments, ")"); + RETURN_MM(); } /** * 'e' filter uses the escaper component */ if (PHALCON_IS_STRING(name, "e")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "$this->escaper->escapeHtml(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "$this->escaper->escapeHtml(", arguments, ")"); + RETURN_MM(); } /** * 'escape' filter uses the escaper component */ if (PHALCON_IS_STRING(name, "escape")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "$this->escaper->escapeHtml(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "$this->escaper->escapeHtml(", arguments, ")"); + RETURN_MM(); } /** * 'escapecss' filter uses the escaper component to filter css */ if (PHALCON_IS_STRING(name, "escape_css")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "$this->escaper->escapeCss(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "$this->escaper->escapeCss(", arguments, ")"); + RETURN_MM(); } /** * 'escapejs' filter uses the escaper component to escape javascript */ if (PHALCON_IS_STRING(name, "escape_js")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "$this->escaper->escapeJs(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "$this->escaper->escapeJs(", arguments, ")"); + RETURN_MM(); } /** * 'escapeattr' filter uses the escaper component to escape html attributes */ if (PHALCON_IS_STRING(name, "escape_attr")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "$this->escaper->escapeHtmlAttr(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "$this->escaper->escapeHtmlAttr(", arguments, ")"); + RETURN_MM(); } /** * 'trim' calls the "trim" function in the PHP userland */ if (PHALCON_IS_STRING(name, "trim")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "trim(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "trim(", arguments, ")"); + RETURN_MM(); } /** * 'left_trim' calls the "ltrim" function in the PHP userland */ if (PHALCON_IS_STRING(name, "left_trim")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "ltrim(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "ltrim(", arguments, ")"); + RETURN_MM(); } /** * 'right_trim' calls the "rtrim" function in the PHP userland */ if (PHALCON_IS_STRING(name, "right_trim")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "rtrim(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "rtrim(", arguments, ")"); + RETURN_MM(); } /** * 'striptags' calls the "strip_tags" function in the PHP userland */ if (PHALCON_IS_STRING(name, "striptags")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "strip_tags(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "strip_tags(", arguments, ")"); + RETURN_MM(); } /** * 'urlencode' calls the "urlencode" function in the PHP userland */ if (PHALCON_IS_STRING(name, "url_encode")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "urlencode(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "urlencode(", arguments, ")"); + RETURN_MM(); } /** * 'slashes' calls the "addslashes" function in the PHP userland */ if (PHALCON_IS_STRING(name, "slashes")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "addslashes(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "addslashes(", arguments, ")"); + RETURN_MM(); } /** * 'stripslashes' calls the "stripslashes" function in the PHP userland */ if (PHALCON_IS_STRING(name, "stripslashes")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "stripslashes(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "stripslashes(", arguments, ")"); + RETURN_MM(); } /** * 'nl2br' calls the "nl2br" function in the PHP userland */ if (PHALCON_IS_STRING(name, "nl2br")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "nl2br(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "nl2br(", arguments, ")"); + RETURN_MM(); } /** * 'keys' uses calls the "array_keys" function in the PHP userland */ if (PHALCON_IS_STRING(name, "keys")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "array_keys(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "array_keys(", arguments, ")"); + RETURN_MM(); } /** * 'join' uses calls the "join" function in the PHP userland */ if (PHALCON_IS_STRING(name, "join")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "join(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "join(", arguments, ")"); + RETURN_MM(); } /** @@ -1392,9 +1343,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter){ * extension is loaded */ if (PHALCON_IS_STRING(name, "lowercase")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "Phalcon\\Text::lower(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "Phalcon\\Text::lower(", arguments, ")"); + RETURN_MM(); } /** @@ -1402,9 +1352,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter){ * extension is loaded */ if (PHALCON_IS_STRING(name, "lower")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "Phalcon\\Text::lower(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "Phalcon\\Text::lower(", arguments, ")"); + RETURN_MM(); } /** @@ -1412,9 +1361,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter){ * extension is loaded */ if (PHALCON_IS_STRING(name, "uppercase")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "Phalcon\\Text::upper(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "Phalcon\\Text::upper(", arguments, ")"); + RETURN_MM(); } /** @@ -1422,81 +1370,72 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter){ * extension is loaded */ if (PHALCON_IS_STRING(name, "upper")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "Phalcon\\Text::upper(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "Phalcon\\Text::upper(", arguments, ")"); + RETURN_MM(); } /** * 'capitalize' filter calls 'ucwords' */ if (PHALCON_IS_STRING(name, "capitalize")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "ucwords(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "ucwords(", arguments, ")"); + RETURN_MM(); } /** * 'sort' calls 'sort' method in the engine adapter */ if (PHALCON_IS_STRING(name, "sort")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "$this->sort(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "$this->sort(", arguments, ")"); + RETURN_MM(); } /** * 'json_encode' calls the "json_encode" function in the PHP userland */ if (PHALCON_IS_STRING(name, "json_encode")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "json_encode(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "json_encode(", arguments, ")"); + RETURN_MM(); } /** * 'json_decode' calls the "json_decode" function in the PHP userland */ if (PHALCON_IS_STRING(name, "json_decode")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "json_decode(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "json_decode(", arguments, ")"); + RETURN_MM(); } /** * 'format' calls the "sprintf" function in the PHP userland */ if (PHALCON_IS_STRING(name, "format")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "sprintf(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "sprintf(", arguments, ")"); + RETURN_MM(); } /** * 'abs' calls the "abs" function in the PHP userland */ if (PHALCON_IS_STRING(name, "abs")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "abs(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "abs(", arguments, ")"); + RETURN_MM(); } /** * 'slice' slices string/arrays/traversable objects */ if (PHALCON_IS_STRING(name, "slice")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "$this->slice(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "$this->slice(", arguments, ")"); + RETURN_MM(); } /** * 'default' checks if a variable is empty */ if (PHALCON_IS_STRING(name, "default")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVSVSVS(code, "(empty(", left, ") ? (", arguments, ") : (", left, "))"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVSVSVS(return_value, "(empty(", left, ") ? (", arguments, ") : (", left, "))"); + RETURN_MM(); } /** @@ -1504,9 +1443,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, resolveFilter){ * another */ if (PHALCON_IS_STRING(name, "convert_encoding")) { - PHALCON_INIT_NVAR(code); - PHALCON_CONCAT_SVS(code, "$this->convertEncoding(", arguments, ")"); - RETURN_CCTOR(code); + PHALCON_CONCAT_SVS(return_value, "$this->convertEncoding(", arguments, ")"); + RETURN_MM(); } /** @@ -2340,7 +2278,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileIf){ */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileElseIf){ - zval *statement, *expr, *expr_code, *compilation; + zval *statement, *expr, *expr_code; PHALCON_MM_GROW(); @@ -2363,9 +2301,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileElseIf){ /** * 'elseif' statement */ - PHALCON_INIT_VAR(compilation); - PHALCON_CONCAT_SVS(compilation, ""); - RETURN_CTOR(compilation); + PHALCON_CONCAT_SVS(return_value, ""); + RETURN_MM(); } /** @@ -2628,20 +2565,18 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileInclude){ PHALCON_INIT_NVAR(path); phalcon_call_method_p1(path, this_ptr, "expression", path_expr); if (!phalcon_array_isset_string(statement, SS("params"))) { - PHALCON_INIT_NVAR(compilation); - PHALCON_CONCAT_SVS(compilation, "partial(", path, "); ?>"); - } else { - PHALCON_OBS_VAR(expr_params); - phalcon_array_fetch_string(&expr_params, statement, SL("params"), PH_NOISY); + PHALCON_CONCAT_SVS(return_value, "partial(", path, "); ?>"); + RETURN_MM(); + } - PHALCON_INIT_VAR(params); - phalcon_call_method_p1(params, this_ptr, "expression", expr_params); + PHALCON_OBS_VAR(expr_params); + phalcon_array_fetch_string(&expr_params, statement, SL("params"), PH_NOISY); - PHALCON_INIT_NVAR(compilation); - PHALCON_CONCAT_SVSVS(compilation, "partial(", path, ", ", params, "); ?>"); - } + PHALCON_INIT_VAR(params); + phalcon_call_method_p1(params, this_ptr, "expression", expr_params); + PHALCON_CONCAT_SVSVS(return_value, "partial(", path, ", ", params, "); ?>"); - RETURN_CCTOR(compilation); + RETURN_MM(); } /** @@ -2749,7 +2684,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileSet){ */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileDo){ - zval *statement, *expr, *expr_code, *compilation; + zval *statement, *expr, *expr_code; PHALCON_MM_GROW(); @@ -2772,10 +2707,9 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileDo){ /** * 'Do' statement */ - PHALCON_INIT_VAR(compilation); - PHALCON_CONCAT_SVS(compilation, ""); + PHALCON_CONCAT_SVS(return_value, ""); - RETURN_CTOR(compilation); + RETURN_MM(); } /** @@ -2787,7 +2721,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileDo){ */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileReturn){ - zval *statement, *expr, *expr_code, *compilation; + zval *statement, *expr, *expr_code; PHALCON_MM_GROW(); @@ -2806,11 +2740,9 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileReturn){ PHALCON_INIT_VAR(expr_code); phalcon_call_method_p1(expr_code, this_ptr, "expression", expr); + PHALCON_CONCAT_SVS(return_value, ""); - PHALCON_INIT_VAR(compilation); - PHALCON_CONCAT_SVS(compilation, ""); - - RETURN_CTOR(compilation); + RETURN_MM(); } /** @@ -3506,7 +3438,6 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, _compileSource){ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileString){ zval *view_code, *extends_mode = NULL, *current_path; - zval *compilation; PHALCON_MM_GROW(); @@ -3525,11 +3456,8 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, compileString){ PHALCON_INIT_VAR(current_path); ZVAL_STRING(current_path, "eval code", 1); phalcon_update_property_this(this_ptr, SL("_currentPath"), current_path TSRMLS_CC); - - PHALCON_INIT_VAR(compilation); - phalcon_call_method_p2(compilation, this_ptr, "_compilesource", view_code, extends_mode); - - RETURN_CCTOR(compilation); + phalcon_call_method_p2(return_value, this_ptr, "_compilesource", view_code, extends_mode); + RETURN_MM(); } /** @@ -3926,7 +3854,7 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, getCompiledTemplatePath){ */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, parse){ - zval *view_code, *current_path, *intermediate; + zval *view_code, *current_path; PHALCON_MM_GROW(); @@ -3934,11 +3862,9 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt_Compiler, parse){ PHALCON_INIT_VAR(current_path); ZVAL_STRING(current_path, "eval code", 1); - - PHALCON_INIT_VAR(intermediate); - if (phvolt_parse_view(intermediate, view_code, current_path TSRMLS_CC) == FAILURE) { + if (phvolt_parse_view(return_value, view_code, current_path TSRMLS_CC) == FAILURE) { return; } - RETURN_CTOR(intermediate); + RETURN_MM(); } diff --git a/ext/phalcon.c b/ext/phalcon.c index 91b4f023e57..8e27d2466ad 100755 --- a/ext/phalcon.c +++ b/ext/phalcon.c @@ -34,24 +34,24 @@ #include "kernel/framework/orm.h" -zend_class_entry *phalcon_text_ce; zend_class_entry *phalcon_di_ce; -zend_class_entry *phalcon_tag_ce; zend_class_entry *phalcon_acl_ce; +zend_class_entry *phalcon_tag_ce; zend_class_entry *phalcon_db_ce; +zend_class_entry *phalcon_text_ce; +zend_class_entry *phalcon_cache_exception_ce; zend_class_entry *phalcon_cache_multiple_ce; zend_class_entry *phalcon_cache_backend_ce; -zend_class_entry *phalcon_cache_exception_ce; zend_class_entry *phalcon_cache_backend_mongo_ce; -zend_class_entry *phalcon_cache_frontend_none_ce; +zend_class_entry *phalcon_cache_frontend_json_ce; zend_class_entry *phalcon_cache_backend_xcache_ce; +zend_class_entry *phalcon_cache_frontend_none_ce; zend_class_entry *phalcon_cache_frontend_data_ce; -zend_class_entry *phalcon_cache_frontend_json_ce; +zend_class_entry *phalcon_cache_backend_file_ce; zend_class_entry *phalcon_cache_backend_memory_ce; zend_class_entry *phalcon_cache_backend_apc_ce; -zend_class_entry *phalcon_cache_backend_file_ce; -zend_class_entry *phalcon_cache_frontendinterface_ce; zend_class_entry *phalcon_cache_frontend_base64_ce; +zend_class_entry *phalcon_cache_frontendinterface_ce; zend_class_entry *phalcon_cache_frontend_igbinary_ce; zend_class_entry *phalcon_cache_backendinterface_ce; zend_class_entry *phalcon_cache_frontend_output_ce; @@ -69,22 +69,22 @@ zend_class_entry *phalcon_validation_exception_ce; zend_class_entry *phalcon_validation_message_ce; zend_class_entry *phalcon_validation_message_group_ce; zend_class_entry *phalcon_validation_validator_between_ce; -zend_class_entry *phalcon_validation_validator_regex_ce; zend_class_entry *phalcon_validation_validator_email_ce; -zend_class_entry *phalcon_validation_validatorinterface_ce; -zend_class_entry *phalcon_validation_validator_inclusionin_ce; +zend_class_entry *phalcon_validation_validator_regex_ce; zend_class_entry *phalcon_validation_validator_exclusionin_ce; +zend_class_entry *phalcon_validation_validator_inclusionin_ce; +zend_class_entry *phalcon_validation_validatorinterface_ce; zend_class_entry *phalcon_validation_validator_identical_ce; zend_class_entry *phalcon_validation_validator_presenceof_ce; zend_class_entry *phalcon_validation_validator_stringlength_ce; zend_class_entry *phalcon_validation_validator_confirmation_ce; zend_class_entry *phalcon_db_index_ce; -zend_class_entry *phalcon_db_reference_ce; -zend_class_entry *phalcon_db_dialect_ce; zend_class_entry *phalcon_db_exception_ce; +zend_class_entry *phalcon_db_dialect_ce; +zend_class_entry *phalcon_db_profiler_ce; +zend_class_entry *phalcon_db_reference_ce; zend_class_entry *phalcon_db_rawvalue_ce; zend_class_entry *phalcon_db_adapter_ce; -zend_class_entry *phalcon_db_profiler_ce; zend_class_entry *phalcon_db_column_ce; zend_class_entry *phalcon_db_adapter_pdo_ce; zend_class_entry *phalcon_db_adapter_pdo_mysql_ce; @@ -94,9 +94,9 @@ zend_class_entry *phalcon_db_adapter_pdo_sqlite_ce; zend_class_entry *phalcon_db_adapter_pdo_postgresql_ce; zend_class_entry *phalcon_db_columninterface_ce; zend_class_entry *phalcon_db_dialect_mysql_ce; -zend_class_entry *phalcon_db_dialectinterface_ce; -zend_class_entry *phalcon_db_dialect_sqlite_ce; zend_class_entry *phalcon_db_dialect_oracle_ce; +zend_class_entry *phalcon_db_dialect_sqlite_ce; +zend_class_entry *phalcon_db_dialectinterface_ce; zend_class_entry *phalcon_db_dialect_postgresql_ce; zend_class_entry *phalcon_db_indexinterface_ce; zend_class_entry *phalcon_db_profiler_item_ce; @@ -111,18 +111,18 @@ zend_class_entry *phalcon_acl_adapterinterface_ce; zend_class_entry *phalcon_acl_adapter_memory_ce; zend_class_entry *phalcon_acl_roleinterface_ce; zend_class_entry *phalcon_acl_resourceinterface_ce; -zend_class_entry *phalcon_session_ce; zend_class_entry *phalcon_security_ce; -zend_class_entry *phalcon_kernel_ce; zend_class_entry *phalcon_version_ce; +zend_class_entry *phalcon_kernel_ce; zend_class_entry *phalcon_debug_ce; +zend_class_entry *phalcon_session_ce; zend_class_entry *phalcon_security_exception_ce; zend_class_entry *phalcon_session_bag_ce; zend_class_entry *phalcon_session_adapter_ce; zend_class_entry *phalcon_session_baginterface_ce; zend_class_entry *phalcon_session_exception_ce; -zend_class_entry *phalcon_session_adapter_files_ce; zend_class_entry *phalcon_session_adapterinterface_ce; +zend_class_entry *phalcon_session_adapter_files_ce; zend_class_entry *phalcon_filter_ce; zend_class_entry *phalcon_di_service_ce; zend_class_entry *phalcon_di_exception_ce; @@ -130,8 +130,8 @@ zend_class_entry *phalcon_di_factorydefault_ce; zend_class_entry *phalcon_di_factorydefault_cli_ce; zend_class_entry *phalcon_di_injectable_ce; zend_class_entry *phalcon_di_injectionawareinterface_ce; -zend_class_entry *phalcon_di_serviceinterface_ce; zend_class_entry *phalcon_di_service_builder_ce; +zend_class_entry *phalcon_di_serviceinterface_ce; zend_class_entry *phalcon_diinterface_ce; zend_class_entry *phalcon_filter_exception_ce; zend_class_entry *phalcon_filterinterface_ce; @@ -141,65 +141,66 @@ zend_class_entry *phalcon_dispatcherinterface_ce; zend_class_entry *phalcon_flash_ce; zend_class_entry *phalcon_cli_task_ce; zend_class_entry *phalcon_flash_direct_ce; -zend_class_entry *phalcon_flash_exception_ce; zend_class_entry *phalcon_flashinterface_ce; zend_class_entry *phalcon_flash_session_ce; -zend_class_entry *phalcon_cli_router_ce; +zend_class_entry *phalcon_flash_exception_ce; zend_class_entry *phalcon_cli_console_ce; +zend_class_entry *phalcon_cli_router_ce; zend_class_entry *phalcon_cli_dispatcher_ce; zend_class_entry *phalcon_cli_console_exception_ce; zend_class_entry *phalcon_cli_dispatcher_exception_ce; zend_class_entry *phalcon_cli_router_exception_ce; zend_class_entry *phalcon_annotations_adapter_ce; zend_class_entry *phalcon_annotations_reader_ce; -zend_class_entry *phalcon_annotations_collection_ce; zend_class_entry *phalcon_annotations_adapter_apc_ce; +zend_class_entry *phalcon_annotations_exception_ce; zend_class_entry *phalcon_annotations_annotation_ce; zend_class_entry *phalcon_annotations_reflection_ce; -zend_class_entry *phalcon_annotations_exception_ce; -zend_class_entry *phalcon_annotations_adapter_files_ce; -zend_class_entry *phalcon_annotations_readerinterface_ce; -zend_class_entry *phalcon_annotations_adapter_memory_ce; +zend_class_entry *phalcon_annotations_collection_ce; zend_class_entry *phalcon_annotations_adapterinterface_ce; zend_class_entry *phalcon_annotations_adapter_xcache_ce; +zend_class_entry *phalcon_annotations_readerinterface_ce; +zend_class_entry *phalcon_annotations_adapter_files_ce; +zend_class_entry *phalcon_annotations_adapter_memory_ce; zend_class_entry *phalcon_config_ce; zend_class_entry *phalcon_logger_ce; zend_class_entry *phalcon_loader_ce; zend_class_entry *phalcon_loader_exception_ce; zend_class_entry *phalcon_logger_item_ce; -zend_class_entry *phalcon_logger_exception_ce; -zend_class_entry *phalcon_logger_adapter_ce; zend_class_entry *phalcon_logger_formatter_ce; +zend_class_entry *phalcon_logger_exception_ce; zend_class_entry *phalcon_logger_multiple_ce; +zend_class_entry *phalcon_logger_adapter_ce; zend_class_entry *phalcon_logger_adapter_file_ce; zend_class_entry *phalcon_logger_adapter_syslog_ce; -zend_class_entry *phalcon_logger_adapter_stream_ce; zend_class_entry *phalcon_logger_adapterinterface_ce; -zend_class_entry *phalcon_logger_formatter_syslog_ce; zend_class_entry *phalcon_logger_formatter_json_ce; zend_class_entry *phalcon_logger_formatter_line_ce; +zend_class_entry *phalcon_logger_adapter_stream_ce; +zend_class_entry *phalcon_logger_formatter_syslog_ce; zend_class_entry *phalcon_logger_formatterinterface_ce; zend_class_entry *phalcon_config_exception_ce; zend_class_entry *phalcon_config_adapter_ini_ce; zend_class_entry *phalcon_forms_form_ce; zend_class_entry *phalcon_forms_element_ce; -zend_class_entry *phalcon_forms_manager_ce; zend_class_entry *phalcon_forms_exception_ce; -zend_class_entry *phalcon_forms_element_email_ce; -zend_class_entry *phalcon_forms_element_hidden_ce; -zend_class_entry *phalcon_forms_element_select_ce; +zend_class_entry *phalcon_forms_manager_ce; zend_class_entry *phalcon_forms_element_check_ce; +zend_class_entry *phalcon_forms_element_email_ce; zend_class_entry *phalcon_forms_element_submit_ce; -zend_class_entry *phalcon_forms_element_date_ce; +zend_class_entry *phalcon_forms_element_select_ce; zend_class_entry *phalcon_forms_element_file_ce; +zend_class_entry *phalcon_forms_element_date_ce; +zend_class_entry *phalcon_forms_element_hidden_ce; zend_class_entry *phalcon_forms_element_text_ce; -zend_class_entry *phalcon_forms_element_numeric_ce; zend_class_entry *phalcon_forms_element_textarea_ce; +zend_class_entry *phalcon_forms_elementinterface_ce; +zend_class_entry *phalcon_forms_element_numeric_ce; zend_class_entry *phalcon_forms_element_password_ce; zend_class_entry *phalcon_crypt_ce; zend_class_entry *phalcon_translate_ce; -zend_class_entry *phalcon_translate_adapter_ce; zend_class_entry *phalcon_translate_exception_ce; +zend_class_entry *phalcon_translate_adapter_ce; zend_class_entry *phalcon_translate_adapterinterface_ce; zend_class_entry *phalcon_translate_adapter_nativearray_ce; zend_class_entry *phalcon_cryptinterface_ce; @@ -210,13 +211,13 @@ zend_class_entry *phalcon_escaper_exception_ce; zend_class_entry *phalcon_assets_resource_ce; zend_class_entry *phalcon_assets_manager_ce; zend_class_entry *phalcon_assets_exception_ce; -zend_class_entry *phalcon_assets_resource_css_ce; zend_class_entry *phalcon_assets_collection_ce; zend_class_entry *phalcon_assets_filters_none_ce; zend_class_entry *phalcon_assets_resource_js_ce; zend_class_entry *phalcon_assets_filters_jsmin_ce; -zend_class_entry *phalcon_assets_filters_cssmin_ce; +zend_class_entry *phalcon_assets_resource_css_ce; zend_class_entry *phalcon_assets_filterinterface_ce; +zend_class_entry *phalcon_assets_filters_cssmin_ce; zend_class_entry *phalcon_http_request_ce; zend_class_entry *phalcon_http_cookie_ce; zend_class_entry *phalcon_http_response_ce; @@ -224,110 +225,110 @@ zend_class_entry *phalcon_http_request_file_ce; zend_class_entry *phalcon_http_cookie_exception_ce; zend_class_entry *phalcon_http_responseinterface_ce; zend_class_entry *phalcon_http_requestinterface_ce; -zend_class_entry *phalcon_http_response_headers_ce; -zend_class_entry *phalcon_http_response_cookies_ce; zend_class_entry *phalcon_http_response_exception_ce; +zend_class_entry *phalcon_http_response_cookies_ce; +zend_class_entry *phalcon_http_response_headers_ce; zend_class_entry *phalcon_http_request_exception_ce; zend_class_entry *phalcon_http_request_fileinterface_ce; -zend_class_entry *phalcon_http_response_cookiesinterface_ce; zend_class_entry *phalcon_http_response_headersinterface_ce; +zend_class_entry *phalcon_http_response_cookiesinterface_ce; zend_class_entry *phalcon_queue_beanstalk_ce; zend_class_entry *phalcon_queue_beanstalk_job_ce; zend_class_entry *phalcon_mvc_url_ce; zend_class_entry *phalcon_mvc_view_ce; zend_class_entry *phalcon_mvc_router_ce; -zend_class_entry *phalcon_mvc_micro_ce; zend_class_entry *phalcon_mvc_model_ce; +zend_class_entry *phalcon_mvc_micro_ce; +zend_class_entry *phalcon_mvc_user_module_ce; +zend_class_entry *phalcon_mvc_user_plugin_ce; +zend_class_entry *phalcon_mvc_urlinterface_ce; zend_class_entry *phalcon_mvc_view_engine_ce; -zend_class_entry *phalcon_mvc_controller_ce; +zend_class_entry *phalcon_mvc_view_simple_ce; +zend_class_entry *phalcon_mvc_dispatcher_ce; zend_class_entry *phalcon_mvc_collection_ce; zend_class_entry *phalcon_mvc_application_ce; -zend_class_entry *phalcon_mvc_dispatcher_ce; -zend_class_entry *phalcon_mvc_urlinterface_ce; -zend_class_entry *phalcon_mvc_user_plugin_ce; -zend_class_entry *phalcon_mvc_user_module_ce; +zend_class_entry *phalcon_mvc_controller_ce; +zend_class_entry *phalcon_mvc_model_row_ce; zend_class_entry *phalcon_mvc_router_route_ce; zend_class_entry *phalcon_mvc_router_group_ce; -zend_class_entry *phalcon_mvc_view_simple_ce; -zend_class_entry *phalcon_mvc_model_row_ce; zend_class_entry *phalcon_mvc_model_query_ce; zend_class_entry *phalcon_mvc_application_exception_ce; zend_class_entry *phalcon_mvc_collection_manager_ce; zend_class_entry *phalcon_mvc_controllerinterface_ce; +zend_class_entry *phalcon_mvc_collection_document_ce; zend_class_entry *phalcon_mvc_collectioninterface_ce; zend_class_entry *phalcon_mvc_collection_exception_ce; -zend_class_entry *phalcon_mvc_collection_document_ce; zend_class_entry *phalcon_mvc_collection_managerinterface_ce; -zend_class_entry *phalcon_mvc_dispatcherinterface_ce; zend_class_entry *phalcon_mvc_dispatcher_exception_ce; -zend_class_entry *phalcon_mvc_model_exception_ce; -zend_class_entry *phalcon_mvc_model_message_ce; -zend_class_entry *phalcon_mvc_model_behavior_ce; +zend_class_entry *phalcon_mvc_dispatcherinterface_ce; zend_class_entry *phalcon_mvc_model_criteria_ce; -zend_class_entry *phalcon_mvc_micro_exception_ce; -zend_class_entry *phalcon_mvc_micro_collection_ce; +zend_class_entry *phalcon_mvc_model_behavior_ce; zend_class_entry *phalcon_mvc_model_metadata_ce; -zend_class_entry *phalcon_mvc_modelinterface_ce; -zend_class_entry *phalcon_mvc_model_query_lang_ce; -zend_class_entry *phalcon_mvc_model_resultset_ce; -zend_class_entry *phalcon_mvc_model_relation_ce; +zend_class_entry *phalcon_mvc_micro_lazyloader_ce; +zend_class_entry *phalcon_mvc_micro_collection_ce; +zend_class_entry *phalcon_mvc_model_message_ce; zend_class_entry *phalcon_mvc_model_manager_ce; +zend_class_entry *phalcon_mvc_model_relation_ce; +zend_class_entry *phalcon_mvc_micro_exception_ce; +zend_class_entry *phalcon_mvc_model_resultset_ce; +zend_class_entry *phalcon_mvc_model_exception_ce; zend_class_entry *phalcon_mvc_model_validator_ce; -zend_class_entry *phalcon_mvc_micro_lazyloader_ce; +zend_class_entry *phalcon_mvc_modelinterface_ce; +zend_class_entry *phalcon_mvc_model_query_lang_ce; zend_class_entry *phalcon_mvc_micro_collectioninterface_ce; zend_class_entry *phalcon_mvc_micro_middlewareinterface_ce; -zend_class_entry *phalcon_mvc_model_transaction_ce; -zend_class_entry *phalcon_mvc_model_query_status_ce; +zend_class_entry *phalcon_mvc_model_query_builder_ce; zend_class_entry *phalcon_mvc_model_validator_url_ce; +zend_class_entry *phalcon_mvc_model_transaction_ce; zend_class_entry *phalcon_mvc_model_queryinterface_ce; -zend_class_entry *phalcon_mvc_model_metadata_files_ce; +zend_class_entry *phalcon_mvc_model_query_status_ce; zend_class_entry *phalcon_mvc_model_metadata_apc_ce; -zend_class_entry *phalcon_mvc_model_query_builder_ce; -zend_class_entry *phalcon_mvc_model_resultset_simple_ce; -zend_class_entry *phalcon_mvc_model_resultinterface_ce; -zend_class_entry *phalcon_mvc_model_metadata_memory_ce; -zend_class_entry *phalcon_mvc_model_resultset_complex_ce; -zend_class_entry *phalcon_mvc_model_metadata_xcache_ce; -zend_class_entry *phalcon_mvc_model_validator_email_ce; -zend_class_entry *phalcon_mvc_model_behaviorinterface_ce; +zend_class_entry *phalcon_mvc_model_metadata_files_ce; zend_class_entry *phalcon_mvc_model_resultsetinterface_ce; +zend_class_entry *phalcon_mvc_model_behaviorinterface_ce; +zend_class_entry *phalcon_mvc_model_resultinterface_ce; zend_class_entry *phalcon_mvc_model_metadatainterface_ce; +zend_class_entry *phalcon_mvc_model_metadata_xcache_ce; +zend_class_entry *phalcon_mvc_model_resultset_simple_ce; +zend_class_entry *phalcon_mvc_model_resultset_complex_ce; +zend_class_entry *phalcon_mvc_model_metadata_memory_ce; zend_class_entry *phalcon_mvc_model_validatorinterface_ce; zend_class_entry *phalcon_mvc_model_transaction_failed_ce; -zend_class_entry *phalcon_mvc_model_relationinterface_ce; -zend_class_entry *phalcon_mvc_model_criteriainterface_ce; zend_class_entry *phalcon_mvc_model_managerinterface_ce; +zend_class_entry *phalcon_mvc_model_criteriainterface_ce; +zend_class_entry *phalcon_mvc_model_relationinterface_ce; +zend_class_entry *phalcon_mvc_model_validator_email_ce; zend_class_entry *phalcon_mvc_model_metadata_session_ce; +zend_class_entry *phalcon_mvc_model_validator_regex_ce; zend_class_entry *phalcon_mvc_model_messageinterface_ce; zend_class_entry *phalcon_mvc_model_validationfailed_ce; -zend_class_entry *phalcon_mvc_model_validator_regex_ce; zend_class_entry *phalcon_mvc_model_query_builderinterface_ce; zend_class_entry *phalcon_mvc_model_behavior_timestampable_ce; zend_class_entry *phalcon_mvc_model_query_statusinterface_ce; -zend_class_entry *phalcon_mvc_model_validator_exclusionin_ce; +zend_class_entry *phalcon_mvc_model_transaction_exception_ce; zend_class_entry *phalcon_mvc_model_validator_stringlength_ce; zend_class_entry *phalcon_mvc_model_transactioninterface_ce; -zend_class_entry *phalcon_mvc_model_validator_inclusionin_ce; -zend_class_entry *phalcon_mvc_model_transaction_exception_ce; zend_class_entry *phalcon_mvc_model_validator_numericality_ce; +zend_class_entry *phalcon_mvc_model_validator_inclusionin_ce; +zend_class_entry *phalcon_mvc_model_validator_exclusionin_ce; zend_class_entry *phalcon_mvc_model_transaction_manager_ce; zend_class_entry *phalcon_mvc_model_validator_uniqueness_ce; zend_class_entry *phalcon_mvc_model_validator_presenceof_ce; zend_class_entry *phalcon_mvc_model_behavior_softdelete_ce; -zend_class_entry *phalcon_mvc_model_transaction_managerinterface_ce; zend_class_entry *phalcon_mvc_model_metadata_strategy_annotations_ce; +zend_class_entry *phalcon_mvc_model_transaction_managerinterface_ce; zend_class_entry *phalcon_mvc_model_metadata_strategy_introspection_ce; zend_class_entry *phalcon_mvc_moduledefinitioninterface_ce; -zend_class_entry *phalcon_mvc_routerinterface_ce; zend_class_entry *phalcon_mvc_router_exception_ce; +zend_class_entry *phalcon_mvc_routerinterface_ce; zend_class_entry *phalcon_mvc_router_annotations_ce; zend_class_entry *phalcon_mvc_router_routeinterface_ce; -zend_class_entry *phalcon_mvc_url_exception_ce; zend_class_entry *phalcon_mvc_user_component_ce; -zend_class_entry *phalcon_mvc_view_engine_volt_ce; +zend_class_entry *phalcon_mvc_url_exception_ce; +zend_class_entry *phalcon_mvc_view_exception_ce; zend_class_entry *phalcon_mvc_view_engine_php_ce; zend_class_entry *phalcon_mvc_viewinterface_ce; -zend_class_entry *phalcon_mvc_view_exception_ce; +zend_class_entry *phalcon_mvc_view_engine_volt_ce; zend_class_entry *phalcon_mvc_view_engineinterface_ce; zend_class_entry *phalcon_mvc_view_engine_volt_compiler_ce; zend_class_entry *phalcon_events_event_ce; @@ -366,36 +367,37 @@ PHP_MINIT_FUNCTION(phalcon){ ZEND_INIT_MODULE_GLOBALS(phalcon, php_phalcon_init_globals, NULL); PHALCON_INIT(Phalcon_DI_InjectionAwareInterface); - PHALCON_INIT(Phalcon_Validation_ValidatorInterface); + PHALCON_INIT(Phalcon_Forms_ElementInterface); PHALCON_INIT(Phalcon_Mvc_Model_ValidatorInterface); + PHALCON_INIT(Phalcon_Validation_ValidatorInterface); PHALCON_INIT(Phalcon_Events_EventsAwareInterface); PHALCON_INIT(Phalcon_Cache_BackendInterface); PHALCON_INIT(Phalcon_Cache_FrontendInterface); PHALCON_INIT(Phalcon_Mvc_Model_MetaDataInterface); - PHALCON_INIT(Phalcon_Db_AdapterInterface); PHALCON_INIT(Phalcon_Db_DialectInterface); + PHALCON_INIT(Phalcon_Db_AdapterInterface); PHALCON_INIT(Phalcon_Annotations_AdapterInterface); PHALCON_INIT(Phalcon_Logger_AdapterInterface); PHALCON_INIT(Phalcon_Logger_FormatterInterface); PHALCON_INIT(Phalcon_Paginator_AdapterInterface); + PHALCON_INIT(Phalcon_Mvc_View_EngineInterface); PHALCON_INIT(Phalcon_Mvc_Model_ResultsetInterface); + PHALCON_INIT(Phalcon_Mvc_Model_BehaviorInterface); PHALCON_INIT(Phalcon_FlashInterface); - PHALCON_INIT(Phalcon_Mvc_View_EngineInterface); PHALCON_INIT(Phalcon_Mvc_Model_ResultInterface); - PHALCON_INIT(Phalcon_Mvc_Model_BehaviorInterface); PHALCON_INIT(Phalcon_Exception); PHALCON_INIT(Phalcon_Db_Adapter); PHALCON_INIT(Phalcon_DispatcherInterface); PHALCON_INIT(Phalcon_DI_Injectable); - PHALCON_INIT(Phalcon_Mvc_Model_TransactionInterface); - PHALCON_INIT(Phalcon_Mvc_Model_ManagerInterface); - PHALCON_INIT(Phalcon_Mvc_CollectionInterface); + PHALCON_INIT(Phalcon_Mvc_DispatcherInterface); PHALCON_INIT(Phalcon_Mvc_Model_QueryInterface); + PHALCON_INIT(Phalcon_Mvc_Router_RouteInterface); PHALCON_INIT(Phalcon_Mvc_Model_Query_StatusInterface); - PHALCON_INIT(Phalcon_Mvc_DispatcherInterface); PHALCON_INIT(Phalcon_Mvc_Model_Query_BuilderInterface); - PHALCON_INIT(Phalcon_Mvc_ModelInterface); - PHALCON_INIT(Phalcon_Mvc_Router_RouteInterface); + PHALCON_INIT(Phalcon_Mvc_CollectionInterface); + PHALCON_INIT(Phalcon_Mvc_Model_TransactionInterface); + PHALCON_INIT(Phalcon_Mvc_UrlInterface); + PHALCON_INIT(Phalcon_Mvc_ViewInterface); PHALCON_INIT(Phalcon_Http_RequestInterface); PHALCON_INIT(Phalcon_Http_ResponseInterface); PHALCON_INIT(Phalcon_Db_ReferenceInterface); @@ -403,54 +405,54 @@ PHP_MINIT_FUNCTION(phalcon){ PHALCON_INIT(Phalcon_Db_IndexInterface); PHALCON_INIT(Phalcon_Http_Request_FileInterface); PHALCON_INIT(Phalcon_Http_Response_CookiesInterface); - PHALCON_INIT(Phalcon_Mvc_UrlInterface); - PHALCON_INIT(Phalcon_Mvc_ViewInterface); + PHALCON_INIT(Phalcon_Mvc_ModelInterface); PHALCON_INIT(Phalcon_Mvc_Micro_CollectionInterface); PHALCON_INIT(Phalcon_Mvc_RouterInterface); PHALCON_INIT(Phalcon_Http_Response_HeadersInterface); PHALCON_INIT(Phalcon_DiInterface); PHALCON_INIT(Phalcon_Mvc_Model_RelationInterface); - PHALCON_INIT(Phalcon_Mvc_Model_MessageInterface); + PHALCON_INIT(Phalcon_Acl_ResourceInterface); + PHALCON_INIT(Phalcon_Mvc_Model_ManagerInterface); PHALCON_INIT(Phalcon_FilterInterface); + PHALCON_INIT(Phalcon_CryptInterface); + PHALCON_INIT(Phalcon_Acl_RoleInterface); + PHALCON_INIT(Phalcon_Session_BagInterface); + PHALCON_INIT(Phalcon_Session_AdapterInterface); + PHALCON_INIT(Phalcon_DI_ServiceInterface); + PHALCON_INIT(Phalcon_Annotations_ReaderInterface); PHALCON_INIT(Phalcon_Events_ManagerInterface); PHALCON_INIT(Phalcon_EscaperInterface); - PHALCON_INIT(Phalcon_Session_AdapterInterface); - PHALCON_INIT(Phalcon_Acl_ResourceInterface); - PHALCON_INIT(Phalcon_Session_BagInterface); PHALCON_INIT(Phalcon_Acl_AdapterInterface); - PHALCON_INIT(Phalcon_Mvc_Model_CriteriaInterface); - PHALCON_INIT(Phalcon_DI_ServiceInterface); - PHALCON_INIT(Phalcon_CryptInterface); PHALCON_INIT(Phalcon_Mvc_Model_Transaction_ManagerInterface); - PHALCON_INIT(Phalcon_Acl_RoleInterface); - PHALCON_INIT(Phalcon_Annotations_ReaderInterface); + PHALCON_INIT(Phalcon_Mvc_Model_CriteriaInterface); PHALCON_INIT(Phalcon_Translate_AdapterInterface); + PHALCON_INIT(Phalcon_Mvc_Model_MessageInterface); PHALCON_INIT(Phalcon_Mvc_Model_Exception); PHALCON_INIT(Phalcon_DI); PHALCON_INIT(Phalcon_Forms_Element); - PHALCON_INIT(Phalcon_Mvc_Model_Validator); PHALCON_INIT(Phalcon_Validation_Validator); + PHALCON_INIT(Phalcon_Mvc_Model_Validator); PHALCON_INIT(Phalcon_Cache_Backend); PHALCON_INIT(Phalcon_Mvc_Model_MetaData); - PHALCON_INIT(Phalcon_Annotations_Adapter); - PHALCON_INIT(Phalcon_Db_Dialect); PHALCON_INIT(Phalcon_Db_Adapter_Pdo); - PHALCON_INIT(Phalcon_Logger_Formatter); + PHALCON_INIT(Phalcon_Db_Dialect); + PHALCON_INIT(Phalcon_Annotations_Adapter); PHALCON_INIT(Phalcon_Logger_Adapter); - PHALCON_INIT(Phalcon_Dispatcher); - PHALCON_INIT(Phalcon_Flash); - PHALCON_INIT(Phalcon_Mvc_Model_Behavior); + PHALCON_INIT(Phalcon_Logger_Formatter); PHALCON_INIT(Phalcon_Mvc_Model_Resultset); + PHALCON_INIT(Phalcon_Mvc_Model_Behavior); PHALCON_INIT(Phalcon_Assets_Resource); + PHALCON_INIT(Phalcon_Flash); + PHALCON_INIT(Phalcon_Dispatcher); PHALCON_INIT(Phalcon_Mvc_View_Engine); - PHALCON_INIT(Phalcon_Session_Adapter); PHALCON_INIT(Phalcon_Translate_Adapter); - PHALCON_INIT(Phalcon_Mvc_Model_Transaction_Exception); PHALCON_INIT(Phalcon_Cache_Frontend_Data); + PHALCON_INIT(Phalcon_DI_FactoryDefault); PHALCON_INIT(Phalcon_Config); + PHALCON_INIT(Phalcon_Mvc_Model_Transaction_Exception); PHALCON_INIT(Phalcon_Mvc_Router); - PHALCON_INIT(Phalcon_DI_FactoryDefault); PHALCON_INIT(Phalcon_Acl_Adapter); + PHALCON_INIT(Phalcon_Session_Adapter); PHALCON_INIT(Phalcon_Db); PHALCON_INIT(Phalcon_Acl); PHALCON_INIT(Phalcon_Tag); @@ -462,32 +464,32 @@ PHP_MINIT_FUNCTION(phalcon){ PHALCON_INIT(Phalcon_Cache_Backend_Xcache); PHALCON_INIT(Phalcon_Cache_Backend_Mongo); PHALCON_INIT(Phalcon_Cache_Backend_Memcache); - PHALCON_INIT(Phalcon_Cache_Frontend_None); PHALCON_INIT(Phalcon_Cache_Frontend_Json); PHALCON_INIT(Phalcon_Cache_Frontend_Output); + PHALCON_INIT(Phalcon_Cache_Frontend_None); PHALCON_INIT(Phalcon_Cache_Frontend_Base64); PHALCON_INIT(Phalcon_Cache_Frontend_Igbinary); PHALCON_INIT(Phalcon_Tag_Select); PHALCON_INIT(Phalcon_Tag_Exception); PHALCON_INIT(Phalcon_Paginator_Exception); PHALCON_INIT(Phalcon_Paginator_Adapter_Model); - PHALCON_INIT(Phalcon_Paginator_Adapter_QueryBuilder); PHALCON_INIT(Phalcon_Paginator_Adapter_NativeArray); + PHALCON_INIT(Phalcon_Paginator_Adapter_QueryBuilder); PHALCON_INIT(Phalcon_Validation); PHALCON_INIT(Phalcon_Validation_Message); PHALCON_INIT(Phalcon_Validation_Exception); PHALCON_INIT(Phalcon_Validation_Message_Group); - PHALCON_INIT(Phalcon_Validation_Validator_Email); PHALCON_INIT(Phalcon_Validation_Validator_Regex); + PHALCON_INIT(Phalcon_Validation_Validator_Email); PHALCON_INIT(Phalcon_Validation_Validator_Between); PHALCON_INIT(Phalcon_Validation_Validator_Identical); + PHALCON_INIT(Phalcon_Validation_Validator_PresenceOf); + PHALCON_INIT(Phalcon_Validation_Validator_InclusionIn); PHALCON_INIT(Phalcon_Validation_Validator_StringLength); PHALCON_INIT(Phalcon_Validation_Validator_ExclusionIn); PHALCON_INIT(Phalcon_Validation_Validator_Confirmation); - PHALCON_INIT(Phalcon_Validation_Validator_InclusionIn); - PHALCON_INIT(Phalcon_Validation_Validator_PresenceOf); - PHALCON_INIT(Phalcon_Db_Column); PHALCON_INIT(Phalcon_Db_Index); + PHALCON_INIT(Phalcon_Db_Column); PHALCON_INIT(Phalcon_Db_Adapter_Pdo_Sqlite); PHALCON_INIT(Phalcon_Db_Adapter_Pdo_Mysql); PHALCON_INIT(Phalcon_Db_Adapter_Pdo_Oracle); @@ -508,8 +510,8 @@ PHP_MINIT_FUNCTION(phalcon){ PHALCON_INIT(Phalcon_Acl_Adapter_Memory); PHALCON_INIT(Phalcon_Acl_Exception); PHALCON_INIT(Phalcon_Kernel); - PHALCON_INIT(Phalcon_Text); PHALCON_INIT(Phalcon_Debug); + PHALCON_INIT(Phalcon_Text); PHALCON_INIT(Phalcon_Security); PHALCON_INIT(Phalcon_Security_Exception); PHALCON_INIT(Phalcon_Version); @@ -537,40 +539,40 @@ PHP_MINIT_FUNCTION(phalcon){ PHALCON_INIT(Phalcon_Annotations_Reader); PHALCON_INIT(Phalcon_Annotations_Exception); PHALCON_INIT(Phalcon_Annotations_Annotation); - PHALCON_INIT(Phalcon_Annotations_Reflection); - PHALCON_INIT(Phalcon_Annotations_Collection); PHALCON_INIT(Phalcon_Annotations_Adapter_Apc); + PHALCON_INIT(Phalcon_Annotations_Collection); + PHALCON_INIT(Phalcon_Annotations_Reflection); PHALCON_INIT(Phalcon_Annotations_Adapter_Xcache); PHALCON_INIT(Phalcon_Annotations_Adapter_Files); PHALCON_INIT(Phalcon_Annotations_Adapter_Memory); - PHALCON_INIT(Phalcon_Logger); PHALCON_INIT(Phalcon_Loader); + PHALCON_INIT(Phalcon_Logger); PHALCON_INIT(Phalcon_Loader_Exception); PHALCON_INIT(Phalcon_Logger_Item); PHALCON_INIT(Phalcon_Logger_Multiple); PHALCON_INIT(Phalcon_Logger_Exception); - PHALCON_INIT(Phalcon_Logger_Formatter_Line); PHALCON_INIT(Phalcon_Logger_Formatter_Json); - PHALCON_INIT(Phalcon_Logger_Adapter_File); - PHALCON_INIT(Phalcon_Logger_Adapter_Syslog); + PHALCON_INIT(Phalcon_Logger_Formatter_Line); PHALCON_INIT(Phalcon_Logger_Adapter_Stream); + PHALCON_INIT(Phalcon_Logger_Adapter_Syslog); + PHALCON_INIT(Phalcon_Logger_Adapter_File); PHALCON_INIT(Phalcon_Logger_Formatter_Syslog); PHALCON_INIT(Phalcon_Config_Adapter_Ini); PHALCON_INIT(Phalcon_Config_Exception); PHALCON_INIT(Phalcon_Forms_Form); PHALCON_INIT(Phalcon_Forms_Manager); PHALCON_INIT(Phalcon_Forms_Exception); - PHALCON_INIT(Phalcon_Forms_Element_File); - PHALCON_INIT(Phalcon_Forms_Element_Date); PHALCON_INIT(Phalcon_Forms_Element_Text); - PHALCON_INIT(Phalcon_Forms_Element_Numeric); - PHALCON_INIT(Phalcon_Forms_Element_Submit); - PHALCON_INIT(Phalcon_Forms_Element_Select); - PHALCON_INIT(Phalcon_Forms_Element_Email); + PHALCON_INIT(Phalcon_Forms_Element_Date); + PHALCON_INIT(Phalcon_Forms_Element_File); PHALCON_INIT(Phalcon_Forms_Element_Hidden); + PHALCON_INIT(Phalcon_Forms_Element_Select); PHALCON_INIT(Phalcon_Forms_Element_Check); - PHALCON_INIT(Phalcon_Forms_Element_TextArea); + PHALCON_INIT(Phalcon_Forms_Element_Numeric); + PHALCON_INIT(Phalcon_Forms_Element_Email); + PHALCON_INIT(Phalcon_Forms_Element_Submit); PHALCON_INIT(Phalcon_Forms_Element_Password); + PHALCON_INIT(Phalcon_Forms_Element_TextArea); PHALCON_INIT(Phalcon_Crypt); PHALCON_INIT(Phalcon_Translate); PHALCON_INIT(Phalcon_Translate_Exception); @@ -579,16 +581,16 @@ PHP_MINIT_FUNCTION(phalcon){ PHALCON_INIT(Phalcon_Escaper); PHALCON_INIT(Phalcon_Escaper_Exception); PHALCON_INIT(Phalcon_Assets_Manager); - PHALCON_INIT(Phalcon_Assets_Exception); PHALCON_INIT(Phalcon_Assets_Resource_Js); PHALCON_INIT(Phalcon_Assets_Collection); - PHALCON_INIT(Phalcon_Assets_Filters_Jsmin); + PHALCON_INIT(Phalcon_Assets_Exception); PHALCON_INIT(Phalcon_Assets_Filters_None); - PHALCON_INIT(Phalcon_Assets_Resource_Css); PHALCON_INIT(Phalcon_Assets_Filters_Cssmin); + PHALCON_INIT(Phalcon_Assets_Filters_Jsmin); + PHALCON_INIT(Phalcon_Assets_Resource_Css); PHALCON_INIT(Phalcon_Assets_FilterInterface); - PHALCON_INIT(Phalcon_Http_Cookie); PHALCON_INIT(Phalcon_Http_Request); + PHALCON_INIT(Phalcon_Http_Cookie); PHALCON_INIT(Phalcon_Http_Response); PHALCON_INIT(Phalcon_Http_Cookie_Exception); PHALCON_INIT(Phalcon_Http_Request_File); diff --git a/ext/phalcon.h b/ext/phalcon.h index d73f661c674..34792c2ac29 100755 --- a/ext/phalcon.h +++ b/ext/phalcon.h @@ -18,36 +18,37 @@ */ #include "di/injectionawareinterface.h" -#include "validation/validatorinterface.h" +#include "forms/elementinterface.h" #include "mvc/model/validatorinterface.h" +#include "validation/validatorinterface.h" #include "events/eventsawareinterface.h" #include "cache/backendinterface.h" #include "cache/frontendinterface.h" #include "mvc/model/metadatainterface.h" -#include "db/adapterinterface.h" #include "db/dialectinterface.h" +#include "db/adapterinterface.h" #include "annotations/adapterinterface.h" #include "logger/adapterinterface.h" #include "logger/formatterinterface.h" #include "paginator/adapterinterface.h" +#include "mvc/view/engineinterface.h" #include "mvc/model/resultsetinterface.h" +#include "mvc/model/behaviorinterface.h" #include "flashinterface.h" -#include "mvc/view/engineinterface.h" #include "mvc/model/resultinterface.h" -#include "mvc/model/behaviorinterface.h" #include "exception.h" #include "db/adapter.h" #include "dispatcherinterface.h" #include "di/injectable.h" -#include "mvc/model/transactioninterface.h" -#include "mvc/model/managerinterface.h" -#include "mvc/collectioninterface.h" +#include "mvc/dispatcherinterface.h" #include "mvc/model/queryinterface.h" +#include "mvc/router/routeinterface.h" #include "mvc/model/query/statusinterface.h" -#include "mvc/dispatcherinterface.h" #include "mvc/model/query/builderinterface.h" -#include "mvc/modelinterface.h" -#include "mvc/router/routeinterface.h" +#include "mvc/collectioninterface.h" +#include "mvc/model/transactioninterface.h" +#include "mvc/urlinterface.h" +#include "mvc/viewinterface.h" #include "http/requestinterface.h" #include "http/responseinterface.h" #include "db/referenceinterface.h" @@ -55,54 +56,54 @@ #include "db/indexinterface.h" #include "http/request/fileinterface.h" #include "http/response/cookiesinterface.h" -#include "mvc/urlinterface.h" -#include "mvc/viewinterface.h" +#include "mvc/modelinterface.h" #include "mvc/micro/collectioninterface.h" #include "mvc/routerinterface.h" #include "http/response/headersinterface.h" #include "diinterface.h" #include "mvc/model/relationinterface.h" -#include "mvc/model/messageinterface.h" +#include "acl/resourceinterface.h" +#include "mvc/model/managerinterface.h" #include "filterinterface.h" +#include "cryptinterface.h" +#include "acl/roleinterface.h" +#include "session/baginterface.h" +#include "session/adapterinterface.h" +#include "di/serviceinterface.h" +#include "annotations/readerinterface.h" #include "events/managerinterface.h" #include "escaperinterface.h" -#include "session/adapterinterface.h" -#include "acl/resourceinterface.h" -#include "session/baginterface.h" #include "acl/adapterinterface.h" -#include "mvc/model/criteriainterface.h" -#include "di/serviceinterface.h" -#include "cryptinterface.h" #include "mvc/model/transaction/managerinterface.h" -#include "acl/roleinterface.h" -#include "annotations/readerinterface.h" +#include "mvc/model/criteriainterface.h" #include "translate/adapterinterface.h" +#include "mvc/model/messageinterface.h" #include "mvc/model/exception.h" #include "di.h" #include "forms/element.h" -#include "mvc/model/validator.h" #include "validation/validator.h" +#include "mvc/model/validator.h" #include "cache/backend.h" #include "mvc/model/metadata.h" -#include "annotations/adapter.h" -#include "db/dialect.h" #include "db/adapter/pdo.h" -#include "logger/formatter.h" +#include "db/dialect.h" +#include "annotations/adapter.h" #include "logger/adapter.h" -#include "dispatcher.h" -#include "flash.h" -#include "mvc/model/behavior.h" +#include "logger/formatter.h" #include "mvc/model/resultset.h" +#include "mvc/model/behavior.h" #include "assets/resource.h" +#include "flash.h" +#include "dispatcher.h" #include "mvc/view/engine.h" -#include "session/adapter.h" #include "translate/adapter.h" -#include "mvc/model/transaction/exception.h" #include "cache/frontend/data.h" +#include "di/factorydefault.h" #include "pconfig.h" +#include "mvc/model/transaction/exception.h" #include "mvc/router.h" -#include "di/factorydefault.h" #include "acl/adapter.h" +#include "session/adapter.h" #include "db.h" #include "acl.h" #include "tag.h" @@ -114,32 +115,32 @@ #include "cache/backend/xcache.h" #include "cache/backend/mongo.h" #include "cache/backend/memcache.h" -#include "cache/frontend/none.h" #include "cache/frontend/json.h" #include "cache/frontend/output.h" +#include "cache/frontend/none.h" #include "cache/frontend/base64.h" #include "cache/frontend/igbinary.h" #include "tag/select.h" #include "tag/exception.h" #include "paginator/exception.h" #include "paginator/adapter/model.h" -#include "paginator/adapter/querybuilder.h" #include "paginator/adapter/nativearray.h" +#include "paginator/adapter/querybuilder.h" #include "validation.h" #include "validation/message.h" #include "validation/exception.h" #include "validation/message/group.h" -#include "validation/validator/email.h" #include "validation/validator/regex.h" +#include "validation/validator/email.h" #include "validation/validator/between.h" #include "validation/validator/identical.h" +#include "validation/validator/presenceof.h" +#include "validation/validator/inclusionin.h" #include "validation/validator/stringlength.h" #include "validation/validator/exclusionin.h" #include "validation/validator/confirmation.h" -#include "validation/validator/inclusionin.h" -#include "validation/validator/presenceof.h" -#include "db/column.h" #include "db/index.h" +#include "db/column.h" #include "db/adapter/pdo/sqlite.h" #include "db/adapter/pdo/mysql.h" #include "db/adapter/pdo/oracle.h" @@ -160,8 +161,8 @@ #include "acl/adapter/memory.h" #include "acl/exception.h" #include "kernel.h" -#include "text.h" #include "debug.h" +#include "text.h" #include "security.h" #include "security/exception.h" #include "version.h" @@ -189,40 +190,40 @@ #include "annotations/reader.h" #include "annotations/exception.h" #include "annotations/annotation.h" -#include "annotations/reflection.h" -#include "annotations/collection.h" #include "annotations/adapter/apc.h" +#include "annotations/collection.h" +#include "annotations/reflection.h" #include "annotations/adapter/xcache.h" #include "annotations/adapter/files.h" #include "annotations/adapter/memory.h" -#include "logger.h" #include "loader.h" +#include "logger.h" #include "loader/exception.h" #include "logger/item.h" #include "logger/multiple.h" #include "logger/exception.h" -#include "logger/formatter/line.h" #include "logger/formatter/json.h" -#include "logger/adapter/file.h" -#include "logger/adapter/syslog.h" +#include "logger/formatter/line.h" #include "logger/adapter/stream.h" +#include "logger/adapter/syslog.h" +#include "logger/adapter/file.h" #include "logger/formatter/syslog.h" #include "config/adapter/ini.h" #include "config/exception.h" #include "forms/form.h" #include "forms/manager.h" #include "forms/exception.h" -#include "forms/element/file.h" -#include "forms/element/date.h" #include "forms/element/text.h" -#include "forms/element/numeric.h" -#include "forms/element/submit.h" -#include "forms/element/select.h" -#include "forms/element/email.h" +#include "forms/element/date.h" +#include "forms/element/file.h" #include "forms/element/hidden.h" +#include "forms/element/select.h" #include "forms/element/check.h" -#include "forms/element/textarea.h" +#include "forms/element/numeric.h" +#include "forms/element/email.h" +#include "forms/element/submit.h" #include "forms/element/password.h" +#include "forms/element/textarea.h" #include "crypt.h" #include "translate.h" #include "translate/exception.h" @@ -231,16 +232,16 @@ #include "escaper.h" #include "escaper/exception.h" #include "assets/manager.h" -#include "assets/exception.h" #include "assets/resource/js.h" #include "assets/collection.h" -#include "assets/filters/jsmin.h" +#include "assets/exception.h" #include "assets/filters/none.h" -#include "assets/resource/css.h" #include "assets/filters/cssmin.h" +#include "assets/filters/jsmin.h" +#include "assets/resource/css.h" #include "assets/filterinterface.h" -#include "http/cookie.h" #include "http/request.h" +#include "http/cookie.h" #include "http/response.h" #include "http/cookie/exception.h" #include "http/request/file.h" diff --git a/ext/queue/beanstalk.c b/ext/queue/beanstalk.c index e9839a5ff9b..14b99ef9d46 100644 --- a/ext/queue/beanstalk.c +++ b/ext/queue/beanstalk.c @@ -239,7 +239,7 @@ PHP_METHOD(Phalcon_Queue_Beanstalk, put){ PHP_METHOD(Phalcon_Queue_Beanstalk, reserve){ zval *timeout = NULL, *command = NULL, *response, *status, *job_id; - zval *length, *serialized_body, *body, *job; + zval *length, *serialized_body, *body; PHALCON_MM_GROW(); @@ -288,11 +288,10 @@ PHP_METHOD(Phalcon_Queue_Beanstalk, reserve){ /** * Create a beanstalk job abstraction */ - PHALCON_INIT_VAR(job); - object_init_ex(job, phalcon_queue_beanstalk_job_ce); - phalcon_call_method_p3_noret(job, "__construct", this_ptr, job_id, body); + object_init_ex(return_value, phalcon_queue_beanstalk_job_ce); + phalcon_call_method_p3_noret(return_value, "__construct", this_ptr, job_id, body); - RETURN_CTOR(job); + RETURN_MM(); } RETURN_MM_FALSE; @@ -370,7 +369,7 @@ PHP_METHOD(Phalcon_Queue_Beanstalk, watch){ PHP_METHOD(Phalcon_Queue_Beanstalk, peekReady){ zval *command, *response, *status, *job_id, *length; - zval *serialized_body, *body, *job; + zval *serialized_body, *body; PHALCON_MM_GROW(); @@ -395,12 +394,10 @@ PHP_METHOD(Phalcon_Queue_Beanstalk, peekReady){ PHALCON_INIT_VAR(body); phalcon_unserialize(body, serialized_body TSRMLS_CC); + object_init_ex(return_value, phalcon_queue_beanstalk_job_ce); + phalcon_call_method_p3_noret(return_value, "__construct", this_ptr, job_id, body); - PHALCON_INIT_VAR(job); - object_init_ex(job, phalcon_queue_beanstalk_job_ce); - phalcon_call_method_p3_noret(job, "__construct", this_ptr, job_id, body); - - RETURN_CTOR(job); + RETURN_MM(); } RETURN_MM_FALSE; @@ -413,16 +410,14 @@ PHP_METHOD(Phalcon_Queue_Beanstalk, peekReady){ */ PHP_METHOD(Phalcon_Queue_Beanstalk, readStatus){ - zval *response, *parts; + zval *response; PHALCON_MM_GROW(); PHALCON_INIT_VAR(response); phalcon_call_method(response, this_ptr, "read"); - - PHALCON_INIT_VAR(parts); - phalcon_fast_explode_str(parts, SL(" "), response TSRMLS_CC); - RETURN_CTOR(parts); + phalcon_fast_explode_str(return_value, SL(" "), response TSRMLS_CC); + RETURN_MM(); } /** @@ -512,7 +507,6 @@ PHP_METHOD(Phalcon_Queue_Beanstalk, read){ PHP_METHOD(Phalcon_Queue_Beanstalk, write){ zval *data, *connection = NULL, *packet, *data_length; - zval *status; PHALCON_MM_GROW(); @@ -534,11 +528,8 @@ PHP_METHOD(Phalcon_Queue_Beanstalk, write){ PHALCON_INIT_VAR(data_length); phalcon_fast_strlen(data_length, packet); - - PHALCON_INIT_VAR(status); - phalcon_call_func_p3(status, "fwrite", connection, packet, data_length); - - RETURN_CCTOR(status); + phalcon_call_func_p3(return_value, "fwrite", connection, packet, data_length); + RETURN_MM(); } /** diff --git a/ext/validation.c b/ext/validation.c index 93436cb161f..e5770cda4dd 100644 --- a/ext/validation.c +++ b/ext/validation.c @@ -420,7 +420,7 @@ PHP_METHOD(Phalcon_Validation, getValue){ PHALCON_INIT_NVAR(value); phalcon_call_method(value, entity, "readattribute"); } else { - if (phalcon_isset_property_zval(entity, attribute TSRMLS_CC)) { + if (phalcon_isset_property_zval(entity, attribute)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, entity, attribute, PH_NOISY_CC); } else { @@ -461,7 +461,7 @@ PHP_METHOD(Phalcon_Validation, getValue){ } } else { if (Z_TYPE_P(data) == IS_OBJECT) { - if (phalcon_isset_property_zval(data, attribute TSRMLS_CC)) { + if (phalcon_isset_property_zval(data, attribute)) { PHALCON_OBS_NVAR(value); phalcon_read_property_zval(&value, data, attribute, PH_NOISY_CC); } diff --git a/ext/validation/message/group.c b/ext/validation/message/group.c index 3049b084d58..73bf359a243 100644 --- a/ext/validation/message/group.c +++ b/ext/validation/message/group.c @@ -339,16 +339,14 @@ PHP_METHOD(Phalcon_Validation_Message_Group, filter){ */ PHP_METHOD(Phalcon_Validation_Message_Group, count){ - zval *messages, *number; + zval *messages; PHALCON_MM_GROW(); PHALCON_OBS_VAR(messages); phalcon_read_property_this(&messages, this_ptr, SL("_messages"), PH_NOISY_CC); - - PHALCON_INIT_VAR(number); - phalcon_fast_count(number, messages TSRMLS_CC); - RETURN_NCTOR(number); + phalcon_fast_count(return_value, messages TSRMLS_CC); + RETURN_MM(); } /** @@ -439,7 +437,7 @@ PHP_METHOD(Phalcon_Validation_Message_Group, valid){ */ PHP_METHOD(Phalcon_Validation_Message_Group, __set_state){ - zval *group, *messages, *group_object; + zval *group, *messages; PHALCON_MM_GROW(); @@ -447,11 +445,9 @@ PHP_METHOD(Phalcon_Validation_Message_Group, __set_state){ PHALCON_OBS_VAR(messages); phalcon_array_fetch_string(&messages, group, SL("_messages"), PH_NOISY); + object_init_ex(return_value, phalcon_validation_message_group_ce); + phalcon_call_method_p1_noret(return_value, "__construct", messages); - PHALCON_INIT_VAR(group_object); - object_init_ex(group_object, phalcon_validation_message_group_ce); - phalcon_call_method_p1_noret(group_object, "__construct", messages); - - RETURN_CTOR(group_object); + RETURN_MM(); }