diff --git a/ext/annotations/adapter.c b/ext/annotations/adapter.c index df0ceeeb39a..792220ffd10 100644 --- a/ext/annotations/adapter.c +++ b/ext/annotations/adapter.c @@ -85,19 +85,16 @@ PHP_METHOD(Phalcon_Annotations_Adapter, setReader){ */ PHP_METHOD(Phalcon_Annotations_Adapter, getReader){ - zval *reader = NULL; - - PHALCON_MM_GROW(); + zval *reader; - PHALCON_OBS_VAR(reader); - phalcon_read_property_this(&reader, this_ptr, SL("_reader"), PH_NOISY_CC); + reader = phalcon_fetch_nproperty_this(this_ptr, SL("_reader"), PH_NOISY_CC); if (Z_TYPE_P(reader) != IS_OBJECT) { - PHALCON_INIT_NVAR(reader); - object_init_ex(reader, phalcon_annotations_reader_ce); - phalcon_update_property_this(this_ptr, SL("_reader"), reader TSRMLS_CC); + object_init_ex(return_value, phalcon_annotations_reader_ce); + phalcon_update_property_this(this_ptr, SL("_reader"), return_value TSRMLS_CC); + return; } - RETURN_CCTOR(reader); + RETURN_ZVAL(reader, 1, 0); } /** diff --git a/ext/annotations/adapter/memory.c b/ext/annotations/adapter/memory.c index 0751933ae76..2b5a0a0bacd 100644 --- a/ext/annotations/adapter/memory.c +++ b/ext/annotations/adapter/memory.c @@ -77,7 +77,7 @@ PHP_METHOD(Phalcon_Annotations_Adapter_Memory, read){ PHALCON_INIT_VAR(lowercased_key); phalcon_fast_strtolower(lowercased_key, key); if (phalcon_array_isset_fetch(&annotations, data, lowercased_key)) { - RETURN_CCTOR(annotations); + RETURN_CTOR(annotations); } RETURN_MM_NULL(); diff --git a/ext/annotations/collection.c b/ext/annotations/collection.c index de8c919fdda..53a899f8795 100644 --- a/ext/annotations/collection.c +++ b/ext/annotations/collection.c @@ -163,20 +163,13 @@ PHP_METHOD(Phalcon_Annotations_Collection, current){ zval *position, *annotations, *annotation; - PHALCON_MM_GROW(); - - PHALCON_OBS_VAR(position); - phalcon_read_property_this(&position, this_ptr, SL("_position"), PH_NOISY_CC); - - PHALCON_OBS_VAR(annotations); - phalcon_read_property_this(&annotations, this_ptr, SL("_annotations"), PH_NOISY_CC); - if (phalcon_array_isset(annotations, position)) { - PHALCON_OBS_VAR(annotation); - phalcon_array_fetch(&annotation, annotations, position, PH_NOISY); - RETURN_CCTOR(annotation); + position = phalcon_fetch_nproperty_this(this_ptr, SL("_position"), PH_NOISY_CC); + annotations = phalcon_fetch_nproperty_this(this_ptr, SL("_annotations"), PH_NOISY_CC); + if (phalcon_array_isset_fetch(&annotation, annotations, position)) { + RETURN_ZVAL(annotation, 1, 0); } - RETURN_MM_NULL(); + RETURN_NULL(); } /** diff --git a/ext/annotations/reflection.c b/ext/annotations/reflection.c index 28c702479ec..a3d9e1cfbfe 100644 --- a/ext/annotations/reflection.c +++ b/ext/annotations/reflection.c @@ -96,33 +96,26 @@ PHP_METHOD(Phalcon_Annotations_Reflection, __construct){ PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations){ zval *annotations, *reflection_data, *reflection_class; - zval *collection; PHALCON_MM_GROW(); - PHALCON_OBS_VAR(annotations); - phalcon_read_property_this(&annotations, this_ptr, SL("_classAnnotations"), PH_NOISY_CC); + annotations = phalcon_fetch_nproperty_this(this_ptr, SL("_classAnnotations"), PH_NOISY_CC); if (Z_TYPE_P(annotations) != IS_OBJECT) { - PHALCON_OBS_VAR(reflection_data); - phalcon_read_property_this(&reflection_data, this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (phalcon_array_isset_string(reflection_data, SS("class"))) { - PHALCON_OBS_VAR(reflection_class); - phalcon_array_fetch_string(&reflection_class, reflection_data, SL("class"), PH_NOISY); + reflection_data = phalcon_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); + if (phalcon_array_isset_string_fetch(&reflection_class, reflection_data, SS("class"))) { + object_init_ex(return_value, phalcon_annotations_collection_ce); + phalcon_call_method_p1_noret(return_value, "__construct", reflection_class); - PHALCON_INIT_VAR(collection); - object_init_ex(collection, phalcon_annotations_collection_ce); - phalcon_call_method_p1_noret(collection, "__construct", reflection_class); - - phalcon_update_property_this(this_ptr, SL("_classAnnotations"), collection TSRMLS_CC); - RETURN_CTOR(collection); + phalcon_update_property_this(this_ptr, SL("_classAnnotations"), return_value TSRMLS_CC); + RETURN_MM(); } phalcon_update_property_this(this_ptr, SL("_classAnnotations"), PHALCON_GLOBAL(z_false) TSRMLS_CC); RETURN_MM_FALSE; } - RETURN_CCTOR(annotations); + RETURN_CTOR(annotations); } /** @@ -133,7 +126,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations){ PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations){ zval *annotations, *reflection_data, *reflection_methods; - zval *collections, *reflection_method = NULL, *method_name = NULL; + zval *reflection_method = NULL, *method_name = NULL; zval *collection = NULL; HashTable *ah0; HashPosition hp0; @@ -141,20 +134,14 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations){ PHALCON_MM_GROW(); - PHALCON_OBS_VAR(annotations); - phalcon_read_property_this(&annotations, this_ptr, SL("_methodAnnotations"), PH_NOISY_CC); + annotations = phalcon_fetch_nproperty_this(this_ptr, SL("_methodAnnotations"), PH_NOISY_CC); if (Z_TYPE_P(annotations) != IS_OBJECT) { - PHALCON_OBS_VAR(reflection_data); - phalcon_read_property_this(&reflection_data, this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (phalcon_array_isset_string(reflection_data, SS("methods"))) { - - PHALCON_OBS_VAR(reflection_methods); - phalcon_array_fetch_string(&reflection_methods, reflection_data, SL("methods"), PH_NOISY); + reflection_data = phalcon_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); + if (phalcon_array_isset_string_fetch(&reflection_methods, reflection_data, SS("methods"))) { if (phalcon_fast_count_ev(reflection_methods TSRMLS_CC)) { - PHALCON_INIT_VAR(collections); - array_init(collections); + array_init(return_value); phalcon_is_iterable(reflection_methods, &ah0, &hp0, 0, 0); @@ -167,14 +154,14 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations){ object_init_ex(collection, phalcon_annotations_collection_ce); phalcon_call_method_p1_noret(collection, "__construct", reflection_method); - phalcon_array_update_zval(&collections, method_name, &collection, PH_COPY | PH_SEPARATE); + phalcon_array_update_zval(&return_value, method_name, &collection, PH_COPY); zend_hash_move_forward_ex(ah0, &hp0); } - phalcon_update_property_this(this_ptr, SL("_methodAnnotations"), collections TSRMLS_CC); + phalcon_update_property_this(this_ptr, SL("_methodAnnotations"), return_value TSRMLS_CC); - RETURN_CTOR(collections); + RETURN_MM(); } } @@ -182,7 +169,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations){ RETURN_MM_FALSE; } - RETURN_CCTOR(annotations); + RETURN_CTOR(annotations); } /** @@ -193,7 +180,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations){ PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations){ zval *annotations, *reflection_data, *reflection_properties; - zval *collections, *reflection_property = NULL, *property = NULL; + zval *reflection_property = NULL, *property = NULL; zval *collection = NULL; HashTable *ah0; HashPosition hp0; @@ -201,20 +188,15 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations){ PHALCON_MM_GROW(); - PHALCON_OBS_VAR(annotations); - phalcon_read_property_this(&annotations, this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC); + annotations = phalcon_fetch_nproperty_this(this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC); if (Z_TYPE_P(annotations) != IS_OBJECT) { - PHALCON_OBS_VAR(reflection_data); - phalcon_read_property_this(&reflection_data, this_ptr, SL("_reflectionData"), PH_NOISY_CC); - if (phalcon_array_isset_string(reflection_data, SS("properties"))) { + reflection_data = phalcon_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC); + if (phalcon_array_isset_string_fetch(&reflection_properties, reflection_data, SS("properties"))) { - PHALCON_OBS_VAR(reflection_properties); - phalcon_array_fetch_string(&reflection_properties, reflection_data, SL("properties"), PH_NOISY); if (phalcon_fast_count_ev(reflection_properties TSRMLS_CC)) { - PHALCON_INIT_VAR(collections); - array_init(collections); + array_init(return_value); phalcon_is_iterable(reflection_properties, &ah0, &hp0, 0, 0); @@ -227,14 +209,14 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations){ object_init_ex(collection, phalcon_annotations_collection_ce); phalcon_call_method_p1_noret(collection, "__construct", reflection_property); - phalcon_array_update_zval(&collections, property, &collection, PH_COPY | PH_SEPARATE); + phalcon_array_update_zval(&return_value, property, &collection, PH_COPY); zend_hash_move_forward_ex(ah0, &hp0); } - phalcon_update_property_this(this_ptr, SL("_propertyAnnotations"), collections TSRMLS_CC); + phalcon_update_property_this(this_ptr, SL("_propertyAnnotations"), return_value TSRMLS_CC); - RETURN_CTOR(collections); + RETURN_MM(); } } @@ -242,7 +224,7 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations){ RETURN_MM_FALSE; } - RETURN_CCTOR(annotations); + RETURN_CTOR(annotations); } /** diff --git a/ext/assets/collection.c b/ext/assets/collection.c index 8a35963c17a..5899c34eb2c 100644 --- a/ext/assets/collection.c +++ b/ext/assets/collection.c @@ -201,15 +201,13 @@ PHP_METHOD(Phalcon_Assets_Collection, getResources){ zval *resources; - PHALCON_MM_GROW(); - - PHALCON_OBS_VAR(resources); - phalcon_read_property_this(&resources, this_ptr, SL("_resources"), PH_NOISY_CC); + resources = phalcon_fetch_nproperty_this(this_ptr, SL("_resources"), PH_NOISY_CC); if (Z_TYPE_P(resources) != IS_ARRAY) { - RETURN_MM_EMPTY_ARRAY(); + array_init(return_value); + return; } - RETURN_CCTOR(resources); + RETURN_ZVAL(resources, 1, 0); } /** @@ -248,20 +246,13 @@ PHP_METHOD(Phalcon_Assets_Collection, current){ zval *position, *resources, *resource; - PHALCON_MM_GROW(); - - PHALCON_OBS_VAR(position); - phalcon_read_property_this(&position, this_ptr, SL("_position"), PH_NOISY_CC); - - PHALCON_OBS_VAR(resources); - phalcon_read_property_this(&resources, this_ptr, SL("_resources"), PH_NOISY_CC); - if (phalcon_array_isset(resources, position)) { - PHALCON_OBS_VAR(resource); - phalcon_array_fetch(&resource, resources, position, PH_NOISY); - RETURN_CCTOR(resource); + position = phalcon_fetch_nproperty_this(this_ptr, SL("_position"), PH_NOISY_CC); + resources = phalcon_fetch_nproperty_this(this_ptr, SL("_resources"), PH_NOISY_CC); + if (phalcon_array_isset_fetch(&resource, resources, position)) { + RETURN_ZVAL(resource, 1, 0); } - RETURN_MM_NULL(); + RETURN_NULL(); } /** diff --git a/ext/assets/filters/none.c b/ext/assets/filters/none.c index 9c04ac7aef2..d9aa02c051d 100644 --- a/ext/assets/filters/none.c +++ b/ext/assets/filters/none.c @@ -61,6 +61,6 @@ PHP_METHOD(Phalcon_Assets_Filters_None, filter){ phalcon_fetch_params(0, 1, 0, &content); - RETURN_CCTORW(content); + RETURN_CTORW(content); } diff --git a/ext/assets/manager.c b/ext/assets/manager.c index e10c6524119..7382c76affb 100644 --- a/ext/assets/manager.c +++ b/ext/assets/manager.c @@ -332,26 +332,20 @@ PHP_METHOD(Phalcon_Assets_Manager, get){ zval *id, *collections, *collection; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 1, 0, &id); + phalcon_fetch_params(0, 1, 0, &id); if (unlikely(Z_TYPE_P(id) != IS_STRING)) { - PHALCON_THROW_EXCEPTION_STR(phalcon_assets_exception_ce, "Collection-Id must be a string"); + PHALCON_THROW_EXCEPTION_STRW(phalcon_assets_exception_ce, "Collection-Id must be a string"); return; } - PHALCON_OBS_VAR(collections); - phalcon_read_property_this(&collections, this_ptr, SL("_collections"), PH_NOISY_CC); - if (!phalcon_array_isset(collections, id)) { - PHALCON_THROW_EXCEPTION_STR(phalcon_assets_exception_ce, "The collection does not exist in the manager"); + collections = phalcon_fetch_nproperty_this(this_ptr, SL("_collections"), PH_NOISY_CC); + if (!phalcon_array_isset_fetch(&collection, collections, id)) { + PHALCON_THROW_EXCEPTION_STRW(phalcon_assets_exception_ce, "The collection does not exist in the manager"); return; } - PHALCON_OBS_VAR(collection); - phalcon_array_fetch(&collection, collections, id, PH_NOISY); - - RETURN_CCTOR(collection); + RETURN_ZVAL(collection, 1, 0); } /** @@ -363,23 +357,17 @@ PHP_METHOD(Phalcon_Assets_Manager, getCss){ zval *collections, *collection; - PHALCON_MM_GROW(); - - PHALCON_OBS_VAR(collections); - phalcon_read_property_this(&collections, this_ptr, SL("_collections"), PH_NOISY_CC); + collections = phalcon_fetch_nproperty_this(this_ptr, SL("_collections"), PH_NOISY_CC); /** * Check if the collection does not exist and create an implicit collection */ - if (!phalcon_array_isset_string(collections, SS("css"))) { + if (!phalcon_array_isset_string_fetch(&collection, collections, SS("css"))) { object_init_ex(return_value, phalcon_assets_collection_ce); - RETURN_MM(); + return; } - PHALCON_OBS_VAR(collection); - phalcon_array_fetch_string(&collection, collections, SL("css"), PH_NOISY); - - RETURN_CCTOR(collection); + RETURN_ZVAL(collection, 1, 0); } /** @@ -391,23 +379,17 @@ PHP_METHOD(Phalcon_Assets_Manager, getJs){ zval *collections, *collection; - PHALCON_MM_GROW(); - - PHALCON_OBS_VAR(collections); - phalcon_read_property_this(&collections, this_ptr, SL("_collections"), PH_NOISY_CC); + collections = phalcon_fetch_nproperty_this(this_ptr, SL("_collections"), PH_NOISY_CC); /** * Check if the collection does not exist and create an implicit collection */ - if (!phalcon_array_isset_string(collections, SS("js"))) { + if (!phalcon_array_isset_string_fetch(&collection, collections, SS("js"))) { object_init_ex(return_value, phalcon_assets_collection_ce); - RETURN_MM(); + return; } - PHALCON_OBS_VAR(collection); - phalcon_array_fetch_string(&collection, collections, SL("js"), PH_NOISY); - - RETURN_CCTOR(collection); + RETURN_ZVAL(collection, 1, 0); } /** @@ -420,22 +402,15 @@ PHP_METHOD(Phalcon_Assets_Manager, collection){ zval *name, *collections, *collection = NULL; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 1, 0, &name); + phalcon_fetch_params(0, 1, 0, &name); - PHALCON_OBS_VAR(collections); - phalcon_read_property_this(&collections, this_ptr, SL("_collections"), PH_NOISY_CC); - if (phalcon_array_isset(collections, name)) { - PHALCON_OBS_VAR(collection); - phalcon_array_fetch(&collection, collections, name, PH_NOISY); - } else { - PHALCON_INIT_NVAR(collection); - object_init_ex(collection, phalcon_assets_collection_ce); - phalcon_update_property_array(this_ptr, SL("_collections"), name, collection TSRMLS_CC); + collections = phalcon_fetch_nproperty_this(this_ptr, SL("_collections"), PH_NOISY_CC); + if (phalcon_array_isset_fetch(&collection, collections, name)) { + RETURN_ZVAL(collection, 1, 0); } - - RETURN_CCTOR(collection); + + object_init_ex(return_value, phalcon_assets_collection_ce); + phalcon_update_property_array(this_ptr, SL("_collections"), name, return_value TSRMLS_CC); } /** @@ -996,7 +971,7 @@ PHP_METHOD(Phalcon_Assets_Manager, outputCss){ PHALCON_INIT_VAR(type); ZVAL_STRING(type, "css", 1); - phalcon_call_method_p3(return_value, this_ptr, "output", collection, callback, type); + phalcon_return_call_method_p3(this_ptr, "output", collection, callback, type); PHALCON_MM_RESTORE(); } @@ -1009,21 +984,19 @@ PHP_METHOD(Phalcon_Assets_Manager, outputCss){ PHP_METHOD(Phalcon_Assets_Manager, outputJs){ zval *collection_name = NULL, *collection = NULL, *callback, *type = NULL; - zval *output; PHALCON_MM_GROW(); phalcon_fetch_params(1, 0, 1, &collection_name); if (!collection_name) { - PHALCON_INIT_VAR(collection_name); + collection_name = PHALCON_GLOBAL(z_null); } - + + PHALCON_INIT_VAR(collection); if (PHALCON_IS_EMPTY(collection_name)) { - PHALCON_INIT_VAR(collection); phalcon_call_method(collection, this_ptr, "getjs"); } else { - PHALCON_INIT_NVAR(collection); phalcon_call_method_p1(collection, this_ptr, "get", collection_name); } @@ -1033,11 +1006,9 @@ PHP_METHOD(Phalcon_Assets_Manager, outputJs){ add_next_index_stringl(callback, SL("javascriptInclude"), 1); PHALCON_INIT_VAR(type); - ZVAL_STRING(type, "js", 1); + ZVAL_STRING(type, "js", 1); - PHALCON_INIT_VAR(output); - phalcon_call_method_p3(output, this_ptr, "output", collection, callback, type); - - RETURN_CCTOR(output); -} + phalcon_return_call_method_p3(this_ptr, "output", collection, callback, type); + PHALCON_MM_RESTORE(); +} diff --git a/ext/assets/resource.c b/ext/assets/resource.c index c483fad8cca..a2cbf24ef5d 100644 --- a/ext/assets/resource.c +++ b/ext/assets/resource.c @@ -336,7 +336,7 @@ PHP_METHOD(Phalcon_Assets_Resource, getTargetPath){ PHP_METHOD(Phalcon_Assets_Resource, getContent){ zval *base_path = NULL, *source_path = NULL, *complete_path; - zval *local, *exception_message = NULL, *content; + zval *local, *exception_message = NULL; PHALCON_MM_GROW(); @@ -381,16 +381,15 @@ PHP_METHOD(Phalcon_Assets_Resource, getContent){ /** * Use file_get_contents to respect the openbase_dir. Access urls must be enabled */ - PHALCON_INIT_VAR(content); - phalcon_file_get_contents(content, complete_path TSRMLS_CC); - if (PHALCON_IS_FALSE(content)) { + phalcon_file_get_contents(return_value, complete_path TSRMLS_CC); + if (PHALCON_IS_FALSE(return_value)) { PHALCON_INIT_NVAR(exception_message); PHALCON_CONCAT_SVS(exception_message, "Resource's content for \"", complete_path, "\" cannot be read"); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_assets_exception_ce, exception_message); return; } - RETURN_CCTOR(content); + PHALCON_MM_RESTORE(); } /** @@ -400,18 +399,14 @@ PHP_METHOD(Phalcon_Assets_Resource, getContent){ */ PHP_METHOD(Phalcon_Assets_Resource, getRealTargetUri){ - zval *target_uri = NULL; - - PHALCON_MM_GROW(); + zval *target_uri; - PHALCON_OBS_VAR(target_uri); - phalcon_read_property_this(&target_uri, this_ptr, SL("_targetUri"), PH_NOISY_CC); + target_uri = phalcon_fetch_nproperty_this(this_ptr, SL("_targetUri"), PH_NOISY_CC); if (PHALCON_IS_EMPTY(target_uri)) { - PHALCON_OBS_NVAR(target_uri); - phalcon_read_property_this(&target_uri, this_ptr, SL("_path"), PH_NOISY_CC); + target_uri = phalcon_fetch_nproperty_this(this_ptr, SL("_path"), PH_NOISY_CC); } - RETURN_CCTOR(target_uri); + RETURN_ZVAL(target_uri, 1, 0); } /** diff --git a/ext/cache/frontend/none.c b/ext/cache/frontend/none.c index 359d46f05d9..db92160711c 100644 --- a/ext/cache/frontend/none.c +++ b/ext/cache/frontend/none.c @@ -99,16 +99,10 @@ PHP_METHOD(Phalcon_Cache_Frontend_None, getLifetime){ */ PHP_METHOD(Phalcon_Cache_Frontend_None, beforeStore){ - if (return_value_ptr) { - zval_ptr_dtor(return_value_ptr); - phalcon_fetch_params(0, 1, 0, return_value_ptr); - Z_ADDREF_PP(return_value_ptr); - } - else { - zval *data; - phalcon_fetch_params(0, 1, 0, &data); - RETURN_CCTORW(data); - } + zval *data; + + phalcon_fetch_params(0, 1, 0, &data); + RETURN_ZVAL(data, 1, 0); } /** @@ -118,15 +112,9 @@ PHP_METHOD(Phalcon_Cache_Frontend_None, beforeStore){ */ PHP_METHOD(Phalcon_Cache_Frontend_None, afterRetrieve){ - if (return_value_ptr) { - zval_ptr_dtor(return_value_ptr); - phalcon_fetch_params(0, 1, 0, return_value_ptr); - Z_ADDREF_PP(return_value_ptr); - } - else { - zval *data; - phalcon_fetch_params(0, 1, 0, &data); - RETURN_CCTORW(data); - } + zval *data; + + phalcon_fetch_params(0, 1, 0, &data); + RETURN_ZVAL(data, 1, 0); } diff --git a/ext/cache/frontend/output.c b/ext/cache/frontend/output.c index db177bd85df..654e0d45ec6 100644 --- a/ext/cache/frontend/output.c +++ b/ext/cache/frontend/output.c @@ -202,16 +202,10 @@ PHP_METHOD(Phalcon_Cache_Frontend_Output, stop){ */ PHP_METHOD(Phalcon_Cache_Frontend_Output, beforeStore){ - if (return_value_ptr) { - zval_ptr_dtor(return_value_ptr); - phalcon_fetch_params(0, 1, 0, return_value_ptr); - Z_ADDREF_PP(return_value_ptr); - } - else { - zval *data; - phalcon_fetch_params(0, 1, 0, &data); - RETURN_CCTORW(data); - } + zval *data; + + phalcon_fetch_params(0, 1, 0, &data); + RETURN_ZVAL(data, 1, 0); } /** @@ -222,14 +216,8 @@ PHP_METHOD(Phalcon_Cache_Frontend_Output, beforeStore){ */ PHP_METHOD(Phalcon_Cache_Frontend_Output, afterRetrieve){ - if (return_value_ptr) { - zval_ptr_dtor(return_value_ptr); - phalcon_fetch_params(0, 1, 0, return_value_ptr); - Z_ADDREF_PP(return_value_ptr); - } - else { - zval *data; - phalcon_fetch_params(0, 1, 0, &data); - RETURN_CCTORW(data); - } + zval *data; + + phalcon_fetch_params(0, 1, 0, &data); + RETURN_ZVAL(data, 1, 0); } diff --git a/ext/cli/console.c b/ext/cli/console.c index 879d0da1899..faa1f902ad1 100644 --- a/ext/cli/console.c +++ b/ext/cli/console.c @@ -237,7 +237,7 @@ PHP_METHOD(Phalcon_CLI_Console, handle){ zval *service = NULL, *router, *module_name, *event_name = NULL; zval *status = NULL, *modules, *exception_msg = NULL, *module; zval *path, *class_name = NULL, *module_object, *task_name; - zval *action_name, *params, *dispatcher, *task; + zval *action_name, *params, *dispatcher; PHALCON_MM_GROW(); @@ -369,14 +369,13 @@ PHP_METHOD(Phalcon_CLI_Console, handle){ } } - PHALCON_INIT_VAR(task); - phalcon_call_method(task, dispatcher, "dispatch"); + phalcon_return_call_method_p0(dispatcher, "dispatch"); if (Z_TYPE_P(events_manager) == IS_OBJECT) { PHALCON_INIT_NVAR(event_name); ZVAL_STRING(event_name, "console:afterHandleTask", 1); - phalcon_call_method_p3_noret(events_manager, "fire", event_name, this_ptr, task); + phalcon_call_method_p3_noret(events_manager, "fire", event_name, this_ptr, (return_value_ptr ? *return_value_ptr : return_value)); } - RETURN_CCTOR(task); + PHALCON_MM_RESTORE(); } diff --git a/ext/crypt.c b/ext/crypt.c index 1fd48a7e2b9..18474dae1ee 100644 --- a/ext/crypt.c +++ b/ext/crypt.c @@ -431,7 +431,7 @@ PHP_METHOD(Phalcon_Crypt, encrypt){ if (!key || Z_TYPE_P(key) == IS_NULL) { encrypt_key = phalcon_fetch_nproperty_this(this_ptr, SL("_key"), PH_NOISY_CC); } else { - PHALCON_CPY_WRT(encrypt_key, key); + PHALCON_CPY_WRT_CTOR(encrypt_key, key); if (Z_TYPE_P(encrypt_key) != IS_STRING) { convert_to_string(encrypt_key); } diff --git a/ext/db/adapter/pdo.c b/ext/db/adapter/pdo.c index 204ffff8609..c059d5b0b56 100644 --- a/ext/db/adapter/pdo.c +++ b/ext/db/adapter/pdo.c @@ -371,7 +371,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared){ phalcon_call_method_noret(statement, "execute"); - RETURN_CCTOR(statement); + RETURN_CTOR(statement); } /** @@ -458,7 +458,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, query){ RETURN_MM(); } - RETURN_CCTOR(statement); + RETURN_CTOR(statement); } /** diff --git a/ext/db/adapter/pdo/mysql.c b/ext/db/adapter/pdo/mysql.c index 5446ae976a8..461d9a7f8f9 100644 --- a/ext/db/adapter/pdo/mysql.c +++ b/ext/db/adapter/pdo/mysql.c @@ -110,7 +110,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, escapeIdentifier){ RETURN_MM(); } - RETURN_CCTOR(identifier); + RETURN_CTOR(identifier); } /** diff --git a/ext/db/dialect.c b/ext/db/dialect.c index bc37dce2407..dc40d59a624 100644 --- a/ext/db/dialect.c +++ b/ext/db/dialect.c @@ -88,7 +88,7 @@ PHP_METHOD(Phalcon_Db_Dialect, limit){ RETURN_MM(); } - RETURN_CCTOR(sql_query); + RETURN_CTOR(sql_query); } /** @@ -259,7 +259,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression){ RETURN_CTOR(escaped_domain); } - RETURN_CCTOR(escaped_name); + RETURN_CTOR(escaped_name); } /** @@ -268,7 +268,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression){ if (PHALCON_IS_STRING(type, "literal")) { PHALCON_OBS_VAR(value); phalcon_array_fetch_string(&value, expression, SL("value"), PH_NOISY); - RETURN_CCTOR(value); + RETURN_CTOR(value); } /** @@ -334,7 +334,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression){ if (PHALCON_IS_STRING(type, "placeholder")) { PHALCON_OBS_NVAR(value); phalcon_array_fetch_string(&value, expression, SL("value"), PH_NOISY); - RETURN_CCTOR(value); + RETURN_CTOR(value); } /** @@ -557,7 +557,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlTable){ PHALCON_CPY_WRT(sql_table_alias, sql_schema); } - RETURN_CCTOR(sql_table_alias); + RETURN_CTOR(sql_table_alias); } if (PHALCON_GLOBAL(db).escape_identifiers) { @@ -565,7 +565,7 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlTable){ RETURN_MM(); } - RETURN_CCTOR(table); + RETURN_CTOR(table); } /** diff --git a/ext/db/dialect/oracle.c b/ext/db/dialect/oracle.c index bd86d8b81ed..2f7ffbd3e56 100644 --- a/ext/db/dialect/oracle.c +++ b/ext/db/dialect/oracle.c @@ -704,16 +704,16 @@ PHP_METHOD(Phalcon_Db_Dialect_Oracle, getSqlTable){ PHALCON_CPY_WRT(sql_table_alias, sql_schema); } - RETURN_CCTOR(sql_table_alias); + RETURN_CTOR(sql_table_alias); } if (PHALCON_GLOBAL(db).escape_identifiers) { PHALCON_INIT_NVAR(sql_table); PHALCON_CONCAT_VVV(sql_table, escape_char, table, escape_char); - RETURN_CCTOR(sql_table); + RETURN_CTOR(sql_table); } - RETURN_CCTOR(table); + RETURN_CTOR(table); } /** @@ -748,7 +748,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Oracle, limit){ RETURN_CTOR(sql_limit); } - RETURN_CCTOR(sql_query); + RETURN_CTOR(sql_query); } /** diff --git a/ext/debug.c b/ext/debug.c index 177732bbbe6..bacaf8a64ea 100644 --- a/ext/debug.c +++ b/ext/debug.c @@ -280,14 +280,14 @@ PHP_METHOD(Phalcon_Debug, _escapeString){ INIT_ZVAL(escaped_line_break); ZVAL_STRING(&escaped_line_break, "\\n", 0); - PHALCON_MM_GROW(); - PHALCON_INIT_VAR(replaced_value); + ALLOC_INIT_ZVAL(replaced_value); phalcon_fast_str_replace(replaced_value, &line_break, &escaped_line_break, value); phalcon_htmlentities(return_value, replaced_value, NULL, charset TSRMLS_CC); - RETURN_MM(); + zval_ptr_dtor(&replaced_value); + return; } - RETURN_CCTORW(value); + RETURN_ZVAL(value, 1, 0); } /** @@ -436,7 +436,7 @@ PHP_METHOD(Phalcon_Debug, _getVarDump){ * Other scalar variables are just converted to strings */ - RETURN_CCTOR(variable); + RETURN_CTOR(variable); } /** diff --git a/ext/di.c b/ext/di.c index 222f070677f..b418d0e9f6d 100644 --- a/ext/di.c +++ b/ext/di.c @@ -247,7 +247,7 @@ PHP_METHOD(Phalcon_DI, setRaw){ phalcon_update_property_array(this_ptr, SL("_services"), name, raw_definition TSRMLS_CC); - RETURN_CCTORW(raw_definition); + RETURN_CTORW(raw_definition); } /** diff --git a/ext/di/injectable.c b/ext/di/injectable.c index fbec411d5d1..19f7b62fb1f 100644 --- a/ext/di/injectable.c +++ b/ext/di/injectable.c @@ -92,14 +92,13 @@ PHP_METHOD(Phalcon_DI_Injectable, getDI){ PHALCON_MM_GROW(); - PHALCON_OBS_VAR(dependency_injector); - phalcon_read_property_this(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); + dependency_injector = phalcon_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); if (Z_TYPE_P(dependency_injector) != IS_OBJECT) { - PHALCON_INIT_NVAR(dependency_injector); - phalcon_call_static(dependency_injector, "phalcon\\di", "getdefault"); + phalcon_return_call_static_p0("phalcon\\di", "getdefault"); + RETURN_MM(); } - RETURN_CCTOR(dependency_injector); + RETURN_CTOR(dependency_injector); } /** @@ -135,10 +134,8 @@ PHP_METHOD(Phalcon_DI_Injectable, getEventsManager){ */ PHP_METHOD(Phalcon_DI_Injectable, __get){ - zval *property_name, *dependency_injector = NULL; zval *has_service, *service = NULL, *class_name, *arguments; - zval *persistent; PHALCON_MM_GROW(); @@ -163,10 +160,9 @@ PHP_METHOD(Phalcon_DI_Injectable, __get){ PHALCON_INIT_VAR(has_service); phalcon_call_method_p1(has_service, dependency_injector, "has", property_name); if (zend_is_true(has_service)) { - PHALCON_INIT_VAR(service); - phalcon_call_method_p1(service, dependency_injector, "getshared", property_name); - phalcon_update_property_zval_zval(this_ptr, property_name, service TSRMLS_CC); - RETURN_CCTOR(service); + phalcon_return_call_method_p1(dependency_injector, "getshared", property_name); + phalcon_update_property_zval_zval(this_ptr, property_name, (return_value_ptr ? *return_value_ptr : return_value) TSRMLS_CC); + RETURN_MM(); } if (PHALCON_IS_STRING(property_name, "di")) { @@ -183,15 +179,14 @@ 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, 0); PHALCON_INIT_NVAR(service); ZVAL_STRING(service, "sessionBag", 1); - PHALCON_INIT_VAR(persistent); - phalcon_call_method_p2(persistent, dependency_injector, "get", service, arguments); - phalcon_update_property_this(this_ptr, SL("persistent"), persistent TSRMLS_CC); - RETURN_CCTOR(persistent); + phalcon_return_call_method_p2(dependency_injector, "get", service, arguments); + phalcon_update_property_this(this_ptr, SL("persistent"), (return_value_ptr ? *return_value_ptr : return_value) TSRMLS_CC); + RETURN_MM(); } /** @@ -200,4 +195,3 @@ PHP_METHOD(Phalcon_DI_Injectable, __get){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Access to undefined property %s", Z_STRVAL_P(property_name)); RETURN_MM_NULL(); } - diff --git a/ext/di/service.c b/ext/di/service.c index 1222961ea36..1c9e17b0b94 100644 --- a/ext/di/service.c +++ b/ext/di/service.c @@ -203,10 +203,9 @@ PHP_METHOD(Phalcon_DI_Service, resolve){ */ if (zend_is_true(shared)) { - PHALCON_OBS_VAR(shared_instance); - phalcon_read_property_this(&shared_instance, this_ptr, SL("_sharedInstance"), PH_NOISY_CC); + shared_instance = phalcon_fetch_nproperty_this(this_ptr, SL("_sharedInstance"), PH_NOISY_CC); if (Z_TYPE_P(shared_instance) != IS_NULL) { - RETURN_CCTOR(shared_instance); + RETURN_CTOR(shared_instance); } } @@ -282,7 +281,7 @@ PHP_METHOD(Phalcon_DI_Service, resolve){ phalcon_update_property_this(this_ptr, SL("_sharedInstance"), instance TSRMLS_CC); } - RETURN_CCTOR(instance); + RETURN_CTOR(instance); } /** @@ -353,37 +352,30 @@ PHP_METHOD(Phalcon_DI_Service, getParameter){ zval *position, *definition, *arguments, *parameter; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 1, 0, &position); + phalcon_fetch_params(0, 1, 0, &position); - PHALCON_OBS_VAR(definition); - phalcon_read_property_this(&definition, this_ptr, SL("_definition"), PH_NOISY_CC); + definition = phalcon_fetch_nproperty_this(this_ptr, SL("_definition"), PH_NOISY_CC); if (Z_TYPE_P(definition) != IS_ARRAY) { - PHALCON_THROW_EXCEPTION_STR(phalcon_di_exception_ce, "Definition must be an array to obtain its parameters"); + PHALCON_THROW_EXCEPTION_STRW(phalcon_di_exception_ce, "Definition must be an array to obtain its parameters"); return; } if (Z_TYPE_P(position) != IS_LONG) { - PHALCON_THROW_EXCEPTION_STR(phalcon_di_exception_ce, "Position must be integer"); + PHALCON_THROW_EXCEPTION_STRW(phalcon_di_exception_ce, "Position must be integer"); return; } /** * Update the parameter */ - if (phalcon_array_isset_string(definition, SS("arguments"))) { + if (phalcon_array_isset_string_fetch(&arguments, definition, SS("arguments"))) { - PHALCON_OBS_VAR(arguments); - phalcon_array_fetch_string(&arguments, definition, SL("arguments"), PH_NOISY); - if (phalcon_array_isset(arguments, position)) { - PHALCON_OBS_VAR(parameter); - phalcon_array_fetch(¶meter, arguments, position, PH_NOISY); - RETURN_CCTOR(parameter); + if (phalcon_array_isset_fetch(¶meter, arguments, position)) { + RETURN_ZVAL(parameter, 1, 0); } } - RETURN_MM_NULL(); + RETURN_NULL(); } /** diff --git a/ext/escaper.c b/ext/escaper.c index f6fdd3c2e06..2ba4def755a 100644 --- a/ext/escaper.c +++ b/ext/escaper.c @@ -291,7 +291,7 @@ PHP_METHOD(Phalcon_Escaper, escapeHtml){ return; } - RETURN_CCTORW(text); + RETURN_ZVAL(text, 1, 0); } /** @@ -318,7 +318,7 @@ PHP_METHOD(Phalcon_Escaper, escapeHtmlAttr){ return; } - RETURN_CCTORW(attribute); + RETURN_ZVAL(attribute, 1, 0); } /** @@ -349,7 +349,7 @@ PHP_METHOD(Phalcon_Escaper, escapeCss){ RETURN_MM(); } - RETURN_CCTORW(css); + RETURN_ZVAL(css, 1, 0); } /** @@ -380,7 +380,7 @@ PHP_METHOD(Phalcon_Escaper, escapeJs){ RETURN_MM(); } - RETURN_CCTORW(js); + RETURN_ZVAL(js, 1, 0); } /** diff --git a/ext/flash/session.c b/ext/flash/session.c index 82014f10eae..e13d64ecd7a 100644 --- a/ext/flash/session.c +++ b/ext/flash/session.c @@ -95,7 +95,7 @@ PHP_METHOD(Phalcon_Flash_Session, getDI){ PHP_METHOD(Phalcon_Flash_Session, _getSessionMessages){ zval *remove, *dependency_injector, *service; - zval *session, *index_name, *messages; + zval *session, *index_name; PHALCON_MM_GROW(); @@ -117,13 +117,12 @@ PHP_METHOD(Phalcon_Flash_Session, _getSessionMessages){ PHALCON_INIT_VAR(index_name); ZVAL_STRING(index_name, "_flashMessages", 1); - PHALCON_INIT_VAR(messages); - phalcon_call_method_p1(messages, session, "get", index_name); + phalcon_return_call_method_p1(session, "get", index_name); if (PHALCON_IS_TRUE(remove)) { phalcon_call_method_p1_noret(session, "remove", index_name); } - RETURN_CCTOR(messages); + RETURN_MM(); } /** @@ -157,7 +156,7 @@ PHP_METHOD(Phalcon_Flash_Session, _setSessionMessages){ ZVAL_STRING(index_name, "_flashMessages", 1); phalcon_call_method_p2_noret(session, "set", index_name, messages); - RETURN_CCTOR(messages); + RETURN_CTOR(messages); } /** @@ -221,7 +220,7 @@ PHP_METHOD(Phalcon_Flash_Session, getMessages){ if (Z_TYPE_P(messages) == IS_ARRAY) { if (likely(Z_TYPE_P(type) == IS_STRING)) { if (phalcon_array_isset_fetch(&return_messages, messages, type)) { - RETURN_CCTOR(return_messages); + RETURN_CTOR(return_messages); } RETURN_MM_EMPTY_ARRAY(); diff --git a/ext/forms/element.c b/ext/forms/element.c index bcb45e59bf5..ba8878adbfd 100644 --- a/ext/forms/element.c +++ b/ext/forms/element.c @@ -695,26 +695,24 @@ PHP_METHOD(Phalcon_Forms_Element, getValue){ */ PHP_METHOD(Phalcon_Forms_Element, getMessages){ - zval *messages = NULL; + zval *messages; PHALCON_MM_GROW(); /** * Get the related form */ - PHALCON_OBS_VAR(messages); - phalcon_read_property_this(&messages, this_ptr, SL("_messages"), PH_NOISY_CC); + messages = phalcon_fetch_nproperty_this(this_ptr, SL("_messages"), PH_NOISY_CC); if (Z_TYPE_P(messages) == IS_OBJECT) { - RETURN_CCTOR(messages); + RETURN_CTOR(messages); } - PHALCON_INIT_NVAR(messages); - object_init_ex(messages, phalcon_validation_message_group_ce); - phalcon_call_method_noret(messages, "__construct"); + object_init_ex(return_value, phalcon_validation_message_group_ce); + phalcon_call_method_noret(return_value, "__construct"); - phalcon_update_property_this(this_ptr, SL("_messages"), messages TSRMLS_CC); + phalcon_update_property_this(this_ptr, SL("_messages"), return_value TSRMLS_CC); - RETURN_CCTOR(messages); + PHALCON_MM_RESTORE(); } /** diff --git a/ext/forms/form.c b/ext/forms/form.c index 00047caf789..9e296e7b76d 100644 --- a/ext/forms/form.c +++ b/ext/forms/form.c @@ -177,7 +177,6 @@ PHP_METHOD(Phalcon_Forms_Form, getUserOption){ default_value = PHALCON_GLOBAL(z_null); } - PHALCON_OBS_VAR(options); options = phalcon_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); if (phalcon_array_isset_fetch(&value, options, option)) { RETURN_ZVAL(value, 1, 0); @@ -435,7 +434,7 @@ PHP_METHOD(Phalcon_Forms_Form, isValid){ PHALCON_INIT_VAR(status); phalcon_call_method_p2(status, this_ptr, "beforevalidation", data, entity); if (PHALCON_IS_FALSE(status)) { - RETURN_CCTOR(status); + RETURN_CTOR(status); } } @@ -574,7 +573,7 @@ PHP_METHOD(Phalcon_Forms_Form, getMessages){ RETURN_MM(); } - RETURN_CCTOR(messages); + RETURN_CTOR(messages); } object_init_ex(return_value, phalcon_validation_message_group_ce); @@ -610,7 +609,7 @@ PHP_METHOD(Phalcon_Forms_Form, getMessagesFor){ messages = phalcon_fetch_nproperty_this(this_ptr, SL("_messages"), PH_NOISY_CC); if (phalcon_array_isset_fetch(&element_messages, messages, name)) { - RETURN_CCTOR(element_messages); + RETURN_CTOR(element_messages); } object_init_ex(return_value, phalcon_validation_message_group_ce); @@ -801,10 +800,10 @@ PHP_METHOD(Phalcon_Forms_Form, getLabel){ * Use the element's name as label if the label is not available */ if (!zend_is_true(label)) { - RETURN_CCTOR(name); + RETURN_CTOR(name); } - RETURN_CCTOR(label); + RETURN_CTOR(label); } /** @@ -839,7 +838,7 @@ PHP_METHOD(Phalcon_Forms_Form, getValue){ if (phalcon_isset_property_zval(entity, name TSRMLS_CC)) { PHALCON_OBS_VAR(value); phalcon_read_property_zval(&value, entity, name, PH_NOISY_CC); - RETURN_CCTOR(value); + RETURN_CTOR(value); } } @@ -850,7 +849,7 @@ PHP_METHOD(Phalcon_Forms_Form, getValue){ * Check if the data is in the data array */ if (phalcon_array_isset_fetch(&value, data, name)) { - RETURN_CCTOR(value); + RETURN_CTOR(value); } } @@ -1003,7 +1002,7 @@ PHP_METHOD(Phalcon_Forms_Form, current){ position = phalcon_fetch_nproperty_this(this_ptr, SL("_position"), PH_NOISY_CC); elements = phalcon_fetch_nproperty_this(this_ptr, SL("_elementsIndexed"), PH_NOISY_CC); if (phalcon_array_isset_fetch(&element, elements, position)) { - RETURN_CCTORW(element); + RETURN_CTORW(element); } RETURN_NULL(); diff --git a/ext/forms/manager.c b/ext/forms/manager.c index 4a711f18314..565b2622e76 100644 --- a/ext/forms/manager.c +++ b/ext/forms/manager.c @@ -105,23 +105,17 @@ PHP_METHOD(Phalcon_Forms_Manager, get){ zval *name, *forms, *exception_message, *form; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 1, 0, &name); + phalcon_fetch_params(0, 1, 0, &name); - PHALCON_OBS_VAR(forms); - phalcon_read_property_this(&forms, this_ptr, SL("_forms"), PH_NOISY_CC); - if (!phalcon_array_isset(forms, name)) { + forms = phalcon_fetch_nproperty_this(this_ptr, SL("_forms"), PH_NOISY_CC); + if (!phalcon_array_isset_fetch(&form, forms, name)) { PHALCON_INIT_VAR(exception_message); PHALCON_CONCAT_SVS(exception_message, "There is no form with name='", name, "'"); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_forms_exception_ce, exception_message); return; } - PHALCON_OBS_VAR(form); - phalcon_array_fetch(&form, forms, name, PH_NOISY); - - RETURN_CCTOR(form); + RETURN_ZVAL(form, 1, 0); } /** @@ -134,17 +128,14 @@ PHP_METHOD(Phalcon_Forms_Manager, has){ zval *name, *forms; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 1, 0, &name); + phalcon_fetch_params(0, 1, 0, &name); - PHALCON_OBS_VAR(forms); - phalcon_read_property_this(&forms, this_ptr, SL("_forms"), PH_NOISY_CC); - if (!phalcon_array_isset(forms, name)) { - RETURN_MM_TRUE; + forms = phalcon_fetch_nproperty_this(this_ptr, SL("_forms"), PH_NOISY_CC); + if (phalcon_array_isset(forms, name)) { + RETURN_TRUE; } - RETURN_MM_FALSE; + RETURN_FALSE; } /** diff --git a/ext/http/cookie.c b/ext/http/cookie.c index c19924769d7..472ef20b664 100644 --- a/ext/http/cookie.c +++ b/ext/http/cookie.c @@ -283,23 +283,23 @@ PHP_METHOD(Phalcon_Http_Cookie, getValue){ PHALCON_INIT_VAR(sanitized_value); phalcon_call_method_p2(sanitized_value, filter, "sanitize", decrypted_value, filters); - RETURN_CCTOR(sanitized_value); + RETURN_CTOR(sanitized_value); } /** * Return the value without filtering */ - RETURN_CCTOR(decrypted_value); + RETURN_CTOR(decrypted_value); } - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } PHALCON_OBS_NVAR(value); phalcon_read_property_this(&value, this_ptr, SL("_value"), PH_NOISY_CC); - RETURN_CCTOR(value); + RETURN_CTOR(value); } /** @@ -647,7 +647,7 @@ PHP_METHOD(Phalcon_Http_Cookie, getExpiration){ PHALCON_OBS_VAR(expire); phalcon_read_property_this(&expire, this_ptr, SL("_expire"), PH_NOISY_CC); - RETURN_CCTOR(expire); + RETURN_CTOR(expire); } /** @@ -695,7 +695,7 @@ PHP_METHOD(Phalcon_Http_Cookie, getPath){ PHALCON_OBS_VAR(path); phalcon_read_property_this(&path, this_ptr, SL("_path"), PH_NOISY_CC); - RETURN_CCTOR(path); + RETURN_CTOR(path); } /** @@ -743,7 +743,7 @@ PHP_METHOD(Phalcon_Http_Cookie, getDomain){ PHALCON_OBS_VAR(domain); phalcon_read_property_this(&domain, this_ptr, SL("_domain"), PH_NOISY_CC); - RETURN_CCTOR(domain); + RETURN_CTOR(domain); } /** @@ -791,7 +791,7 @@ PHP_METHOD(Phalcon_Http_Cookie, getSecure){ PHALCON_OBS_VAR(secure); phalcon_read_property_this(&secure, this_ptr, SL("_secure"), PH_NOISY_CC); - RETURN_CCTOR(secure); + RETURN_CTOR(secure); } /** @@ -839,7 +839,7 @@ PHP_METHOD(Phalcon_Http_Cookie, getHttpOnly){ PHALCON_OBS_VAR(http_only); phalcon_read_property_this(&http_only, this_ptr, SL("_httpOnly"), PH_NOISY_CC); - RETURN_CCTOR(http_only); + RETURN_CTOR(http_only); } /** @@ -849,17 +849,16 @@ PHP_METHOD(Phalcon_Http_Cookie, getHttpOnly){ */ PHP_METHOD(Phalcon_Http_Cookie, __toString){ - zval *value = NULL; + zval *value; PHALCON_MM_GROW(); - PHALCON_OBS_VAR(value); - phalcon_read_property_this(&value, this_ptr, SL("_value"), PH_NOISY_CC); + value = phalcon_fetch_nproperty_this(this_ptr, SL("_value"), PH_NOISY_CC); if (Z_TYPE_P(value) == IS_NULL) { - PHALCON_INIT_NVAR(value); - phalcon_call_method(value, this_ptr, "getvalue"); + phalcon_return_call_method_p0(this_ptr, "getvalue"); + RETURN_MM(); } - RETURN_CCTOR(value); + RETURN_CTOR(value); } diff --git a/ext/http/request.c b/ext/http/request.c index 2865f56b1eb..23f6b7508db 100644 --- a/ext/http/request.c +++ b/ext/http/request.c @@ -192,23 +192,23 @@ PHP_METHOD(Phalcon_Http_Request, get){ if (PHALCON_IS_EMPTY(return_value) && zend_is_true(not_allow_empty)) { zval_dtor(return_value); - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } RETURN_MM(); } if (PHALCON_IS_EMPTY(value) && zend_is_true(not_allow_empty)) { - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } - RETURN_CCTOR(value); + RETURN_CTOR(value); } - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } - RETURN_CCTOR(request); + RETURN_CTOR(request); } /** @@ -292,23 +292,23 @@ PHP_METHOD(Phalcon_Http_Request, getPost){ if (PHALCON_IS_EMPTY(return_value) && zend_is_true(not_allow_empty)) { zval_dtor(return_value); - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } else { RETURN_MM(); } } else { if (PHALCON_IS_EMPTY(value) && zend_is_true(not_allow_empty)) { - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } else { - RETURN_CCTOR(value); + RETURN_CTOR(value); } } } - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } - RETURN_CCTOR(post); + RETURN_CTOR(post); } /** @@ -395,23 +395,23 @@ PHP_METHOD(Phalcon_Http_Request, getQuery){ if (PHALCON_IS_EMPTY(return_value) && zend_is_true(not_allow_empty)) { zval_dtor(return_value); - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } else { RETURN_MM(); } } else { if (PHALCON_IS_EMPTY(value) && zend_is_true(not_allow_empty)) { - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } else { - RETURN_CCTOR(value); + RETURN_CTOR(value); } } } - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } - RETURN_CCTOR(get); + RETURN_CTOR(get); } /** @@ -432,7 +432,7 @@ PHP_METHOD(Phalcon_Http_Request, getServer){ if (phalcon_array_isset(_SERVER, name)) { PHALCON_OBS_VAR(server_value); phalcon_array_fetch(&server_value, _SERVER, name, PH_NOISY); - RETURN_CCTOR(server_value); + RETURN_CTOR(server_value); } RETURN_MM_NULL(); } @@ -531,14 +531,14 @@ PHP_METHOD(Phalcon_Http_Request, getHeader){ if (phalcon_array_isset(_SERVER, header)) { PHALCON_OBS_VAR(server_value); phalcon_array_fetch(&server_value, _SERVER, header, PH_NOISY); - RETURN_CCTOR(server_value); + RETURN_CTOR(server_value); } else { PHALCON_INIT_VAR(key); PHALCON_CONCAT_SV(key, "HTTP_", header); if (phalcon_array_isset(_SERVER, key)) { PHALCON_OBS_NVAR(server_value); phalcon_array_fetch(&server_value, _SERVER, key, PH_NOISY); - RETURN_CCTOR(server_value); + RETURN_CTOR(server_value); } } RETURN_MM_EMPTY_STRING(); @@ -740,7 +740,7 @@ PHP_METHOD(Phalcon_Http_Request, getServerAddress){ if (phalcon_array_isset_string(server, SS("SERVER_ADDR"))) { PHALCON_OBS_VAR(server_addr); phalcon_array_fetch_string(&server_addr, server, SL("SERVER_ADDR"), PH_NOISY); - RETURN_CCTOR(server_addr); + RETURN_CTOR(server_addr); } PHALCON_INIT_VAR(localhost); @@ -765,7 +765,7 @@ PHP_METHOD(Phalcon_Http_Request, getServerName){ if (phalcon_array_isset_string(server, SS("SERVER_NAME"))) { PHALCON_OBS_VAR(server_name); phalcon_array_fetch_string(&server_name, server, SL("SERVER_NAME"), PH_NOISY); - RETURN_CCTOR(server_name); + RETURN_CTOR(server_name); } RETVAL_STRING("localhost", 1); @@ -796,7 +796,7 @@ PHP_METHOD(Phalcon_Http_Request, getHttpHost){ PHALCON_INIT_VAR(http_host); phalcon_call_method_p1(http_host, this_ptr, "getserver", host); if (zend_is_true(http_host)) { - RETURN_CCTOR(http_host); + RETURN_CTOR(http_host); } /** @@ -863,14 +863,14 @@ PHP_METHOD(Phalcon_Http_Request, getHttpHost){ * If is standard http we return the server name only */ if (PHALCON_IS_TRUE(is_std_http)) { - RETURN_CCTOR(name); + RETURN_CTOR(name); } /** * If is standard secure http we return the server name only */ if (PHALCON_IS_TRUE(is_secure_http)) { - RETURN_CCTOR(name); + RETURN_CTOR(name); } PHALCON_CONCAT_VSV(return_value, name, ":", port); @@ -927,10 +927,10 @@ PHP_METHOD(Phalcon_Http_Request, getClientAddress){ PHALCON_OBS_VAR(first); phalcon_array_fetch_long(&first, addresses, 0, PH_NOISY); - RETURN_CCTOR(first); + RETURN_CTOR(first); } - RETURN_CCTOR(address); + RETURN_CTOR(address); } RETURN_MM_FALSE; @@ -1010,7 +1010,7 @@ PHP_METHOD(Phalcon_Http_Request, getUserAgent){ if (phalcon_array_isset_string(server, SS("HTTP_USER_AGENT"))) { PHALCON_OBS_VAR(user_agent); phalcon_array_fetch_string(&user_agent, server, SL("HTTP_USER_AGENT"), PH_NOISY); - RETURN_CCTOR(user_agent); + RETURN_CTOR(user_agent); } RETVAL_EMPTY_STRING(); @@ -1542,7 +1542,7 @@ PHP_METHOD(Phalcon_Http_Request, getHTTPReferer){ if (phalcon_array_isset_string(_SERVER, SS("HTTP_REFERER"))) { PHALCON_OBS_VAR(http_referer); phalcon_array_fetch_string(&http_referer, _SERVER, SL("HTTP_REFERER"), PH_NOISY); - RETURN_CCTOR(http_referer); + RETURN_CTOR(http_referer); } RETURN_MM_EMPTY_STRING(); } @@ -1669,7 +1669,7 @@ PHP_METHOD(Phalcon_Http_Request, _getBestQuality){ zend_hash_move_forward_ex(ah0, &hp0); } - RETURN_CCTOR(selected_name); + RETURN_CTOR(selected_name); } /** diff --git a/ext/http/response.c b/ext/http/response.c index 8620f5c3807..98817dbc902 100644 --- a/ext/http/response.c +++ b/ext/http/response.c @@ -216,23 +216,20 @@ PHP_METHOD(Phalcon_Http_Response, setHeaders){ */ PHP_METHOD(Phalcon_Http_Response, getHeaders){ - zval *headers = NULL; - - PHALCON_MM_GROW(); + zval *headers; - PHALCON_OBS_VAR(headers); - phalcon_read_property_this(&headers, this_ptr, SL("_headers"), PH_NOISY_CC); + headers = phalcon_fetch_nproperty_this(this_ptr, SL("_headers"), PH_NOISY_CC); if (Z_TYPE_P(headers) == IS_NULL) { /** * A Phalcon\Http\Response\Headers bag is temporary used to manage the headers - * before sent them to the client + * before sending them to the client */ - PHALCON_INIT_NVAR(headers); - object_init_ex(headers, phalcon_http_response_headers_ce); - phalcon_update_property_this(this_ptr, SL("_headers"), headers TSRMLS_CC); + object_init_ex(return_value, phalcon_http_response_headers_ce); + phalcon_update_property_this(this_ptr, SL("_headers"), return_value TSRMLS_CC); + return; } - RETURN_CCTOR(headers); + RETURN_ZVAL(headers, 1, 0); } /** diff --git a/ext/http/response/cookies.c b/ext/http/response/cookies.c index 40d3dbd9741..b2b8f91d9ad 100644 --- a/ext/http/response/cookies.c +++ b/ext/http/response/cookies.c @@ -271,18 +271,15 @@ PHP_METHOD(Phalcon_Http_Response_Cookies, get){ PHALCON_OBS_VAR(cookies); phalcon_read_property_this(&cookies, this_ptr, SL("_cookies"), PH_NOISY_CC); - if (phalcon_array_isset(cookies, name)) { - PHALCON_OBS_VAR(cookie); - phalcon_array_fetch(&cookie, cookies, name, PH_NOISY); - RETURN_CCTOR(cookie); + if (phalcon_array_isset_fetch(&cookie, cookies, name)) { + RETURN_CTOR(cookie); } /** * Create the cookie if the it does not exist */ - PHALCON_INIT_NVAR(cookie); - object_init_ex(cookie, phalcon_http_cookie_ce); - phalcon_call_method_p1_noret(cookie, "__construct", name); + object_init_ex(return_value, phalcon_http_cookie_ce); + phalcon_call_method_p1_noret(return_value, "__construct", name); PHALCON_OBS_VAR(dependency_injector); phalcon_read_property_this(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); @@ -291,7 +288,7 @@ PHP_METHOD(Phalcon_Http_Response_Cookies, get){ /** * Pass the DI to created cookies */ - phalcon_call_method_p1_noret(cookie, "setdi", dependency_injector); + phalcon_call_method_p1_noret(return_value, "setdi", dependency_injector); PHALCON_OBS_VAR(encryption); phalcon_read_property_this(&encryption, this_ptr, SL("_useEncryption"), PH_NOISY_CC); @@ -300,13 +297,13 @@ PHP_METHOD(Phalcon_Http_Response_Cookies, get){ * Enable encryption in the cookie */ if (zend_is_true(encryption)) { - phalcon_call_method_p1_noret(cookie, "useencryption", encryption); + phalcon_call_method_p1_noret(return_value, "useencryption", encryption); } } - phalcon_update_property_array(this_ptr, SL("_cookies"), name, cookie TSRMLS_CC); + phalcon_update_property_array(this_ptr, SL("_cookies"), name, return_value TSRMLS_CC); - RETURN_CCTOR(cookie); + PHALCON_MM_RESTORE(); } /** diff --git a/ext/http/response/headers.c b/ext/http/response/headers.c index 4ea1516a306..f9c0d6a9dfc 100644 --- a/ext/http/response/headers.c +++ b/ext/http/response/headers.c @@ -87,19 +87,14 @@ PHP_METHOD(Phalcon_Http_Response_Headers, get){ zval *name, *headers, *header_value; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 1, 0, &name); + phalcon_fetch_params(0, 1, 0, &name); - PHALCON_OBS_VAR(headers); - phalcon_read_property_this(&headers, this_ptr, SL("_headers"), PH_NOISY_CC); - if (phalcon_array_isset(headers, name)) { - PHALCON_OBS_VAR(header_value); - phalcon_array_fetch(&header_value, headers, name, PH_NOISY); - RETURN_CCTOR(header_value); + headers = phalcon_fetch_nproperty_this(this_ptr, SL("_headers"), PH_NOISY_CC); + if (phalcon_array_isset_fetch(&header_value, headers, name)) { + RETURN_ZVAL(header_value, 1, 0); } - RETURN_MM_FALSE; + RETURN_FALSE; } /** @@ -109,16 +104,11 @@ PHP_METHOD(Phalcon_Http_Response_Headers, get){ */ PHP_METHOD(Phalcon_Http_Response_Headers, setRaw){ - zval *header, *zval_null; - - PHALCON_MM_GROW(); + zval *header; phalcon_fetch_params(1, 1, 0, &header); - PHALCON_INIT_VAR(zval_null); - phalcon_update_property_array(this_ptr, SL("_headers"), header, zval_null TSRMLS_CC); - - PHALCON_MM_RESTORE(); + phalcon_update_property_array(this_ptr, SL("_headers"), header, PHALCON_GLOBAL(z_null) TSRMLS_CC); } /** diff --git a/ext/image/adapter/gd.c b/ext/image/adapter/gd.c index 85874acf030..6eb2a326970 100644 --- a/ext/image/adapter/gd.c +++ b/ext/image/adapter/gd.c @@ -1539,7 +1539,7 @@ PHP_METHOD(Phalcon_Image_Adapter_GD, _create) { phalcon_call_func_p2_noret("imagealphablending", image, blendmode); phalcon_call_func_p2_noret("imagesavealpha", image, saveflag); - RETURN_CCTOR(image); + RETURN_CTOR(image); } /** diff --git a/ext/logger/adapter/file.c b/ext/logger/adapter/file.c index 72ebc4ef057..6817a28725f 100644 --- a/ext/logger/adapter/file.c +++ b/ext/logger/adapter/file.c @@ -141,7 +141,7 @@ PHP_METHOD(Phalcon_Logger_Adapter_File, getFormatter){ phalcon_update_property_this(this_ptr, SL("_formatter"), formatter TSRMLS_CC); } - RETURN_CCTOR(formatter); + RETURN_CTOR(formatter); } /** diff --git a/ext/logger/adapter/firephp.c b/ext/logger/adapter/firephp.c index 701387fe441..dfd8ff10b2e 100644 --- a/ext/logger/adapter/firephp.c +++ b/ext/logger/adapter/firephp.c @@ -77,18 +77,16 @@ PHALCON_INIT_CLASS(Phalcon_Logger_Adapter_Firephp){ */ PHP_METHOD(Phalcon_Logger_Adapter_Firephp, getFormatter){ - zval *formatter = NULL; + zval *formatter; - PHALCON_MM_GROW(); - - PHALCON_OBS_VAR(formatter); - phalcon_read_property_this(&formatter, this_ptr, SL("_formatter"), PH_NOISY_CC); + formatter = phalcon_fetch_nproperty_this(this_ptr, SL("_formatter"), PH_NOISY_CC); if (Z_TYPE_P(formatter) != IS_OBJECT) { /* This will update $this->_formatter, no need to call phalcon_update_property_this() explicitly */ - object_init_ex(formatter, phalcon_logger_formatter_firephp_ce); + object_init_ex(return_value, phalcon_logger_formatter_firephp_ce); + return; } - RETURN_CCTOR(formatter); + RETURN_ZVAL(formatter, 1, 0); } /** diff --git a/ext/logger/adapter/stream.c b/ext/logger/adapter/stream.c index 99d48cd611e..28634a4467e 100644 --- a/ext/logger/adapter/stream.c +++ b/ext/logger/adapter/stream.c @@ -136,7 +136,7 @@ PHP_METHOD(Phalcon_Logger_Adapter_Stream, getFormatter){ phalcon_update_property_this(this_ptr, SL("_formatter"), formatter TSRMLS_CC); } - RETURN_CCTOR(formatter); + RETURN_CTOR(formatter); } /** diff --git a/ext/logger/adapter/syslog.c b/ext/logger/adapter/syslog.c index 5c98898d39b..f607b73367f 100644 --- a/ext/logger/adapter/syslog.c +++ b/ext/logger/adapter/syslog.c @@ -137,7 +137,7 @@ PHP_METHOD(Phalcon_Logger_Adapter_Syslog, getFormatter){ phalcon_update_property_this(this_ptr, SL("_formatter"), formatter TSRMLS_CC); } - RETURN_CCTOR(formatter); + RETURN_CTOR(formatter); } /** diff --git a/ext/mvc/collection.c b/ext/mvc/collection.c index 01945adc358..ec7d07d1a3b 100644 --- a/ext/mvc/collection.c +++ b/ext/mvc/collection.c @@ -372,7 +372,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, getSource){ phalcon_update_property_this(this_ptr, SL("_source"), source TSRMLS_CC); } - RETURN_CCTOR(source); + RETURN_CTOR(source); } /** @@ -431,7 +431,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, getConnection){ phalcon_update_property_this(this_ptr, SL("_connection"), connection TSRMLS_CC); } - RETURN_CCTOR(connection); + RETURN_CTOR(connection); } /** @@ -455,7 +455,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, readAttribute){ if (phalcon_isset_property_zval(this_ptr, attribute TSRMLS_CC)) { PHALCON_OBS_VAR(attribute_value); phalcon_read_property_zval(&attribute_value, this_ptr, attribute, PH_NOISY_CC); - RETURN_CCTOR(attribute_value); + RETURN_CTOR(attribute_value); } RETURN_MM_NULL(); } @@ -525,7 +525,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, cloneResult){ zend_hash_move_forward_ex(ah0, &hp0); } - RETURN_CCTOR(cloned_collection); + RETURN_CTOR(cloned_collection); } /** @@ -936,7 +936,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, _postSave){ phalcon_call_method_p1_noret(this_ptr, "fireevent", event_name); } - RETURN_CCTOR(success); + RETURN_CTOR(success); } if (!zend_is_true(disable_events)) { PHALCON_INIT_NVAR(event_name); @@ -1821,13 +1821,13 @@ PHP_METHOD(Phalcon_Mvc_Collection, summatory){ if (phalcon_array_isset_string(first_retval, SS("summatory"))) { PHALCON_OBS_VAR(summatory); phalcon_array_fetch_string(&summatory, first_retval, SL("summatory"), PH_NOISY); - RETURN_CCTOR(summatory); + RETURN_CTOR(summatory); } - RETURN_CCTOR(first_retval); + RETURN_CTOR(first_retval); } - RETURN_CCTOR(retval); + RETURN_CTOR(retval); } PHALCON_MM_RESTORE(); diff --git a/ext/mvc/collection/document.c b/ext/mvc/collection/document.c index 289a1cd8054..08c23585c44 100644 --- a/ext/mvc/collection/document.c +++ b/ext/mvc/collection/document.c @@ -90,7 +90,7 @@ PHP_METHOD(Phalcon_Mvc_Collection_Document, offsetGet){ if (phalcon_isset_property_zval(this_ptr, index TSRMLS_CC)) { PHALCON_OBS_VAR(value); phalcon_read_property_zval(&value, this_ptr, index, PH_NOISY_CC); - RETURN_CCTOR(value); + RETURN_CTOR(value); } PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_collection_exception_ce, "The index does not exist in the row"); return; @@ -149,7 +149,7 @@ PHP_METHOD(Phalcon_Mvc_Collection_Document, readAttribute){ if (phalcon_isset_property_zval(this_ptr, attribute TSRMLS_CC)) { PHALCON_OBS_VAR(attribute_value); phalcon_read_property_zval(&attribute_value, this_ptr, attribute, PH_NOISY_CC); - RETURN_CCTOR(attribute_value); + RETURN_CTOR(attribute_value); } RETURN_MM_NULL(); } diff --git a/ext/mvc/collection/manager.c b/ext/mvc/collection/manager.c index 67c3c463779..09fb4ca0cb1 100644 --- a/ext/mvc/collection/manager.c +++ b/ext/mvc/collection/manager.c @@ -179,10 +179,8 @@ PHP_METHOD(Phalcon_Mvc_Collection_Manager, getCustomEventsManager){ PHALCON_INIT_VAR(class_name); phalcon_get_class(class_name, model, 1 TSRMLS_CC); - if (phalcon_array_isset(custom_events_manager, class_name)) { - PHALCON_OBS_VAR(events_manager); - phalcon_array_fetch(&events_manager, custom_events_manager, class_name, PH_NOISY); - RETURN_CCTOR(events_manager); + if (phalcon_array_isset_fetch(&events_manager, custom_events_manager, class_name)) { + RETURN_CTOR(events_manager); } } @@ -351,10 +349,8 @@ PHP_METHOD(Phalcon_Mvc_Collection_Manager, isUsingImplicitObjectIds){ */ PHALCON_OBS_VAR(implicit_objects_ids); phalcon_read_property_this(&implicit_objects_ids, this_ptr, SL("_implicitObjectsIds"), PH_NOISY_CC); - if (phalcon_array_isset(implicit_objects_ids, entity_name)) { - PHALCON_OBS_VAR(implicit); - phalcon_array_fetch(&implicit, implicit_objects_ids, entity_name, PH_NOISY); - RETURN_CCTOR(implicit); + if (phalcon_array_isset_fetch(&implicit, implicit_objects_ids, entity_name)) { + RETURN_CTOR(implicit); } RETURN_MM_TRUE; diff --git a/ext/mvc/model.c b/ext/mvc/model.c index 5f3c894f2b9..68f722c6694 100644 --- a/ext/mvc/model.c +++ b/ext/mvc/model.c @@ -344,7 +344,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getModelsMetaData){ phalcon_update_property_this(this_ptr, SL("_modelsMetaData"), meta_data TSRMLS_CC); } - RETURN_CCTOR(meta_data); + RETURN_CTOR(meta_data); } /** @@ -820,7 +820,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap){ phalcon_call_method_noret(object, "afterfetch"); } - RETURN_CCTOR(object); + RETURN_CTOR(object); } /** @@ -854,7 +854,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate){ */ if (Z_TYPE_P(column_map) != IS_ARRAY) { if (PHALCON_IS_LONG(hydration_mode, 1)) { - RETURN_CCTOR(data); + RETURN_CTOR(data); } } @@ -908,7 +908,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate){ zend_hash_move_forward_ex(ah0, &hp0); } - RETURN_CCTOR(hydrate); + RETURN_CTOR(hydrate); } /** @@ -984,7 +984,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResult){ phalcon_call_method_noret(object, "afterfetch"); } - RETURN_CCTOR(object); + RETURN_CTOR(object); } /** @@ -1098,7 +1098,7 @@ PHP_METHOD(Phalcon_Mvc_Model, find){ } } - RETURN_CCTOR(resultset); + RETURN_CTOR(resultset); } /** @@ -1587,7 +1587,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _groupResult){ * Return the full resultset if the query is grouped */ if (phalcon_array_isset_string(params, SS("group"))) { - RETURN_CCTOR(resultset); + RETURN_CTOR(resultset); } /** @@ -1602,7 +1602,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _groupResult){ PHALCON_OBS_VAR(value); phalcon_read_property_zval(&value, first_row, alias, PH_NOISY_CC); - RETURN_CCTOR(value); + RETURN_CTOR(value); } /** @@ -3066,7 +3066,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _postSave){ ZVAL_STRING(event_name, "afterSave", 1); phalcon_call_method_p1_noret(this_ptr, "fireevent", event_name); - RETURN_CCTOR(success); + RETURN_CTOR(success); } PHALCON_INIT_NVAR(event_name); @@ -3323,7 +3323,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert){ phalcon_update_property_null(this_ptr, SL("_uniqueParams") TSRMLS_CC); } - RETURN_CCTOR(success); + RETURN_CTOR(success); } /** @@ -4202,7 +4202,7 @@ PHP_METHOD(Phalcon_Mvc_Model, save){ } } - RETURN_CCTOR(new_success); + RETURN_CTOR(new_success); } /** @@ -4776,7 +4776,7 @@ PHP_METHOD(Phalcon_Mvc_Model, delete){ */ phalcon_update_property_long(this_ptr, SL("_dirtyState"), 2 TSRMLS_CC); - RETURN_CCTOR(success); + RETURN_CTOR(success); } /** @@ -4961,7 +4961,7 @@ PHP_METHOD(Phalcon_Mvc_Model, readAttribute){ if (phalcon_isset_property_zval(this_ptr, attribute TSRMLS_CC)) { PHALCON_OBS_VAR(attribute_value); phalcon_read_property_zval(&attribute_value, this_ptr, attribute, PH_NOISY_CC); - RETURN_CCTOR(attribute_value); + RETURN_CTOR(attribute_value); } RETURN_MM_NULL(); } @@ -6016,7 +6016,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __call){ PHALCON_INIT_VAR(records); phalcon_call_method_p3(records, this_ptr, "_getrelatedrecords", model_name, method, arguments); if (Z_TYPE_P(records) != IS_NULL) { - RETURN_CCTOR(records); + RETURN_CTOR(records); } PHALCON_OBS_VAR(models_manager); @@ -6028,7 +6028,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __call){ PHALCON_INIT_VAR(status); phalcon_call_method_p3(status, models_manager, "missingmethod", this_ptr, method, arguments); if (Z_TYPE_P(status) != IS_NULL) { - RETURN_CCTOR(status); + RETURN_CTOR(status); } /** @@ -6226,7 +6226,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __set){ phalcon_update_property_zval_zval(this_ptr, lower_property, value TSRMLS_CC); phalcon_update_property_array(this_ptr, SL("_related"), lower_property, value TSRMLS_CC); phalcon_update_property_long(this_ptr, SL("_dirtyState"), 1 TSRMLS_CC); - RETURN_CCTOR(value); + RETURN_CTOR(value); } } @@ -6238,7 +6238,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __set){ phalcon_fast_strtolower(lower_property, property); phalcon_update_property_array(this_ptr, SL("_related"), lower_property, value TSRMLS_CC); phalcon_update_property_long(this_ptr, SL("_dirtyState"), 1 TSRMLS_CC); - RETURN_CCTOR(value); + RETURN_CTOR(value); } /** @@ -6246,7 +6246,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __set){ */ phalcon_update_property_zval_zval(this_ptr, property, value TSRMLS_CC); - RETURN_CCTOR(value); + RETURN_CTOR(value); } /** @@ -6319,7 +6319,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __get){ } } - RETURN_CCTOR(result); + RETURN_CTOR(result); } /** diff --git a/ext/mvc/model/manager.c b/ext/mvc/model/manager.c index 6f8ff2cd5db..577428eae2d 100644 --- a/ext/mvc/model/manager.c +++ b/ext/mvc/model/manager.c @@ -201,7 +201,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getCustomEventsManager){ if (phalcon_array_isset(custom_events_manager, class_name)) { PHALCON_OBS_VAR(events_manager); phalcon_array_fetch(&events_manager, custom_events_manager, class_name, PH_NOISY); - RETURN_CCTOR(events_manager); + RETURN_CTOR(events_manager); } } @@ -349,7 +349,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, load){ RETURN_MM(); } - RETURN_CCTOR(model); + RETURN_CTOR(model); } /** @@ -434,7 +434,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getModelSource){ if (phalcon_array_isset(sources, entity_name)) { PHALCON_OBS_VAR(source); phalcon_array_fetch(&source, sources, entity_name, PH_NOISY); - RETURN_CCTOR(source); + RETURN_CTOR(source); } } @@ -445,7 +445,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getModelSource){ phalcon_uncamelize(source, class_name); phalcon_update_property_array(this_ptr, SL("_sources"), entity_name, source TSRMLS_CC); - RETURN_CCTOR(source); + RETURN_CTOR(source); } /** @@ -507,7 +507,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getModelSchema){ if (phalcon_array_isset(schemas, entity_name)) { PHALCON_OBS_VAR(schema); phalcon_array_fetch(&schema, schemas, entity_name, PH_NOISY); - RETURN_CCTOR(schema); + RETURN_CTOR(schema); } } @@ -645,7 +645,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getWriteConnection){ } PHALCON_VERIFY_INTERFACE(connection, phalcon_db_adapterinterface_ce); - RETURN_CCTOR(connection); + RETURN_CTOR(connection); } /** @@ -700,7 +700,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getReadConnection){ } PHALCON_VERIFY_INTERFACE(connection, phalcon_db_adapterinterface_ce); - RETURN_CCTOR(connection); + RETURN_CTOR(connection); } /** @@ -731,7 +731,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getReadConnectionService){ if (phalcon_array_isset(connection_services, entity_name)) { PHALCON_OBS_VAR(connection); phalcon_array_fetch(&connection, connection_services, entity_name, PH_NOISY); - RETURN_CCTOR(connection); + RETURN_CTOR(connection); } } @@ -766,7 +766,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getWriteConnectionService){ if (phalcon_array_isset(connection_services, entity_name)) { PHALCON_OBS_VAR(connection); phalcon_array_fetch(&connection, connection_services, entity_name, PH_NOISY); - RETURN_CCTOR(connection); + RETURN_CTOR(connection); } } @@ -821,7 +821,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, notifyEvent){ PHALCON_INIT_NVAR(status); phalcon_call_method_p2(status, behavior, "notify", event_name, model); if (PHALCON_IS_FALSE(status)) { - RETURN_CCTOR(status); + RETURN_CTOR(status); } zend_hash_move_forward_ex(ah0, &hp0); @@ -843,7 +843,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, notifyEvent){ PHALCON_INIT_NVAR(status); phalcon_call_method_p2(status, events_manager, "fire", fire_event_name, model); if (PHALCON_IS_FALSE(status)) { - RETURN_CCTOR(status); + RETURN_CTOR(status); } } @@ -864,12 +864,12 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, notifyEvent){ PHALCON_INIT_NVAR(status); phalcon_call_method_p2(status, custom_events_manager, "fire", fire_event_name, model); if (PHALCON_IS_FALSE(status)) { - RETURN_CCTOR(status); + RETURN_CTOR(status); } } } - RETURN_CCTOR(status); + RETURN_CTOR(status); } /** @@ -921,7 +921,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, missingMethod){ PHALCON_INIT_NVAR(result); phalcon_call_method_p3(result, behavior, "missingmethod", model, event_name, data); if (Z_TYPE_P(result) != IS_NULL) { - RETURN_CCTOR(result); + RETURN_CTOR(result); } zend_hash_move_forward_ex(ah0, &hp0); @@ -1037,7 +1037,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, isKeepingSnapshots){ if (phalcon_array_isset(keep_snapshots, entity_name)) { PHALCON_OBS_VAR(is_keeping); phalcon_array_fetch(&is_keeping, keep_snapshots, entity_name, PH_NOISY); - RETURN_CCTOR(is_keeping); + RETURN_CTOR(is_keeping); } } @@ -1088,7 +1088,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, isUsingDynamicUpdate){ if (phalcon_array_isset(dynamic_update, entity_name)) { PHALCON_OBS_VAR(is_using); phalcon_array_fetch(&is_using, dynamic_update, entity_name, PH_NOISY); - RETURN_CCTOR(is_using); + RETURN_CTOR(is_using); } } @@ -1868,7 +1868,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationByAlias){ if (phalcon_array_isset(aliases, key_lower)) { PHALCON_OBS_VAR(relation); phalcon_array_fetch(&relation, aliases, key_lower, PH_NOISY); - RETURN_CCTOR(relation); + RETURN_CTOR(relation); } } @@ -2177,7 +2177,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationRecords){ PHALCON_INIT_VAR(records); phalcon_call_method_p2(records, this_ptr, "getreusablerecords", referenced_model, unique_key); if (Z_TYPE_P(records) == IS_ARRAY || Z_TYPE_P(records) == IS_OBJECT) { - RETURN_CCTOR(records); + RETURN_CTOR(records); } } @@ -2205,7 +2205,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationRecords){ phalcon_call_method_p3_noret(this_ptr, "setreusablerecords", referenced_model, unique_key, records); } - RETURN_CCTOR(records); + RETURN_CTOR(records); } /** @@ -2228,7 +2228,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getReusableRecords){ if (phalcon_array_isset(reusable, key)) { PHALCON_OBS_VAR(records); phalcon_array_fetch(&records, reusable, key, PH_NOISY); - RETURN_CCTOR(records); + RETURN_CTOR(records); } RETURN_MM_NULL(); @@ -2487,7 +2487,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getBelongsTo){ if (phalcon_array_isset(belongs_to_single, lower_name)) { PHALCON_OBS_VAR(relations); phalcon_array_fetch(&relations, belongs_to_single, lower_name, PH_NOISY); - RETURN_CCTOR(relations); + RETURN_CTOR(relations); } } @@ -2517,7 +2517,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getHasMany){ if (phalcon_array_isset(has_many_single, lower_name)) { PHALCON_OBS_VAR(relations); phalcon_array_fetch(&relations, has_many_single, lower_name, PH_NOISY); - RETURN_CCTOR(relations); + RETURN_CTOR(relations); } } @@ -2547,7 +2547,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getHasOne){ if (phalcon_array_isset(has_one_single, lower_name)) { PHALCON_OBS_VAR(relations); phalcon_array_fetch(&relations, has_one_single, lower_name, PH_NOISY); - RETURN_CCTOR(relations); + RETURN_CTOR(relations); } } @@ -2578,7 +2578,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getHasManyToMany){ if (phalcon_array_isset(has_many_to_many_single, lower_name)) { PHALCON_OBS_VAR(relations); phalcon_array_fetch(&relations, has_many_to_many_single, lower_name, PH_NOISY); - RETURN_CCTOR(relations); + RETURN_CTOR(relations); } } @@ -2746,7 +2746,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationsBetween){ if (phalcon_array_isset(belongs_to, key_relation)) { PHALCON_OBS_VAR(relations); phalcon_array_fetch(&relations, belongs_to, key_relation, PH_NOISY); - RETURN_CCTOR(relations); + RETURN_CTOR(relations); } } @@ -2759,7 +2759,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationsBetween){ if (phalcon_array_isset(has_many, key_relation)) { PHALCON_OBS_NVAR(relations); phalcon_array_fetch(&relations, has_many, key_relation, PH_NOISY); - RETURN_CCTOR(relations); + RETURN_CTOR(relations); } } @@ -2772,7 +2772,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getRelationsBetween){ if (phalcon_array_isset(has_one, key_relation)) { PHALCON_OBS_NVAR(relations); phalcon_array_fetch(&relations, has_one, key_relation, PH_NOISY); - RETURN_CCTOR(relations); + RETURN_CTOR(relations); } } @@ -2951,7 +2951,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, getNamespaceAlias){ if (phalcon_array_isset(namespace_aliases, alias)) { PHALCON_OBS_VAR(namespace); phalcon_array_fetch(&namespace, namespace_aliases, alias, PH_NOISY); - RETURN_CCTOR(namespace); + RETURN_CTOR(namespace); } PHALCON_INIT_VAR(exception_message); diff --git a/ext/mvc/model/metadata.c b/ext/mvc/model/metadata.c index b5b95f6c487..513cb15367a 100644 --- a/ext/mvc/model/metadata.c +++ b/ext/mvc/model/metadata.c @@ -313,7 +313,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getStrategy){ phalcon_update_property_this(this_ptr, SL("_strategy"), strategy TSRMLS_CC); } - RETURN_CCTOR(strategy); + RETURN_CTOR(strategy); } /** @@ -367,7 +367,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaData){ PHALCON_OBS_VAR(data); phalcon_array_fetch(&data, meta_data, key, PH_NOISY); - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -429,7 +429,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaDataIndex){ PHALCON_OBS_VAR(attributes); phalcon_array_fetch(&attributes, meta_data_index, index, PH_NOISY); - RETURN_CCTOR(attributes); + RETURN_CTOR(attributes); } /** @@ -562,7 +562,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMap){ PHALCON_OBS_VAR(data); phalcon_array_fetch(&data, column_map, key_name, PH_NOISY); - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -612,7 +612,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMapIndex){ PHALCON_OBS_VAR(attributes); phalcon_array_fetch(&attributes, column_map_model, index, PH_NOISY); - RETURN_CCTOR(attributes); + RETURN_CTOR(attributes); } /** @@ -643,7 +643,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getAttributes){ return; } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -674,7 +674,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getPrimaryKeyAttributes){ return; } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -705,7 +705,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getNonPrimaryKeyAttributes){ return; } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -736,7 +736,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getNotNullAttributes){ return; } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -767,7 +767,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getDataTypes){ return; } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -798,7 +798,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getDataTypesNumeric){ return; } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -824,7 +824,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getIdentityField){ PHALCON_INIT_VAR(data); phalcon_call_method_p2(data, this_ptr, "readmetadataindex", model, index); - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -855,7 +855,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getBindTypes){ return; } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -886,7 +886,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getAutomaticCreateAttributes){ return; } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -917,7 +917,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getAutomaticUpdateAttributes){ return; } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -1000,7 +1000,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getColumnMap){ } } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** @@ -1033,7 +1033,7 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, getReverseColumnMap){ } } - RETURN_CCTOR(data); + RETURN_CTOR(data); } /** diff --git a/ext/mvc/model/query.c b/ext/mvc/model/query.c index 9012f9d969c..bed3416f3f5 100644 --- a/ext/mvc/model/query.c +++ b/ext/mvc/model/query.c @@ -1253,7 +1253,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query, _getTable){ RETURN_MM(); } - RETURN_CCTOR(source); + RETURN_CTOR(source); } PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Corrupted SELECT AST"); return; @@ -2199,7 +2199,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query, _getJoins){ zend_hash_move_forward_ex(ah2, &hp2); } - RETURN_CCTOR(sql_joins); + RETURN_CTOR(sql_joins); } /** @@ -3324,7 +3324,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query, parse){ PHALCON_OBS_VAR(intermediate); phalcon_read_property_this(&intermediate, this_ptr, SL("_intermediate"), PH_NOISY_CC); if (Z_TYPE_P(intermediate) == IS_ARRAY) { - RETURN_CCTOR(intermediate); + RETURN_CTOR(intermediate); } PHALCON_OBS_VAR(phql); @@ -3370,7 +3370,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query, parse){ PHALCON_OBS_VAR(type); phalcon_array_fetch_string(&type, ast, ISL(type), PH_NOISY); phalcon_update_property_this(this_ptr, SL("_type"), type TSRMLS_CC); - RETURN_CCTOR(ir_phql); + RETURN_CTOR(ir_phql); } } } @@ -3439,7 +3439,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query, parse){ phalcon_update_property_this(this_ptr, SL("_intermediate"), ir_phql TSRMLS_CC); - RETURN_CCTOR(ir_phql); + RETURN_CTOR(ir_phql); } /** @@ -4322,7 +4322,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query, _getRelatedRecords){ PHALCON_INIT_VAR(records); phalcon_call_method_p2(records, query, "execute", bind_params, bind_types); - RETURN_CCTOR(records); + RETURN_CTOR(records); } /** @@ -4798,7 +4798,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query, execute){ PHALCON_CPY_WRT(prepared_result, result); } - RETURN_CCTOR(prepared_result); + RETURN_CTOR(prepared_result); } phalcon_update_property_this(this_ptr, SL("_cache"), cache TSRMLS_CC); @@ -4898,7 +4898,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query, execute){ RETURN_MM(); } - RETURN_CCTOR(result); + RETURN_CTOR(result); } /** diff --git a/ext/mvc/model/relation.c b/ext/mvc/model/relation.c index a713231cf90..ecddb56e962 100644 --- a/ext/mvc/model/relation.c +++ b/ext/mvc/model/relation.c @@ -206,22 +206,15 @@ PHP_METHOD(Phalcon_Mvc_Model_Relation, getForeignKey){ zval *options, *foreign_key; - PHALCON_MM_GROW(); + options = phalcon_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); - PHALCON_OBS_VAR(options); - phalcon_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - if (phalcon_array_isset_string(options, SS("foreignKey"))) { - - PHALCON_OBS_VAR(foreign_key); - phalcon_array_fetch_string(&foreign_key, options, SL("foreignKey"), PH_NOISY); - if (zend_is_true(foreign_key)) { - RETURN_CCTOR(foreign_key); - } + if (phalcon_array_isset_string_fetch(&foreign_key, options, SS("foreignKey"))) { + if (zend_is_true(foreign_key)) { + RETURN_ZVAL(foreign_key, 1, 0); } } - RETURN_MM_FALSE; + RETURN_FALSE; } /** @@ -233,19 +226,12 @@ PHP_METHOD(Phalcon_Mvc_Model_Relation, isThrough){ zval *type; - PHALCON_MM_GROW(); - - PHALCON_OBS_VAR(type); - phalcon_read_property_this(&type, this_ptr, SL("_type"), PH_NOISY_CC); - if (PHALCON_IS_LONG(type, 3)) { - RETURN_MM_TRUE; - } else { - if (PHALCON_IS_LONG(type, 4)) { - RETURN_MM_TRUE; - } + type = phalcon_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); + if (PHALCON_IS_LONG(type, 3) || PHALCON_IS_LONG(type, 4)) { + RETURN_TRUE; } - RETURN_MM_FALSE; + RETURN_FALSE; } /** @@ -257,19 +243,13 @@ PHP_METHOD(Phalcon_Mvc_Model_Relation, isReusable){ zval *options, *reusable; - PHALCON_MM_GROW(); + options = phalcon_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); - PHALCON_OBS_VAR(options); - phalcon_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - if (phalcon_array_isset_string(options, SS("reusable"))) { - PHALCON_OBS_VAR(reusable); - phalcon_array_fetch_string(&reusable, options, SL("reusable"), PH_NOISY); - RETURN_CCTOR(reusable); - } + if (phalcon_array_isset_string_fetch(&reusable, options, SS("reusable"))) { + RETURN_ZVAL(reusable, 1, 0); } - RETURN_MM_FALSE; + RETURN_FALSE; } /** diff --git a/ext/mvc/model/transaction/manager.c b/ext/mvc/model/transaction/manager.c index c33586aa4ad..aa0e9cbfaef 100644 --- a/ext/mvc/model/transaction/manager.c +++ b/ext/mvc/model/transaction/manager.c @@ -325,7 +325,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getOrCreateTransaction){ if (Z_TYPE_P(transaction) == IS_OBJECT) { false_value = PHALCON_GLOBAL(z_false); phalcon_call_method_p1_noret(transaction, "setisnewtransaction", false_value); - RETURN_CCTOR(transaction); + RETURN_CTOR(transaction); } zend_hash_move_backwards_ex(ah0, &hp0); diff --git a/ext/mvc/view.c b/ext/mvc/view.c index 24ede7ea8a2..5c5a52a37c9 100644 --- a/ext/mvc/view.c +++ b/ext/mvc/view.c @@ -523,19 +523,14 @@ PHP_METHOD(Phalcon_Mvc_View, getVar){ zval *key, *params, *value; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 1, 0, &key); + phalcon_fetch_params(0, 1, 0, &key); - PHALCON_OBS_VAR(params); - phalcon_read_property_this(¶ms, this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (phalcon_array_isset(params, key)) { - PHALCON_OBS_VAR(value); - phalcon_array_fetch(&value, params, key, PH_NOISY); - RETURN_CCTOR(value); + params = phalcon_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (phalcon_array_isset_fetch(&value, params, key)) { + RETURN_ZVAL(value, 1, 0); } - RETURN_MM_NULL(); + RETURN_NULL(); } /** @@ -1377,7 +1372,7 @@ PHP_METHOD(Phalcon_Mvc_View, partial){ PHP_METHOD(Phalcon_Mvc_View, getRender){ zval *controller_name, *action_name, *params = NULL; - zval *config_callback = NULL, *view, *status, *content; + zval *config_callback = NULL, *view, *status; PHALCON_MM_GROW(); @@ -1443,10 +1438,9 @@ PHP_METHOD(Phalcon_Mvc_View, getRender){ /** * Get the processed content */ - PHALCON_INIT_VAR(content); - phalcon_call_method(content, view, "getcontent"); + phalcon_return_call_method_p0(view, "getcontent"); - RETURN_CCTOR(content); + PHALCON_MM_RESTORE(); } /** @@ -1776,19 +1770,14 @@ PHP_METHOD(Phalcon_Mvc_View, __get){ zval *key, *params, *value; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 1, 0, &key); + phalcon_fetch_params(0, 1, 0, &key); - PHALCON_OBS_VAR(params); - phalcon_read_property_this(¶ms, this_ptr, SL("_viewParams"), PH_NOISY_CC); - if (phalcon_array_isset(params, key)) { - PHALCON_OBS_VAR(value); - phalcon_array_fetch(&value, params, key, PH_NOISY); - RETURN_CCTOR(value); + params = phalcon_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC); + if (phalcon_array_isset_fetch(&value, params, key)) { + RETURN_ZVAL(value, 1, 0); } - RETURN_MM_NULL(); + RETURN_NULL(); } diff --git a/ext/mvc/view/engine/volt.c b/ext/mvc/view/engine/volt.c index 8fddc8232dc..5ae6dec83a0 100644 --- a/ext/mvc/view/engine/volt.c +++ b/ext/mvc/view/engine/volt.c @@ -462,10 +462,11 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, sort){ PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &value); + PHALCON_SEPARATE_PARAM(value); Z_SET_ISREF_P(value); phalcon_call_func_p1_noret("asort", value); Z_UNSET_ISREF_P(value); - RETURN_CCTOR(value); + RETURN_CTOR(value); } diff --git a/ext/security.c b/ext/security.c index 11f73332e3e..d06c405a059 100644 --- a/ext/security.c +++ b/ext/security.c @@ -506,7 +506,7 @@ PHP_METHOD(Phalcon_Security, checkToken){ PHP_METHOD(Phalcon_Security, getSessionToken){ zval *dependency_injector, *service, *session; - zval *key, *session_token; + zval *key; PHALCON_MM_GROW(); @@ -527,9 +527,8 @@ PHP_METHOD(Phalcon_Security, getSessionToken){ PHALCON_INIT_VAR(key); ZVAL_STRING(key, "$PHALCON/CSRF$", 1); - PHALCON_INIT_VAR(session_token); - phalcon_call_method_p1(session_token, session, "get", key); + phalcon_return_call_method_p1(session, "get", key); - RETURN_CCTOR(session_token); + PHALCON_MM_RESTORE(); } diff --git a/ext/session/adapter.c b/ext/session/adapter.c index d6454abb1d5..ce60ceefec2 100644 --- a/ext/session/adapter.c +++ b/ext/session/adapter.c @@ -146,11 +146,8 @@ PHP_METHOD(Phalcon_Session_Adapter, getOptions){ zval *options; - PHALCON_MM_GROW(); - - PHALCON_OBS_VAR(options); - phalcon_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - RETURN_CCTOR(options); + options = phalcon_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); + RETURN_ZVAL(options, 1, 0); } /** @@ -184,11 +181,11 @@ PHP_METHOD(Phalcon_Session_Adapter, get){ PHALCON_OBS_VAR(value); phalcon_array_fetch(&value, _SESSION, key, PH_NOISY); if (PHALCON_IS_NOT_EMPTY(value)) { - RETURN_CCTOR(value); + RETURN_CTOR(value); } } - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } /** diff --git a/ext/session/bag.c b/ext/session/bag.c index 9e660953edc..5f5b71ae4cd 100644 --- a/ext/session/bag.c +++ b/ext/session/bag.c @@ -296,11 +296,11 @@ PHP_METHOD(Phalcon_Session_Bag, get){ PHALCON_OBS_VAR(value); phalcon_array_fetch(&value, data, property, PH_NOISY); if (PHALCON_IS_NOT_EMPTY(value)) { - RETURN_CCTOR(value); + RETURN_CTOR(value); } } - RETURN_CCTOR(default_value); + RETURN_CTOR(default_value); } /** diff --git a/ext/tag.c b/ext/tag.c index 023e5fa6cad..606092baaf7 100644 --- a/ext/tag.c +++ b/ext/tag.c @@ -179,7 +179,7 @@ PHP_METHOD(Phalcon_Tag, getDI){ zval *dependency_injector; dependency_injector = phalcon_fetch_static_property_ce(phalcon_tag_ce, SL("_dependencyInjector") TSRMLS_CC); - RETURN_CCTORW(dependency_injector); + RETURN_CTORW(dependency_injector); } /** @@ -218,7 +218,7 @@ PHP_METHOD(Phalcon_Tag, getUrlService){ phalcon_update_static_property_ce(phalcon_tag_ce, SL("_urlService"), url TSRMLS_CC); } - RETURN_CCTOR(url); + RETURN_CTOR(url); } /** @@ -257,7 +257,7 @@ PHP_METHOD(Phalcon_Tag, getEscaperService){ phalcon_update_static_property_ce(phalcon_tag_ce, SL("_escaperService"), escaper TSRMLS_CC); } - RETURN_CCTOR(escaper); + RETURN_CTOR(escaper); } /** @@ -1300,11 +1300,15 @@ PHP_METHOD(Phalcon_Tag, stylesheetLink){ phalcon_fetch_params(1, 0, 2, ¶meters, &local); + if (!parameters) { + parameters = PHALCON_GLOBAL(z_null); + } + if (!local) { local = PHALCON_GLOBAL(z_true); } - if (!parameters || Z_TYPE_P(parameters) != IS_ARRAY) { + if (Z_TYPE_P(parameters) != IS_ARRAY) { PHALCON_INIT_VAR(params); array_init_size(params, 2); phalcon_array_append(¶ms, parameters, 0); @@ -1399,11 +1403,15 @@ PHP_METHOD(Phalcon_Tag, javascriptInclude){ phalcon_fetch_params(1, 0, 2, ¶meters, &local); + if (!parameters) { + parameters = PHALCON_GLOBAL(z_null); + } + if (!local) { local = PHALCON_GLOBAL(z_true); } - if (!parameters || Z_TYPE_P(parameters) != IS_ARRAY) { + if (Z_TYPE_P(parameters) != IS_ARRAY) { PHALCON_INIT_VAR(params); array_init_size(params, 2); phalcon_array_append(¶ms, parameters, 0); @@ -1672,6 +1680,10 @@ PHP_METHOD(Phalcon_Tag, tagHtml){ phalcon_fetch_params(1, 1, 4, &tag_name, ¶meters, &self_close, &only_start, &use_eol); + if (!parameters) { + parameters = PHALCON_GLOBAL(z_null); + } + if (!self_close) { self_close = PHALCON_GLOBAL(z_false); } @@ -1684,7 +1696,7 @@ PHP_METHOD(Phalcon_Tag, tagHtml){ use_eol = PHALCON_GLOBAL(z_false); } - if (!parameters || Z_TYPE_P(parameters) != IS_ARRAY) { + if (Z_TYPE_P(parameters) != IS_ARRAY) { PHALCON_INIT_VAR(params); array_init_size(params, 1); phalcon_array_append(¶ms, parameters, 0); diff --git a/ext/translate/adapter/nativearray.c b/ext/translate/adapter/nativearray.c index 8ca1208f8ad..7264108287b 100644 --- a/ext/translate/adapter/nativearray.c +++ b/ext/translate/adapter/nativearray.c @@ -149,10 +149,10 @@ PHP_METHOD(Phalcon_Translate_Adapter_NativeArray, query){ } } - RETURN_CCTOR(translation); + RETURN_CTOR(translation); } - RETURN_CCTOR(index); + RETURN_CTOR(index); } /** diff --git a/ext/validation/message/group.c b/ext/validation/message/group.c index 3873c534a76..35317a451aa 100644 --- a/ext/validation/message/group.c +++ b/ext/validation/message/group.c @@ -90,19 +90,14 @@ PHP_METHOD(Phalcon_Validation_Message_Group, offsetGet){ zval *index, *messages, *message; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 1, 0, &index); + phalcon_fetch_params(0, 1, 0, &index); - PHALCON_OBS_VAR(messages); - phalcon_read_property_this(&messages, this_ptr, SL("_messages"), PH_NOISY_CC); - if (phalcon_array_isset(messages, index)) { - PHALCON_OBS_VAR(message); - phalcon_array_fetch(&message, messages, index, PH_NOISY); - RETURN_CCTOR(message); + messages = phalcon_fetch_nproperty_this(this_ptr, SL("_messages"), PH_NOISY_CC); + if (phalcon_array_isset_fetch(&message, messages, index)) { + RETURN_ZVAL(message, 1, 0); } - RETURN_MM_NULL(); + RETURN_NULL(); } /** @@ -360,20 +355,13 @@ PHP_METHOD(Phalcon_Validation_Message_Group, current){ zval *position, *messages, *message; - PHALCON_MM_GROW(); - - PHALCON_OBS_VAR(position); - phalcon_read_property_this(&position, this_ptr, SL("_position"), PH_NOISY_CC); - - PHALCON_OBS_VAR(messages); - phalcon_read_property_this(&messages, this_ptr, SL("_messages"), PH_NOISY_CC); - if (phalcon_array_isset(messages, position)) { - PHALCON_OBS_VAR(message); - phalcon_array_fetch(&message, messages, position, PH_NOISY); - RETURN_CCTOR(message); + position = phalcon_fetch_nproperty_this(this_ptr, SL("_position"), PH_NOISY_CC); + messages = phalcon_fetch_nproperty_this(this_ptr, SL("_messages"), PH_NOISY_CC); + if (phalcon_array_isset_fetch(&message, messages, position)) { + RETURN_ZVAL(message, 1, 0); } - RETURN_MM_NULL(); + RETURN_NULL(); } /** diff --git a/ext/validation/validator.c b/ext/validation/validator.c index 6ebe45639b8..634f0899e24 100644 --- a/ext/validation/validator.c +++ b/ext/validation/validator.c @@ -116,21 +116,14 @@ PHP_METHOD(Phalcon_Validation_Validator, getOption){ zval *key, *options, *value; - PHALCON_MM_GROW(); - - phalcon_fetch_params(1, 1, 0, &key); + phalcon_fetch_params(0, 1, 0, &key); - PHALCON_OBS_VAR(options); - phalcon_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); - if (Z_TYPE_P(options) == IS_ARRAY) { - if (phalcon_array_isset(options, key)) { - PHALCON_OBS_VAR(value); - phalcon_array_fetch(&value, options, key, PH_NOISY); - RETURN_CCTOR(value); - } + options = phalcon_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC); + if (phalcon_array_isset_fetch(&value, options, key)) { + RETURN_ZVAL(value, 1, 0); } - RETURN_MM_NULL(); + RETURN_NULL(); } /**