/** * Internal handler to call a queue of events * * @param \SplPriorityQueue|array queue * @param \Phalcon\Events\Event event * @return mixed */ PHP_METHOD(Phalcon_Events_Manager, fireQueue) { HashTable *_12$$21; HashPosition _11$$21; zend_bool collect = 0, cancelable = 0; zephir_fcall_cache_entry *_7 = NULL, *_8 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *queue, *event, *status = NULL, *arguments = NULL, *eventName = NULL, *data = NULL, *iterator = NULL, *source = NULL, *handler = NULL, *_4 = NULL, *_5, *_0$$5, *_1$$5, _2$$5, *_3$$5 = NULL, *_6$$8 = NULL, *_9$$14 = NULL, *_10$$19 = NULL, **_13$$21, *_14$$27 = NULL, *_15$$32 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &queue, &event); if (Z_TYPE_P(queue) != IS_ARRAY) { if (Z_TYPE_P(queue) == IS_OBJECT) { if (!(zephir_instance_of_ev(queue, spl_ce_SplPriorityQueue TSRMLS_CC))) { ZEPHIR_INIT_VAR(_0$$5); object_init_ex(_0$$5, phalcon_events_exception_ce); ZEPHIR_INIT_VAR(_1$$5); zephir_get_class(_1$$5, queue, 0 TSRMLS_CC); ZEPHIR_SINIT_VAR(_2$$5); ZVAL_STRING(&_2$$5, "Unexpected value type: expected object of type SplPriorityQueue, %s given", 0); ZEPHIR_CALL_FUNCTION(&_3$$5, "sprintf", NULL, 193, &_2$$5, _1$$5); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, _0$$5, "__construct", NULL, 9, _3$$5); zephir_check_call_status(); zephir_throw_exception_debug(_0$$5, "phalcon/events/manager.zep", 210 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_events_exception_ce, "The queue is not valid", "phalcon/events/manager.zep", 213); return; } } ZEPHIR_INIT_VAR(status); ZVAL_NULL(status); ZEPHIR_INIT_VAR(arguments); ZVAL_NULL(arguments); ZEPHIR_CALL_METHOD(&eventName, event, "gettype", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(eventName) != IS_STRING) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_events_exception_ce, "The event type not valid", "phalcon/events/manager.zep", 222); return; } ZEPHIR_CALL_METHOD(&source, event, "getsource", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&data, event, "getdata", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_4, event, "iscancelable", NULL, 0); zephir_check_call_status(); cancelable = zephir_get_boolval(_4); ZEPHIR_OBS_VAR(_5); zephir_read_property_this(&_5, this_ptr, SL("_collect"), PH_NOISY_CC); collect = zephir_get_boolval(_5); if (Z_TYPE_P(queue) == IS_OBJECT) { ZEPHIR_INIT_VAR(iterator); if (zephir_clone(iterator, queue TSRMLS_CC) == FAILURE) { RETURN_MM(); } ZEPHIR_CALL_METHOD(NULL, iterator, "top", NULL, 0); zephir_check_call_status(); while (1) { ZEPHIR_CALL_METHOD(&_6$$8, iterator, "valid", NULL, 0); zephir_check_call_status(); if (!(zephir_is_true(_6$$8))) { break; } ZEPHIR_CALL_METHOD(&handler, iterator, "current", &_7, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, iterator, "next", &_8, 0); zephir_check_call_status(); if (Z_TYPE_P(handler) == IS_OBJECT) { if (zephir_instance_of_ev(handler, zend_ce_closure TSRMLS_CC)) { if (Z_TYPE_P(arguments) == IS_NULL) { ZEPHIR_INIT_NVAR(arguments); zephir_create_array(arguments, 3, 0 TSRMLS_CC); zephir_array_fast_append(arguments, event); zephir_array_fast_append(arguments, source); zephir_array_fast_append(arguments, data); } ZEPHIR_INIT_NVAR(status); ZEPHIR_CALL_USER_FUNC_ARRAY(status, handler, arguments); zephir_check_call_status(); if (collect) { zephir_update_property_array_append(this_ptr, SL("_responses"), status TSRMLS_CC); } if (cancelable) { ZEPHIR_CALL_METHOD(&_9$$14, event, "isstopped", NULL, 0); zephir_check_call_status(); if (zephir_is_true(_9$$14)) { break; } } } else { if ((zephir_method_exists(handler, eventName TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD_ZVAL(&status, handler, eventName, NULL, 0, event, source, data); zephir_check_call_status(); if (collect) { zephir_update_property_array_append(this_ptr, SL("_responses"), status TSRMLS_CC); } if (cancelable) { ZEPHIR_CALL_METHOD(&_10$$19, event, "isstopped", NULL, 0); zephir_check_call_status(); if (zephir_is_true(_10$$19)) { break; } } } } } } } else { zephir_is_iterable(queue, &_12$$21, &_11$$21, 0, 0, "phalcon/events/manager.zep", 358); for ( ; zend_hash_get_current_data_ex(_12$$21, (void**) &_13$$21, &_11$$21) == SUCCESS ; zend_hash_move_forward_ex(_12$$21, &_11$$21) ) { ZEPHIR_GET_HVALUE(handler, _13$$21); if (Z_TYPE_P(handler) == IS_OBJECT) { if (zephir_instance_of_ev(handler, zend_ce_closure TSRMLS_CC)) { if (Z_TYPE_P(arguments) == IS_NULL) { ZEPHIR_INIT_NVAR(arguments); zephir_create_array(arguments, 3, 0 TSRMLS_CC); zephir_array_fast_append(arguments, event); zephir_array_fast_append(arguments, source); zephir_array_fast_append(arguments, data); } ZEPHIR_INIT_NVAR(status); ZEPHIR_CALL_USER_FUNC_ARRAY(status, handler, arguments); zephir_check_call_status(); if (collect) { zephir_update_property_array_append(this_ptr, SL("_responses"), status TSRMLS_CC); } if (cancelable) { ZEPHIR_CALL_METHOD(&_14$$27, event, "isstopped", NULL, 0); zephir_check_call_status(); if (zephir_is_true(_14$$27)) { break; } } } else { if ((zephir_method_exists(handler, eventName TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD_ZVAL(&status, handler, eventName, NULL, 0, event, source, data); zephir_check_call_status(); if (collect) { zephir_update_property_array_append(this_ptr, SL("_responses"), status TSRMLS_CC); } if (cancelable) { ZEPHIR_CALL_METHOD(&_15$$32, event, "isstopped", NULL, 0); zephir_check_call_status(); if (zephir_is_true(_15$$32)) { break; } } } } } } } RETURN_CCTOR(status); }
/** * @todo cas argument is inconsistent here * * @param \Ouchbase\Entity entity * @param string|null cas * @throws \Ouchbase\Exception\EntityLogicException * @throws \Ouchbase\Exception\EntityModifiedException * @return this */ PHP_METHOD(Ouchbase_Repository, update) { zend_class_entry *_8; zval *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *entity = NULL, *cas = NULL, *_0 = NULL, *data = NULL, *originalData = NULL, *_1, *_2 = NULL, *_3 = NULL, *_4, *_6 = NULL, *e = NULL, *_7 = NULL, *ex; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &entity, &cas); ZEPHIR_SEPARATE_PARAM(entity); if (!cas) { cas = ZEPHIR_GLOBAL(global_null); } if (!(zephir_instance_of_ev(entity, ouchbase_entity_ce TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'entity' must be an instance of 'Ouchbase\\Entity'", "", 0); return; } if (zephir_instance_of_ev(entity, ouchbase_entityproxy_ce TSRMLS_CC)) { ZEPHIR_CALL_METHOD(&_0, entity, "isproxied", NULL); zephir_check_call_status(); if (!(zephir_is_true(_0))) { RETURN_THIS(); } ZEPHIR_CALL_METHOD(&entity, entity, "_getobject", NULL); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&data, this_ptr, "toarray", NULL, entity); zephir_check_call_status(); _1 = zephir_fetch_nproperty_this(this_ptr, SL("im"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&originalData, _1, "getoriginaldata", NULL, entity); zephir_check_call_status(); if (!(zephir_is_true(originalData))) { ZEPHIR_INIT_VAR(_2); object_init_ex(_2, ouchbase_exception_entitylogicexception_ce); ZEPHIR_INIT_VAR(_3); ZVAL_STRING(_3, "was not registered in the identity map", 0); ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, entity, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); zephir_throw_exception_debug(_2, "ouchbase/Repository.zep", 215 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (ZEPHIR_IS_EQUAL(data, originalData)) { RETURN_THIS(); } _4 = zephir_fetch_nproperty_this(this_ptr, SL("im"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, _4, "updateoriginaldata", NULL, entity, data); zephir_check_call_status(); if (!(zephir_is_true(cas))) { ZEPHIR_INIT_VAR(_5); array_init_size(_5, 3); ZEPHIR_CALL_METHOD(&_6, entity, "getid", NULL); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, this_ptr, "getkey", NULL, _6); zephir_check_call_status(); zephir_array_fast_append(_5, _0); ZEPHIR_INIT_NVAR(_3); zephir_json_encode(_3, &(_3), data, 0 TSRMLS_CC); zephir_array_fast_append(_5, _3); ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "replace", 0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "executewithouttimeouts", NULL, _3, _5); zephir_check_temp_parameter(_3); zephir_check_call_status(); RETURN_THIS(); } /* try_start_1: */ ZEPHIR_INIT_NVAR(_5); array_init_size(_5, 6); ZEPHIR_CALL_METHOD(&_7, entity, "getid", NULL); zephir_check_call_status_or_jump(try_end_1); ZEPHIR_CALL_METHOD(&_6, this_ptr, "getkey", NULL, _7); zephir_check_call_status_or_jump(try_end_1); zephir_array_fast_append(_5, _6); ZEPHIR_INIT_NVAR(_3); zephir_json_encode(_3, &(_3), data, 0 TSRMLS_CC); zephir_array_fast_append(_5, _3); ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 0); zephir_array_fast_append(_5, _3); zephir_array_fast_append(_5, cas); ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "replace", 0); ZEPHIR_CALL_METHOD(&_0, this_ptr, "executewithouttimeouts", NULL, _3, _5); zephir_check_temp_parameter(_3); zephir_check_call_status_or_jump(try_end_1); if (!(zephir_is_true(_0))) { ZEPHIR_INIT_LNVAR(_2); _8 = zend_fetch_class(SL("CouchbaseKeyMutatedException"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(_2, _8); ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(_2, "ouchbase/Repository.zep", 233 TSRMLS_CC); goto try_end_1; } RETURN_THIS(); try_end_1: ZEPHIR_CPY_WRT(e, EG(exception)); if (zephir_is_instance_of(e, SL("CouchbaseKeyMutatedException") TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_INIT_VAR(ex); object_init_ex(ex, ouchbase_exception_entitymodifiedexception_ce); ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "was modified", 0); ZEPHIR_CALL_METHOD(NULL, ex, "__construct", NULL, entity, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "update", 0); ZEPHIR_CALL_METHOD(NULL, ex, "setaction", NULL, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); zephir_throw_exception_debug(ex, "ouchbase/Repository.zep", 242 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } RETURN_THIS(); }
PHP_METHOD(PhalconPlus_RPC_Server_AbstractServer, callByParams) { zend_class_entry *_10, *_17; zephir_nts_static zephir_fcall_cache_entry *_5 = NULL, *_7 = NULL, *_13 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *_3 = NULL, *_18, *_19; zend_bool _2; zval *service_param = NULL, *method_param = NULL, *request = NULL, *rawData, *serviceClass = NULL, *_0 = NULL, *_1, *tmp = NULL, *param, *paramClass = NULL, *_4 = NULL, *_6 = NULL, *_8 = NULL, *_9 = NULL, *_11 = NULL, *_12 = NULL, *_14, *_15, *serviceObj, *response = NULL, *e = NULL, *_16 = NULL, *_20; zval *service = NULL, *method = NULL, *_21; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 4, 0, &service_param, &method_param, &request, &rawData); if (unlikely(Z_TYPE_P(service_param) != IS_STRING && Z_TYPE_P(service_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'service' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(service_param) == IS_STRING)) { zephir_get_strval(service, service_param); } else { ZEPHIR_INIT_VAR(service); ZVAL_EMPTY_STRING(service); } if (unlikely(Z_TYPE_P(method_param) != IS_STRING && Z_TYPE_P(method_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'method' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(method_param) == IS_STRING)) { zephir_get_strval(method, method_param); } else { ZEPHIR_INIT_VAR(method); ZVAL_EMPTY_STRING(method); } ZEPHIR_INIT_VAR(serviceClass); ZVAL_STRING(serviceClass, "", 1); ZEPHIR_INIT_VAR(tmp); array_init(tmp); ZEPHIR_INIT_VAR(_1); zephir_ucfirst(_1, service); ZEPHIR_INIT_NVAR(serviceClass); ZEPHIR_CONCAT_VS(serviceClass, _1, "Service"); _2 = Z_TYPE_P(request) == IS_OBJECT; if (_2) { _2 = zephir_instance_of_ev(request, phalconplus_base_protobuffer_ce TSRMLS_CC); } if (_2) { zephir_update_property_this(this_ptr, SL("phpOnly"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } else if (Z_TYPE_P(request) == IS_ARRAY) { ZEPHIR_CPY_WRT(tmp, request); ZEPHIR_INIT_VAR(param); object_init_ex(param, zephir_get_internal_ce(SS("reflectionparameter") TSRMLS_CC)); ZEPHIR_INIT_VAR(_3); zephir_create_array(_3, 2, 0 TSRMLS_CC); zephir_array_fast_append(_3, serviceClass); zephir_array_fast_append(_3, method); ZEPHIR_INIT_VAR(_4); ZVAL_LONG(_4, 0); ZEPHIR_CALL_METHOD(NULL, param, "__construct", &_5, _3, _4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_6, param, "getclass", &_7); zephir_check_call_status(); if (zephir_is_true(_6)) { ZEPHIR_CALL_METHOD(&_8, param, "getclass", &_7); zephir_check_call_status(); ZEPHIR_CALL_METHOD(¶mClass, _8, "getname", NULL); zephir_check_call_status(); ZEPHIR_INIT_NVAR(request); zephir_fetch_safe_class(_9, paramClass); _10 = zend_fetch_class(Z_STRVAL_P(_9), Z_STRLEN_P(_9), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(request, _10); if (zephir_has_constructor(request TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, request, "__construct", NULL); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(NULL, request, "softclone", NULL, tmp); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(_4); object_init_ex(_4, zend_exception_get_default(TSRMLS_C)); ZEPHIR_INIT_VAR(_11); zephir_json_encode(_11, &(_11), request, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_12); ZEPHIR_CONCAT_SVSVSV(_12, "Service class:method definition is invalid. Detail: ", service, " : ", method, ". Request: ", _11); ZEPHIR_CALL_METHOD(NULL, _4, "__construct", &_13, _12); zephir_check_call_status(); zephir_throw_exception_debug(_4, "phalconplus/RPC/Server/AbstractServer.zep", 36 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } else { ZEPHIR_INIT_NVAR(_4); object_init_ex(_4, zend_exception_get_default(TSRMLS_C)); ZEPHIR_INIT_NVAR(_11); zephir_json_encode(_11, &(_11), request, 0 TSRMLS_CC); ZEPHIR_INIT_LNVAR(_12); ZEPHIR_CONCAT_SV(_12, "Your input is not allowed. Request: ", _11); ZEPHIR_CALL_METHOD(NULL, _4, "__construct", &_13, _12); zephir_check_call_status(); zephir_throw_exception_debug(_4, "phalconplus/RPC/Server/AbstractServer.zep", 39 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } _14 = zephir_fetch_nproperty_this(this_ptr, SL("di"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_4); ZVAL_STRING(_4, "requestCheck", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_6, _14, "has", NULL, _4); zephir_check_temp_parameter(_4); zephir_check_call_status(); if (zephir_is_true(_6)) { _15 = zephir_fetch_nproperty_this(this_ptr, SL("di"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_3); zephir_create_array(_3, 3, 0 TSRMLS_CC); zephir_array_fast_append(_3, serviceClass); zephir_array_fast_append(_3, method); zephir_array_fast_append(_3, rawData); ZEPHIR_INIT_NVAR(_4); ZVAL_STRING(_4, "requestCheck", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _15, "get", NULL, _4, _3); zephir_check_temp_parameter(_4); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(NULL, this_ptr, "requestcheck", NULL, serviceClass, method, request); zephir_check_call_status(); } ZEPHIR_INIT_VAR(serviceObj); zephir_fetch_safe_class(_16, serviceClass); _17 = zend_fetch_class(Z_STRVAL_P(_16), Z_STRLEN_P(_16), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(serviceObj, _17); if (zephir_has_constructor(serviceObj TSRMLS_CC)) { _15 = zephir_fetch_nproperty_this(this_ptr, SL("di"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, serviceObj, "__construct", NULL, _15); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_3); zephir_create_array(_3, 2, 0 TSRMLS_CC); zephir_array_fast_append(_3, serviceObj); zephir_array_fast_append(_3, method); if (zephir_is_callable(_3 TSRMLS_CC)) { /* try_start_1: */ ZEPHIR_INIT_NVAR(_4); ZEPHIR_INIT_VAR(_18); zephir_create_array(_18, 2, 0 TSRMLS_CC); zephir_array_fast_append(_18, serviceObj); zephir_array_fast_append(_18, method); ZEPHIR_INIT_VAR(_19); zephir_create_array(_19, 1, 0 TSRMLS_CC); zephir_array_fast_append(_19, request); ZEPHIR_CALL_USER_FUNC_ARRAY(_4, _18, _19); zephir_check_call_status_or_jump(try_end_1); ZEPHIR_CPY_WRT(response, _4); try_end_1: if (EG(exception)) { ZEPHIR_CPY_WRT(e, EG(exception)); if (zephir_instance_of_ev(e, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); zephir_throw_exception_debug(e, "phalconplus/RPC/Server/AbstractServer.zep", 55 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } ZEPHIR_INIT_NVAR(_4); _20 = zephir_fetch_nproperty_this(this_ptr, SL("phpOnly"), PH_NOISY_CC); if (ZEPHIR_IS_TRUE(_20)) { ZEPHIR_CPY_WRT(_4, response); } else { ZEPHIR_CALL_METHOD(&_4, response, "toarray", NULL); zephir_check_call_status(); } RETURN_CCTOR(_4); } else { object_init_ex(_4, zend_exception_get_default(TSRMLS_C)); ZEPHIR_INIT_VAR(_21); ZEPHIR_CONCAT_SVSV(_21, "Service:method not found. Detail: ", service, " : ", method); ZEPHIR_CALL_METHOD(NULL, _4, "__construct", &_13, _21); zephir_check_call_status(); zephir_throw_exception_debug(_4, "phalconplus/RPC/Server/AbstractServer.zep", 59 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } }
PHP_METHOD(Test_Exceptions, testMultiException) { zend_bool _1$$4, _3$$7, _5$$10, _7$$13; zend_long ZEPHIR_LAST_CALL_STATUS; zval *returnValue, returnValue_sub, *exception, exception_sub, e, f, iexc, exc, _0, _2$$4, _4$$7, _6$$10, _8$$13; zval *this_ptr = getThis(); ZVAL_UNDEF(&returnValue_sub); ZVAL_UNDEF(&exception_sub); ZVAL_UNDEF(&e); ZVAL_UNDEF(&f); ZVAL_UNDEF(&iexc); ZVAL_UNDEF(&exc); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2$$4); ZVAL_UNDEF(&_4$$7); ZVAL_UNDEF(&_6$$10); ZVAL_UNDEF(&_8$$13); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &returnValue, &exception); ZEPHIR_OBS_VAR(&iexc); zephir_read_property(&iexc, this_ptr, SL("internalExceptionCallable"), PH_NOISY_CC); ZEPHIR_OBS_VAR(&exc); zephir_read_property(&exc, this_ptr, SL("exceptionCallable"), PH_NOISY_CC); /* try_start_1: */ zephir_throw_exception_debug(exception, "test/exceptions.zep", 95 TSRMLS_CC); goto try_end_1; try_end_1: if (EG(exception)) { ZEPHIR_INIT_VAR(&_0); ZVAL_OBJ(&_0, EG(exception)); Z_ADDREF_P(&_0); if (zephir_instance_of_ev(&_0, test_exception_ce TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CPY_WRT(&e, &_0); _1$$4 = zephir_is_callable(&iexc TSRMLS_CC); if (_1$$4) { ZEPHIR_CALL_ZVAL_FUNCTION(&_2$$4, &iexc, NULL, 0); zephir_check_call_status(); _1$$4 = ZEPHIR_IS_FALSE_IDENTICAL(&_2$$4); } if (_1$$4) { } else { zephir_throw_exception_debug(&e, "test/exceptions.zep", 101 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } else { if (zephir_instance_of_ev(&_0, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CPY_WRT(&e, &_0); _3$$7 = zephir_is_callable(&exc TSRMLS_CC); if (_3$$7) { ZEPHIR_CALL_ZVAL_FUNCTION(&_4$$7, &exc, NULL, 0); zephir_check_call_status(); _3$$7 = ZEPHIR_IS_FALSE_IDENTICAL(&_4$$7); } if (_3$$7) { } else { zephir_throw_exception_debug(&e, "test/exceptions.zep", 108 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } else { if (zephir_is_instance_of(&_0, SL("RuntimeError") TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CPY_WRT(&f, &_0); _5$$10 = zephir_is_callable(&exc TSRMLS_CC); if (_5$$10) { ZEPHIR_CALL_ZVAL_FUNCTION(&_6$$10, &exc, NULL, 0); zephir_check_call_status(); _5$$10 = ZEPHIR_IS_FALSE_IDENTICAL(&_6$$10); } if (_5$$10) { } else { zephir_throw_exception_debug(&f, "test/exceptions.zep", 115 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } else { if (zephir_is_instance_of(&_0, SL("LogicError") TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CPY_WRT(&f, &_0); _7$$13 = zephir_is_callable(&exc TSRMLS_CC); if (_7$$13) { ZEPHIR_CALL_ZVAL_FUNCTION(&_8$$13, &exc, NULL, 0); zephir_check_call_status(); _7$$13 = ZEPHIR_IS_FALSE_IDENTICAL(&_8$$13); } if (_7$$13) { } else { zephir_throw_exception_debug(&f, "test/exceptions.zep", 115 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } } } } RETVAL_ZVAL(returnValue, 1, 0); RETURN_MM(); }
/** * Creates a table */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, createTable) { HashTable *_2$$6; HashPosition _1$$6; zephir_fcall_cache_entry *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *definition = NULL; zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL, *sql = NULL, *queries = NULL, *query = NULL, *exception = NULL, *columns = NULL, *_0, **_3$$6, *_4$$7 = NULL, *_6$$5, *_7$$10, *_8$$10; zval *tableName = NULL, *schemaName = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_param); if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { zephir_get_strval(tableName, tableName_param); } else { ZEPHIR_INIT_VAR(tableName); ZVAL_EMPTY_STRING(tableName); } if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { zephir_get_strval(schemaName, schemaName_param); } else { ZEPHIR_INIT_VAR(schemaName); ZVAL_EMPTY_STRING(schemaName); } definition = definition_param; ZEPHIR_OBS_VAR(columns); if (!(zephir_array_isset_string_fetch(&columns, definition, SS("columns"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The table must contain at least one column", "phalcon/db/adapter/pdo/postgresql.zep", 292); return; } if (!(zephir_fast_count_int(columns TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The table must contain at least one column", "phalcon/db/adapter/pdo/postgresql.zep", 296); return; } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&sql, _0, "createtable", NULL, 0, tableName, schemaName, definition); zephir_check_call_status(); ZEPHIR_INIT_VAR(queries); zephir_fast_explode_str(queries, SL(";"), sql, LONG_MAX TSRMLS_CC); if (zephir_fast_count_int(queries TSRMLS_CC) > 1) { /* try_start_1: */ ZEPHIR_CALL_METHOD(NULL, this_ptr, "begin", NULL, 0); zephir_check_call_status_or_jump(try_end_1); zephir_is_iterable(queries, &_2$$6, &_1$$6, 0, 0, "phalcon/db/adapter/pdo/postgresql.zep", 312); for ( ; zend_hash_get_current_data_ex(_2$$6, (void**) &_3$$6, &_1$$6) == SUCCESS ; zend_hash_move_forward_ex(_2$$6, &_1$$6) ) { ZEPHIR_GET_HVALUE(query, _3$$6); if (ZEPHIR_IS_EMPTY(query)) { continue; } ZEPHIR_INIT_LNVAR(_4$$7); ZEPHIR_CONCAT_VS(_4$$7, query, ";"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "query", &_5, 0, _4$$7); zephir_check_call_status_or_jump(try_end_1); } ZEPHIR_RETURN_CALL_METHOD(this_ptr, "commit", NULL, 0); zephir_check_call_status_or_jump(try_end_1); RETURN_MM(); try_end_1: if (EG(exception)) { ZEPHIR_INIT_VAR(_6$$5); ZEPHIR_CPY_WRT(_6$$5, EG(exception)); if (zephir_instance_of_ev(_6$$5, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CPY_WRT(exception, _6$$5); ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); zephir_check_call_status(); zephir_throw_exception_debug(exception, "phalcon/db/adapter/pdo/postgresql.zep", 316 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } else { zephir_array_fetch_long(&_7$$10, queries, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 319 TSRMLS_CC); ZEPHIR_INIT_VAR(_8$$10); ZEPHIR_CONCAT_VS(_8$$10, _7$$10, ";"); ZEPHIR_RETURN_CALL_METHOD(this_ptr, "execute", NULL, 0, _8$$10); zephir_check_call_status(); RETURN_MM(); } RETURN_MM_BOOL(1); }
/** * Returns current row in the resultset */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) { zend_class_entry *_13$$15; HashTable *_3, *_6$$11; HashPosition _2, _5$$11; zval *row = NULL, *hydrateMode = NULL, *eager = NULL, *alias = NULL, *activeRow = NULL, *type = NULL, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *modelName = NULL, *_0, *_1, **_4, **_7$$11, *_8$$12 = NULL, *_9$$15 = NULL, *_11$$15, *_12$$15 = NULL, *_10$$16, *_15$$18, *_16$$18 = NULL, _18$$24 = zval_used_for_init, _19$$24 = zval_used_for_init; zephir_fcall_cache_entry *_14 = NULL, *_17 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, dirtyState = 0; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(activeRow); zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); if (Z_TYPE_P(activeRow) != IS_NULL) { RETURN_CCTOR(activeRow); } ZEPHIR_OBS_VAR(row); zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_disableHydration"), PH_NOISY_CC); if (zephir_is_true(_0)) { zephir_update_property_this(getThis(), SL("_activeRow"), row TSRMLS_CC); RETURN_CCTOR(row); } if (Z_TYPE_P(row) != IS_ARRAY) { if (0) { zephir_update_property_this(getThis(), SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(getThis(), SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } RETURN_MM_BOOL(0); } ZEPHIR_OBS_VAR(hydrateMode); zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); do { if (ZEPHIR_IS_LONG(hydrateMode, 0)) { ZEPHIR_INIT_NVAR(activeRow); object_init_ex(activeRow, phalcon_mvc_model_row_ce); if (zephir_has_constructor(activeRow TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL, 0); zephir_check_call_status(); } break; } if (ZEPHIR_IS_LONG(hydrateMode, 1)) { ZEPHIR_INIT_NVAR(activeRow); array_init(activeRow); break; } ZEPHIR_INIT_NVAR(activeRow); object_init(activeRow); break; } while(0); dirtyState = 0; _1 = zephir_fetch_nproperty_this(this_ptr, SL("_columnTypes"), PH_NOISY_CC); zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 246); for ( ; zend_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zend_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HMKEY(alias, _3, _2); ZEPHIR_GET_HVALUE(column, _4); if (Z_TYPE_P(column) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 133); return; } ZEPHIR_OBS_NVAR(type); zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 136 TSRMLS_CC); if (ZEPHIR_IS_STRING(type, "object")) { ZEPHIR_OBS_NVAR(source); zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 142 TSRMLS_CC); ZEPHIR_OBS_NVAR(attributes); zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 143 TSRMLS_CC); ZEPHIR_OBS_NVAR(columnMap); zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 144 TSRMLS_CC); ZEPHIR_INIT_NVAR(rowModel); array_init(rowModel); zephir_is_iterable(attributes, &_6$$11, &_5$$11, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 162); for ( ; zend_hash_get_current_data_ex(_6$$11, (void**) &_7$$11, &_5$$11) == SUCCESS ; zend_hash_move_forward_ex(_6$$11, &_5$$11) ) { ZEPHIR_GET_HVALUE(attribute, _7$$11); ZEPHIR_OBS_NVAR(columnValue); ZEPHIR_INIT_LNVAR(_8$$12); ZEPHIR_CONCAT_SVSV(_8$$12, "_", source, "_", attribute); zephir_array_fetch(&columnValue, row, _8$$12, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 155 TSRMLS_CC); zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE); } do { if (ZEPHIR_IS_LONG(hydrateMode, 0)) { ZEPHIR_OBS_NVAR(keepSnapshots); if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(keepSnapshots); ZVAL_BOOL(keepSnapshots, 0); } if (ZEPHIR_GLOBAL(orm).late_state_binding) { ZEPHIR_OBS_NVAR(_9$$15); zephir_array_fetch_string(&_9$$15, column, SL("instance"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 173 TSRMLS_CC); if (zephir_instance_of_ev(_9$$15, phalcon_mvc_model_ce TSRMLS_CC)) { zephir_array_fetch_string(&_10$$16, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 174 TSRMLS_CC); ZEPHIR_INIT_NVAR(modelName); zephir_get_class(modelName, _10$$16, 0 TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(modelName); ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); } zephir_array_fetch_string(&_11$$15, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC); ZEPHIR_INIT_NVAR(_12$$15); ZVAL_LONG(_12$$15, dirtyState); _13$$15 = zephir_fetch_class(modelName TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&value, _13$$15, "cloneresultmap", NULL, 0, _11$$15, rowModel, columnMap, _12$$15, keepSnapshots); zephir_check_call_status(); } else { zephir_array_fetch_string(&_15$$18, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 188 TSRMLS_CC); ZEPHIR_INIT_NVAR(_16$$18); ZVAL_LONG(_16$$18, dirtyState); ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_14, 0, _15$$18, rowModel, columnMap, _16$$18, keepSnapshots); zephir_check_call_status(); } break; } ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_17, 0, rowModel, columnMap, hydrateMode); zephir_check_call_status(); break; } while(0); ZEPHIR_OBS_NVAR(attribute); zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 202 TSRMLS_CC); } else { ZEPHIR_OBS_NVAR(sqlAlias); if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) { ZEPHIR_OBS_NVAR(value); zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 210 TSRMLS_CC); } else { ZEPHIR_OBS_NVAR(value); zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC); } if (zephir_array_isset_string(column, SS("balias"))) { ZEPHIR_CPY_WRT(attribute, alias); } else { ZEPHIR_SINIT_NVAR(_18$$24); ZVAL_STRING(&_18$$24, "_", 0); ZEPHIR_SINIT_NVAR(_19$$24); ZVAL_STRING(&_19$$24, "", 0); ZEPHIR_INIT_NVAR(attribute); zephir_fast_str_replace(&attribute, &_18$$24, &_19$$24, alias TSRMLS_CC); } } if (!(zephir_array_isset_string_fetch(&eager, column, SS("eager"), 1 TSRMLS_CC))) { do { if (ZEPHIR_IS_LONG(hydrateMode, 1)) { zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE); break; } zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC); break; } while(0); } } zephir_update_property_this(getThis(), SL("_activeRow"), activeRow TSRMLS_CC); RETURN_CCTOR(activeRow); }
/** * Listens for notifications from the models manager */ PHP_METHOD(Phalcon_Mvc_Collection_Behavior_Timestampable, notify) { zephir_fcall_cache_entry *_4 = NULL; HashTable *_2; HashPosition _1; int ZEPHIR_LAST_CALL_STATUS; zval *type_param = NULL, *model, *options = NULL, *timestamp = NULL, *singleField = NULL, *field, *generator, *format, *_0 = NULL, **_3; zval *type = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &type_param, &model); if (unlikely(Z_TYPE_P(type_param) != IS_STRING && Z_TYPE_P(type_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'type' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(type_param) == IS_STRING)) { zephir_get_strval(type, type_param); } else { ZEPHIR_INIT_VAR(type); ZVAL_EMPTY_STRING(type); } ZEPHIR_CALL_METHOD(&_0, this_ptr, "musttakeaction", NULL, 0, type); zephir_check_call_status(); if (!ZEPHIR_IS_TRUE_IDENTICAL(_0)) { RETURN_MM_NULL(); } ZEPHIR_CALL_METHOD(&options, this_ptr, "getoptions", NULL, 0, type); zephir_check_call_status(); if (Z_TYPE_P(options) == IS_ARRAY) { ZEPHIR_OBS_VAR(field); if (!(zephir_array_isset_string_fetch(&field, options, SS("field"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "The option 'field' is required", "phalcon/mvc/collection/behavior/timestampable.zep", 57); return; } ZEPHIR_INIT_VAR(timestamp); ZVAL_NULL(timestamp); ZEPHIR_OBS_VAR(format); if (zephir_array_isset_string_fetch(&format, options, SS("format"), 0 TSRMLS_CC)) { ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 293, format); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(generator); if (zephir_array_isset_string_fetch(&generator, options, SS("generator"), 0 TSRMLS_CC)) { if (Z_TYPE_P(generator) == IS_OBJECT) { if (zephir_instance_of_ev(generator, zend_ce_closure TSRMLS_CC)) { ZEPHIR_INIT_NVAR(timestamp); ZEPHIR_CALL_USER_FUNC(timestamp, generator); zephir_check_call_status(); } } } } if (Z_TYPE_P(timestamp) == IS_NULL) { ZEPHIR_INIT_NVAR(timestamp); zephir_time(timestamp); } if (Z_TYPE_P(field) == IS_ARRAY) { zephir_is_iterable(field, &_2, &_1, 0, 0, "phalcon/mvc/collection/behavior/timestampable.zep", 95); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(singleField, _3); ZEPHIR_CALL_METHOD(NULL, model, "writeattribute", &_4, 0, singleField, timestamp); zephir_check_call_status(); } } else { ZEPHIR_CALL_METHOD(NULL, model, "writeattribute", NULL, 0, field, timestamp); zephir_check_call_status(); } } ZEPHIR_MM_RESTORE(); }
/** * Check whether a role is allowed to access an action from a resource * * <code> * //Does andres have access to the customers resource to create? * $acl->isAllowed("andres", "Products", "create"); * * //Do guests have access to any resource to edit? * $acl->isAllowed("guests", "*", "edit"); * </code> */ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) { zend_bool _15$$31, _20$$33, _22$$33, _24$$33, _26$$33, _40$$40, _42$$39, _44$$41; HashTable *_5$$13, *_8$$19, *_11$$25, *_18$$30; HashPosition _4$$13, _7$$19, _10$$25, _17$$30; zephir_fcall_cache_entry *_34 = NULL, *_38 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *parameters = NULL; zval *access = NULL; zval *roleName = NULL, *resourceName = NULL, *access_param = NULL, *parameters_param = NULL, *eventsManager = NULL, *accessList = NULL, *accessKey = NULL, *haveAccess = NULL, *roleInherits = NULL, *inheritedRole = NULL, *rolesNames = NULL, *inheritedRoles = NULL, *funcAccess = NULL, *resourceObject = NULL, *roleObject = NULL, *funcList = NULL, *reflectionFunction = NULL, *reflectionParameters = NULL, *parameterNumber = NULL, *parametersForFunction = NULL, *numberOfRequiredParameters = NULL, *userParametersSizeShouldBe = NULL, *reflectionClass = NULL, *parameterToCheck = NULL, *reflectionParameter = NULL, *_0, *_1$$7 = NULL, *_2$$7, *_3$$9, **_6$$13, **_9$$19, **_12$$25, *_13$$28, *_14$$29, *_16$$31, **_19$$30, *_46$$30, *_47$$30, *_21$$33 = NULL, *_23$$33 = NULL, *_25$$33 = NULL, *_27$$33 = NULL, *_28$$33, *_29$$36 = NULL, *_30$$36 = NULL, *_31$$36, *_32$$36 = NULL, *_33$$36 = NULL, *_35$$37, *_36$$38, _37$$38, *_39$$40, *_41$$40, *_43$$39, *_45$$41; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &roleName, &resourceName, &access_param, ¶meters_param); ZEPHIR_SEPARATE_PARAM(roleName); ZEPHIR_SEPARATE_PARAM(resourceName); zephir_get_strval(access, access_param); if (!parameters_param) { ZEPHIR_INIT_VAR(parameters); array_init(parameters); } else { zephir_get_arrval(parameters, parameters_param); } ZEPHIR_INIT_VAR(haveAccess); ZVAL_NULL(haveAccess); ZEPHIR_INIT_VAR(funcAccess); ZVAL_NULL(funcAccess); ZEPHIR_INIT_VAR(resourceObject); ZVAL_NULL(resourceObject); ZEPHIR_INIT_VAR(roleObject); ZVAL_NULL(roleObject); if (Z_TYPE_P(roleName) == IS_OBJECT) { if (!(zephir_instance_of_ev(roleName, phalcon_acl_roleaware_ce TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_acl_exception_ce, "Object passed as roleName must implement RoleAware", "phalcon/acl/adapter/memory.zep", 545); return; } ZEPHIR_CPY_WRT(roleObject, roleName); ZEPHIR_CALL_METHOD(&roleName, roleObject, "getrolename", NULL, 0); zephir_check_call_status(); } if (Z_TYPE_P(resourceName) == IS_OBJECT) { if (!(zephir_instance_of_ev(resourceName, phalcon_acl_resourceaware_ce TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_acl_exception_ce, "Object passed as resourceName must implement ResourceAware", "phalcon/acl/adapter/memory.zep", 553); return; } ZEPHIR_CPY_WRT(resourceObject, resourceName); ZEPHIR_CALL_METHOD(&resourceName, resourceObject, "getresourcename", NULL, 0); zephir_check_call_status(); } zephir_update_property_this(this_ptr, SL("_activeRole"), roleName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_activeResource"), resourceName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_activeAccess"), access TSRMLS_CC); ZEPHIR_OBS_VAR(accessList); zephir_read_property_this(&accessList, this_ptr, SL("_access"), PH_NOISY_CC); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC); ZEPHIR_CPY_WRT(eventsManager, _0); ZEPHIR_OBS_VAR(funcList); zephir_read_property_this(&funcList, this_ptr, SL("_func"), PH_NOISY_CC); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_2$$7); ZVAL_STRING(_2$$7, "acl:beforeCheckAccess", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_1$$7, eventsManager, "fire", NULL, 0, _2$$7, this_ptr); zephir_check_temp_parameter(_2$$7); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_1$$7)) { RETURN_MM_BOOL(0); } } ZEPHIR_OBS_VAR(rolesNames); zephir_read_property_this(&rolesNames, this_ptr, SL("_rolesNames"), PH_NOISY_CC); if (!(zephir_array_isset(rolesNames, roleName))) { _3$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAccess"), PH_NOISY_CC); RETURN_MM_BOOL((ZEPHIR_IS_LONG(_3$$9, 1))); } ZEPHIR_INIT_VAR(accessKey); ZEPHIR_CONCAT_VSVSV(accessKey, roleName, "!", resourceName, "!", access); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 586 TSRMLS_CC); } ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); if (Z_TYPE_P(haveAccess) == IS_NULL) { ZEPHIR_OBS_VAR(roleInherits); zephir_read_property_this(&roleInherits, this_ptr, SL("_roleInherits"), PH_NOISY_CC); ZEPHIR_OBS_VAR(inheritedRoles); if (zephir_array_isset_fetch(&inheritedRoles, roleInherits, roleName, 0 TSRMLS_CC)) { if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) { zephir_is_iterable(inheritedRoles, &_5$$13, &_4$$13, 0, 0, "phalcon/acl/adapter/memory.zep", 610); for ( ; zephir_hash_get_current_data_ex(_5$$13, (void**) &_6$$13, &_4$$13) == SUCCESS ; zephir_hash_move_forward_ex(_5$$13, &_4$$13) ) { ZEPHIR_GET_HVALUE(inheritedRole, _6$$13); ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VSVSV(accessKey, inheritedRole, "!", resourceName, "!", access); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 606 TSRMLS_CC); } ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); } } } } if (Z_TYPE_P(haveAccess) == IS_NULL) { ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VSVS(accessKey, roleName, "!", resourceName, "!*"); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 625 TSRMLS_CC); ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); } else { if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) { zephir_is_iterable(inheritedRoles, &_8$$19, &_7$$19, 0, 0, "phalcon/acl/adapter/memory.zep", 641); for ( ; zephir_hash_get_current_data_ex(_8$$19, (void**) &_9$$19, &_7$$19) == SUCCESS ; zephir_hash_move_forward_ex(_8$$19, &_7$$19) ) { ZEPHIR_GET_HVALUE(inheritedRole, _9$$19); ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VSVS(accessKey, inheritedRole, "!", resourceName, "!*"); ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 637 TSRMLS_CC); break; } } } } } if (Z_TYPE_P(haveAccess) == IS_NULL) { ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VS(accessKey, roleName, "!*!*"); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 656 TSRMLS_CC); ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); } else { if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) { zephir_is_iterable(inheritedRoles, &_11$$25, &_10$$25, 0, 0, "phalcon/acl/adapter/memory.zep", 672); for ( ; zephir_hash_get_current_data_ex(_11$$25, (void**) &_12$$25, &_10$$25) == SUCCESS ; zephir_hash_move_forward_ex(_11$$25, &_10$$25) ) { ZEPHIR_GET_HVALUE(inheritedRole, _12$$25); ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VS(accessKey, inheritedRole, "!*!*"); ZEPHIR_OBS_NVAR(funcAccess); zephir_array_isset_fetch(&funcAccess, funcList, accessKey, 0 TSRMLS_CC); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 668 TSRMLS_CC); break; } } } } } zephir_update_property_this(this_ptr, SL("_accessGranted"), haveAccess TSRMLS_CC); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_13$$28); ZVAL_STRING(_13$$28, "acl:afterCheckAccess", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _13$$28, this_ptr); zephir_check_temp_parameter(_13$$28); zephir_check_call_status(); } if (Z_TYPE_P(haveAccess) == IS_NULL) { _14$$29 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAccess"), PH_NOISY_CC); RETURN_MM_BOOL(ZEPHIR_IS_LONG(_14$$29, 1)); } if (Z_TYPE_P(funcAccess) != IS_NULL) { ZEPHIR_INIT_VAR(reflectionFunction); object_init_ex(reflectionFunction, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, reflectionFunction, "__construct", NULL, 85, funcAccess); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&reflectionParameters, reflectionFunction, "getparameters", NULL, 86); zephir_check_call_status(); ZEPHIR_INIT_VAR(parameterNumber); ZVAL_LONG(parameterNumber, zephir_fast_count_int(reflectionParameters TSRMLS_CC)); if (ZEPHIR_IS_LONG_IDENTICAL(parameterNumber, 0)) { _15$$31 = ZEPHIR_IS_LONG(haveAccess, 1); if (_15$$31) { ZEPHIR_INIT_VAR(_16$$31); ZEPHIR_CALL_USER_FUNC(_16$$31, funcAccess); zephir_check_call_status(); _15$$31 = zephir_is_true(_16$$31); } RETURN_MM_BOOL(_15$$31); } ZEPHIR_INIT_VAR(parametersForFunction); array_init(parametersForFunction); ZEPHIR_CALL_METHOD(&numberOfRequiredParameters, reflectionFunction, "getnumberofrequiredparameters", NULL, 87); zephir_check_call_status(); ZEPHIR_CPY_WRT(userParametersSizeShouldBe, parameterNumber); zephir_is_iterable(reflectionParameters, &_18$$30, &_17$$30, 0, 0, "phalcon/acl/adapter/memory.zep", 737); for ( ; zephir_hash_get_current_data_ex(_18$$30, (void**) &_19$$30, &_17$$30) == SUCCESS ; zephir_hash_move_forward_ex(_18$$30, &_17$$30) ) { ZEPHIR_GET_HVALUE(reflectionParameter, _19$$30); ZEPHIR_CALL_METHOD(&reflectionClass, reflectionParameter, "getclass", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(¶meterToCheck, reflectionParameter, "getname", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(reflectionClass) != IS_NULL) { _20$$33 = Z_TYPE_P(roleObject) != IS_NULL; if (_20$$33) { ZEPHIR_CALL_METHOD(&_21$$33, reflectionClass, "isinstance", NULL, 0, roleObject); zephir_check_call_status(); _20$$33 = zephir_is_true(_21$$33); } if (_20$$33) { zephir_array_append(¶metersForFunction, roleObject, PH_SEPARATE, "phalcon/acl/adapter/memory.zep", 709); ZEPHIR_SEPARATE(userParametersSizeShouldBe); zephir_decrement(userParametersSizeShouldBe); continue; } _22$$33 = Z_TYPE_P(resourceObject) != IS_NULL; if (_22$$33) { ZEPHIR_CALL_METHOD(&_23$$33, reflectionClass, "isinstance", NULL, 0, resourceObject); zephir_check_call_status(); _22$$33 = zephir_is_true(_23$$33); } if (_22$$33) { zephir_array_append(¶metersForFunction, resourceObject, PH_SEPARATE, "phalcon/acl/adapter/memory.zep", 717); ZEPHIR_SEPARATE(userParametersSizeShouldBe); zephir_decrement(userParametersSizeShouldBe); continue; } _24$$33 = zephir_array_isset(parameters, parameterToCheck); if (_24$$33) { ZEPHIR_OBS_NVAR(_25$$33); zephir_array_fetch(&_25$$33, parameters, parameterToCheck, PH_NOISY, "phalcon/acl/adapter/memory.zep", 724 TSRMLS_CC); _24$$33 = Z_TYPE_P(_25$$33) == IS_OBJECT; } _26$$33 = _24$$33; if (_26$$33) { zephir_array_fetch(&_28$$33, parameters, parameterToCheck, PH_NOISY | PH_READONLY, "phalcon/acl/adapter/memory.zep", 724 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_27$$33, reflectionClass, "isinstance", NULL, 0, _28$$33); zephir_check_call_status(); _26$$33 = !zephir_is_true(_27$$33); } if (_26$$33) { ZEPHIR_INIT_NVAR(_29$$36); object_init_ex(_29$$36, phalcon_acl_exception_ce); ZEPHIR_INIT_NVAR(_30$$36); zephir_array_fetch(&_31$$36, parameters, parameterToCheck, PH_NOISY | PH_READONLY, "phalcon/acl/adapter/memory.zep", 726 TSRMLS_CC); zephir_get_class(_30$$36, _31$$36, 0 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_32$$36, reflectionClass, "getname", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_33$$36); ZEPHIR_CONCAT_SVSVSVSVSVS(_33$$36, "Your passed parameter doesn't have the same class as the parameter in defined function when check ", roleName, " can ", access, " ", resourceName, ". Class passed: ", _30$$36, " , Class in defined function: ", _32$$36, "."); ZEPHIR_CALL_METHOD(NULL, _29$$36, "__construct", &_34, 9, _33$$36); zephir_check_call_status(); zephir_throw_exception_debug(_29$$36, "phalcon/acl/adapter/memory.zep", 727 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } if (zephir_array_isset(parameters, parameterToCheck)) { zephir_array_fetch(&_35$$37, parameters, parameterToCheck, PH_NOISY | PH_READONLY, "phalcon/acl/adapter/memory.zep", 733 TSRMLS_CC); zephir_array_append(¶metersForFunction, _35$$37, PH_SEPARATE, "phalcon/acl/adapter/memory.zep", 733); } } if (ZEPHIR_LT_LONG(userParametersSizeShouldBe, zephir_fast_count_int(parameters TSRMLS_CC))) { ZEPHIR_INIT_VAR(_36$$38); ZEPHIR_CONCAT_SVSVSVS(_36$$38, "Number of parameters in array is higher than the number of parameters in defined function when check ", roleName, " can ", access, " ", resourceName, ". Remember that more parameters than defined in function will be ignored."); ZEPHIR_SINIT_VAR(_37$$38); ZVAL_LONG(&_37$$38, 512); ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", &_38, 2, _36$$38, &_37$$38); zephir_check_call_status(); } if (zephir_fast_count_int(parametersForFunction TSRMLS_CC) == 0) { if (ZEPHIR_GT_LONG(numberOfRequiredParameters, 0)) { ZEPHIR_INIT_VAR(_39$$40); ZEPHIR_CONCAT_SVSVSVS(_39$$40, "You didn't provide any parameters when check ", roleName, " can ", access, " ", resourceName, ". We will use default action when no arguments."); ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", &_38, 2, _39$$40); zephir_check_call_status(); _40$$40 = ZEPHIR_IS_LONG(haveAccess, 1); if (_40$$40) { _41$$40 = zephir_fetch_nproperty_this(this_ptr, SL("_noArgumentsDefaultAction"), PH_NOISY_CC); _40$$40 = ZEPHIR_IS_LONG(_41$$40, 1); } RETURN_MM_BOOL(_40$$40); } _42$$39 = ZEPHIR_IS_LONG(haveAccess, 1); if (_42$$39) { ZEPHIR_INIT_VAR(_43$$39); ZEPHIR_CALL_USER_FUNC(_43$$39, funcAccess); zephir_check_call_status(); _42$$39 = zephir_is_true(_43$$39); } RETURN_MM_BOOL(_42$$39); } if (ZEPHIR_LE_LONG(numberOfRequiredParameters, zephir_fast_count_int(parametersForFunction TSRMLS_CC))) { _44$$41 = ZEPHIR_IS_LONG(haveAccess, 1); if (_44$$41) { ZEPHIR_INIT_VAR(_45$$41); ZEPHIR_CALL_USER_FUNC_ARRAY(_45$$41, funcAccess, parametersForFunction); zephir_check_call_status(); _44$$41 = zephir_is_true(_45$$41); } RETURN_MM_BOOL(_44$$41); } ZEPHIR_INIT_VAR(_46$$30); object_init_ex(_46$$30, phalcon_acl_exception_ce); ZEPHIR_INIT_VAR(_47$$30); ZEPHIR_CONCAT_SVSVSV(_47$$30, "You didn't provide all necessary parameters for defined function when check ", roleName, " can ", access, " ", resourceName); ZEPHIR_CALL_METHOD(NULL, _46$$30, "__construct", &_34, 9, _47$$30); zephir_check_call_status(); zephir_throw_exception_debug(_46$$30, "phalcon/acl/adapter/memory.zep", 766 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } RETURN_MM_BOOL(ZEPHIR_IS_LONG(haveAccess, 1)); }
/** * Dispatches a handle action taking into account the routing parameters * * @return object */ PHP_METHOD(Phalcon_Dispatcher, _dispatch) { HashTable *_53$$39; HashPosition _52$$39; zval *_30$$6 = NULL, *_60$$44 = NULL, *_62$$44 = NULL, *_63$$44 = NULL, *_68$$45 = NULL, *_70$$45 = NULL; zval *value = NULL, *handler = NULL, *dependencyInjector = NULL, *namespaceName = NULL, *handlerName = NULL, *actionName = NULL, *params = NULL, *eventsManager = NULL, *actionSuffix = NULL, *handlerClass = NULL, *status = NULL, *actionMethod = NULL, *reflectionMethod = NULL, *methodParams = NULL, *className = NULL, *paramKey = NULL, *methodParam = NULL, *modelName = NULL, *bindModel = NULL, *e = NULL, *_0, *_1$$3, *_2$$3, *_3$$4 = NULL, *_4$$4, *_5$$7 = NULL, *_6$$7 = NULL, *_10$$8 = NULL, *_11$$8 = NULL, *_13$$8, *_14$$6 = NULL, *_49$$6, *_16$$12 = NULL, *_17$$12 = NULL, *_19$$13, *_22$$16 = NULL, *_23$$16 = NULL, *_25$$17, *_26$$19 = NULL, *_27$$19 = NULL, *_29$$20, *_31$$23 = NULL, *_32$$23 = NULL, *_34$$23, *_35$$22 = NULL, *_36$$22 = NULL, *_38$$26, *_39$$28 = NULL, *_40$$28 = NULL, *_42$$28, *_43$$31 = NULL, *_44$$31, *_45$$36 = NULL, *_46$$36 = NULL, *_48$$36, **_54$$39, *_55$$40 = NULL, *_56$$41 = NULL, *_57$$43 = NULL, _59$$43 = zval_used_for_init, *_61$$44 = NULL, *_64$$44 = NULL, _65$$42 = zval_used_for_init, *_66$$42 = NULL, *_69$$45 = NULL, *_71$$45 = NULL, *_72$$46 = NULL, *_74$$47 = NULL, *_76$$48, *_77$$51 = NULL, *_78$$51 = NULL, *_80$$51, *_82$$54 = NULL, *_83$$54, *_84$$57; zend_bool hasService = 0, wasFresh; zephir_fcall_cache_entry *_7 = NULL, *_8 = NULL, *_9 = NULL, *_12 = NULL, *_15 = NULL, *_18 = NULL, *_20 = NULL, *_21 = NULL, *_24 = NULL, *_28 = NULL, *_33 = NULL, *_37 = NULL, *_41 = NULL, *_47 = NULL, *_50 = NULL, *_51 = NULL, *_58 = NULL, *_67 = NULL, *_73 = NULL, *_75 = NULL, *_79 = NULL, *_81 = NULL; int ZEPHIR_LAST_CALL_STATUS, numberDispatches = 0; ZEPHIR_MM_GROW(); wasFresh = 0; _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_INIT_VAR(_1$$3); ZVAL_STRING(_1$$3, "A dependency injection container is required to access related dispatching services", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_2$$3); ZVAL_LONG(_2$$3, 0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "_throwdispatchexception", NULL, 0, _1$$3, _2$$3); zephir_check_temp_parameter(_1$$3); zephir_check_call_status(); RETURN_MM_BOOL(0); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC); ZEPHIR_CPY_WRT(eventsManager, _0); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_4$$4); ZVAL_STRING(_4$$4, "dispatch:beforeDispatchLoop", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_3$$4, eventsManager, "fire", NULL, 0, _4$$4, this_ptr); zephir_check_temp_parameter(_4$$4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_3$$4)) { RETURN_MM_BOOL(0); } } ZEPHIR_INIT_VAR(value); ZVAL_NULL(value); ZEPHIR_INIT_VAR(handler); ZVAL_NULL(handler); numberDispatches = 0; ZEPHIR_OBS_VAR(actionSuffix); zephir_read_property_this(&actionSuffix, this_ptr, SL("_actionSuffix"), PH_NOISY_CC); if (0) { zephir_update_property_this(this_ptr, SL("_finished"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_finished"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } while (1) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (!(!(zephir_is_true(_0)))) { break; } numberDispatches++; if (numberDispatches == 256) { ZEPHIR_INIT_NVAR(_5$$7); ZVAL_STRING(_5$$7, "Dispatcher has detected a cyclic routing causing stability problems", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_6$$7); ZVAL_LONG(_6$$7, 1); ZEPHIR_CALL_METHOD(NULL, this_ptr, "_throwdispatchexception", &_7, 0, _5$$7, _6$$7); zephir_check_temp_parameter(_5$$7); zephir_check_call_status(); break; } if (1) { zephir_update_property_this(this_ptr, SL("_finished"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_finished"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } ZEPHIR_CALL_METHOD(NULL, this_ptr, "_resolveemptyproperties", &_8, 0); zephir_check_call_status(); ZEPHIR_OBS_NVAR(namespaceName); zephir_read_property_this(&namespaceName, this_ptr, SL("_namespaceName"), PH_NOISY_CC); ZEPHIR_OBS_NVAR(handlerName); zephir_read_property_this(&handlerName, this_ptr, SL("_handlerName"), PH_NOISY_CC); ZEPHIR_OBS_NVAR(actionName); zephir_read_property_this(&actionName, this_ptr, SL("_actionName"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&handlerClass, this_ptr, "gethandlerclass", &_9, 0); zephir_check_call_status(); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_11$$8); ZVAL_STRING(_11$$8, "dispatch:beforeDispatch", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_10$$8, eventsManager, "fire", &_12, 0, _11$$8, this_ptr); zephir_check_temp_parameter(_11$$8); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_10$$8)) { continue; } _13$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_13$$8)) { continue; } } ZEPHIR_CALL_METHOD(&_14$$6, dependencyInjector, "has", &_15, 0, handlerClass); zephir_check_call_status(); hasService = zephir_get_boolval(_14$$6); if (!(hasService)) { hasService = zephir_class_exists(handlerClass, 1 TSRMLS_CC); } if (!(hasService)) { ZEPHIR_INIT_LNVAR(_16$$12); ZEPHIR_CONCAT_VS(_16$$12, handlerClass, " handler class cannot be loaded"); ZEPHIR_INIT_NVAR(_17$$12); ZVAL_LONG(_17$$12, 2); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_18, 0, _16$$12, _17$$12); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _19$$13 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_19$$13)) { continue; } } break; } ZEPHIR_CALL_METHOD(&handler, dependencyInjector, "getshared", &_20, 0, handlerClass); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_14$$6, dependencyInjector, "wasfreshinstance", &_21, 0); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_14$$6)) { wasFresh = 1; } if (Z_TYPE_P(handler) != IS_OBJECT) { ZEPHIR_INIT_NVAR(_22$$16); ZVAL_STRING(_22$$16, "Invalid handler returned from the services container", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_23$$16); ZVAL_LONG(_23$$16, 3); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_24, 0, _22$$16, _23$$16); zephir_check_temp_parameter(_22$$16); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _25$$17 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_25$$17)) { continue; } } break; } zephir_update_property_this(this_ptr, SL("_activeHandler"), handler TSRMLS_CC); ZEPHIR_OBS_NVAR(params); zephir_read_property_this(¶ms, this_ptr, SL("_params"), PH_NOISY_CC); if (Z_TYPE_P(params) != IS_ARRAY) { ZEPHIR_INIT_NVAR(_26$$19); ZVAL_STRING(_26$$19, "Action parameters must be an Array", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_27$$19); ZVAL_LONG(_27$$19, 4); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_28, 0, _26$$19, _27$$19); zephir_check_temp_parameter(_26$$19); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _29$$20 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_29$$20)) { continue; } } break; } ZEPHIR_INIT_NVAR(actionMethod); ZEPHIR_CONCAT_VV(actionMethod, actionName, actionSuffix); ZEPHIR_INIT_NVAR(_30$$6); zephir_create_array(_30$$6, 2, 0 TSRMLS_CC); zephir_array_fast_append(_30$$6, handler); zephir_array_fast_append(_30$$6, actionMethod); if (!(zephir_is_callable(_30$$6 TSRMLS_CC))) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_32$$23); ZVAL_STRING(_32$$23, "dispatch:beforeNotFoundAction", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_31$$23, eventsManager, "fire", &_33, 0, _32$$23, this_ptr); zephir_check_temp_parameter(_32$$23); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_31$$23)) { continue; } _34$$23 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_34$$23)) { continue; } } ZEPHIR_INIT_LNVAR(_35$$22); ZEPHIR_CONCAT_SVSVS(_35$$22, "Action '", actionName, "' was not found on handler '", handlerName, "'"); ZEPHIR_INIT_NVAR(_36$$22); ZVAL_LONG(_36$$22, 5); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_37, 0, _35$$22, _36$$22); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _38$$26 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_38$$26)) { continue; } } break; } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_40$$28); ZVAL_STRING(_40$$28, "dispatch:beforeExecuteRoute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_39$$28, eventsManager, "fire", &_41, 0, _40$$28, this_ptr); zephir_check_temp_parameter(_40$$28); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_39$$28)) { continue; } _42$$28 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_42$$28)) { continue; } } if ((zephir_method_exists_ex(handler, SS("beforeexecuteroute") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&_43$$31, handler, "beforeexecuteroute", NULL, 0, this_ptr); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_43$$31)) { continue; } _44$$31 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_44$$31)) { continue; } } if (wasFresh == 1) { if ((zephir_method_exists_ex(handler, SS("initialize") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(NULL, handler, "initialize", NULL, 0); zephir_check_call_status(); } if (zephir_is_true(eventsManager)) { ZEPHIR_INIT_NVAR(_46$$36); ZVAL_STRING(_46$$36, "dispatch:afterInitialize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_45$$36, eventsManager, "fire", &_47, 0, _46$$36, this_ptr); zephir_check_temp_parameter(_46$$36); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_45$$36)) { continue; } _48$$36 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_48$$36)) { continue; } } } _49$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_modelBinding"), PH_NOISY_CC); if (ZEPHIR_IS_TRUE_IDENTICAL(_49$$6)) { ZEPHIR_INIT_NVAR(reflectionMethod); object_init_ex(reflectionMethod, zephir_get_internal_ce(SS("reflectionmethod") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, reflectionMethod, "__construct", &_50, 69, handlerClass, actionMethod); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&methodParams, reflectionMethod, "getparameters", &_51, 70); zephir_check_call_status(); zephir_is_iterable(methodParams, &_53$$39, &_52$$39, 0, 0, "phalcon/dispatcher.zep", 582); for ( ; zephir_hash_get_current_data_ex(_53$$39, (void**) &_54$$39, &_52$$39) == SUCCESS ; zephir_hash_move_forward_ex(_53$$39, &_52$$39) ) { ZEPHIR_GET_HMKEY(paramKey, _53$$39, _52$$39); ZEPHIR_GET_HVALUE(methodParam, _54$$39); ZEPHIR_CALL_METHOD(&_55$$40, methodParam, "getclass", NULL, 0); zephir_check_call_status(); if (zephir_is_true(_55$$40)) { ZEPHIR_CALL_METHOD(&_56$$41, methodParam, "getclass", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&className, _56$$41, "getname", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(className) == IS_STRING) { if (ZEPHIR_IS_STRING(className, "Phalcon\\Mvc\\Model")) { ZEPHIR_CALL_FUNCTION(&_57$$43, "class_implements", &_58, 71, handlerClass); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_59$$43); ZVAL_STRING(&_59$$43, "Phalcon\\Mvc\\Controller\\BindModelInterface", 0); if (zephir_fast_in_array(&_59$$43, _57$$43 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_60$$44); zephir_create_array(_60$$44, 2, 0 TSRMLS_CC); zephir_array_fast_append(_60$$44, handlerClass); ZEPHIR_INIT_NVAR(_61$$44); ZVAL_STRING(_61$$44, "getModelName", 1); zephir_array_fast_append(_60$$44, _61$$44); ZEPHIR_INIT_NVAR(modelName); ZEPHIR_CALL_USER_FUNC(modelName, _60$$44); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_62$$44); zephir_create_array(_62$$44, 2, 0 TSRMLS_CC); zephir_array_fast_append(_62$$44, modelName); ZEPHIR_INIT_NVAR(_61$$44); ZVAL_STRING(_61$$44, "findFirst", 1); zephir_array_fast_append(_62$$44, _61$$44); ZEPHIR_INIT_NVAR(_63$$44); zephir_create_array(_63$$44, 1, 0 TSRMLS_CC); ZEPHIR_OBS_NVAR(_64$$44); zephir_array_fetch(&_64$$44, params, paramKey, PH_NOISY, "phalcon/dispatcher.zep", 567 TSRMLS_CC); zephir_array_fast_append(_63$$44, _64$$44); ZEPHIR_INIT_NVAR(bindModel); ZEPHIR_CALL_USER_FUNC_ARRAY(bindModel, _62$$44, _63$$44); zephir_check_call_status(); zephir_array_update_zval(¶ms, paramKey, &bindModel, PH_COPY | PH_SEPARATE); break; } } ZEPHIR_SINIT_NVAR(_65$$42); ZVAL_STRING(&_65$$42, "Phalcon\\Mvc\\Model", 0); ZEPHIR_CALL_FUNCTION(&_66$$42, "is_subclass_of", &_67, 72, className, &_65$$42); zephir_check_call_status(); if (zephir_is_true(_66$$42)) { ZEPHIR_INIT_NVAR(_68$$45); zephir_create_array(_68$$45, 2, 0 TSRMLS_CC); zephir_array_fast_append(_68$$45, className); ZEPHIR_INIT_NVAR(_69$$45); ZVAL_STRING(_69$$45, "findFirst", 1); zephir_array_fast_append(_68$$45, _69$$45); ZEPHIR_INIT_NVAR(_70$$45); zephir_create_array(_70$$45, 1, 0 TSRMLS_CC); ZEPHIR_OBS_NVAR(_71$$45); zephir_array_fetch(&_71$$45, params, paramKey, PH_NOISY, "phalcon/dispatcher.zep", 575 TSRMLS_CC); zephir_array_fast_append(_70$$45, _71$$45); ZEPHIR_INIT_NVAR(bindModel); ZEPHIR_CALL_USER_FUNC_ARRAY(bindModel, _68$$45, _70$$45); zephir_check_call_status(); zephir_array_update_zval(¶ms, paramKey, &bindModel, PH_COPY | PH_SEPARATE); break; } } } } } zephir_update_property_this(this_ptr, SL("_lastHandler"), handler TSRMLS_CC); /* try_start_1: */ ZEPHIR_CALL_METHOD(&_72$$46, this_ptr, "callactionmethod", &_73, 0, handler, actionMethod, params); zephir_check_call_status_or_jump(try_end_1); zephir_update_property_this(this_ptr, SL("_returnedValue"), _72$$46 TSRMLS_CC); try_end_1: if (EG(exception)) { ZEPHIR_CPY_WRT(e, EG(exception)); if (zephir_instance_of_ev(e, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CALL_METHOD(&_74$$47, this_ptr, "_handleexception", &_75, 0, e); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_74$$47)) { _76$$48 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_76$$48)) { continue; } } else { zephir_throw_exception_debug(e, "phalcon/dispatcher.zep", 595 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_78$$51); ZVAL_STRING(_78$$51, "dispatch:afterExecuteRoute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_77$$51, eventsManager, "fire", &_79, 0, _78$$51, this_ptr, value); zephir_check_temp_parameter(_78$$51); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_77$$51)) { continue; } _80$$51 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_80$$51)) { continue; } ZEPHIR_INIT_NVAR(_78$$51); ZVAL_STRING(_78$$51, "dispatch:afterDispatch", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_81, 0, _78$$51, this_ptr); zephir_check_temp_parameter(_78$$51); zephir_check_call_status(); } if ((zephir_method_exists_ex(handler, SS("afterexecuteroute") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&_82$$54, handler, "afterexecuteroute", NULL, 0, this_ptr, value); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_82$$54)) { continue; } _83$$54 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_83$$54)) { continue; } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_84$$57); ZVAL_STRING(_84$$57, "dispatch:afterDispatchLoop", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _84$$57, this_ptr); zephir_check_temp_parameter(_84$$57); zephir_check_call_status(); } RETURN_CCTOR(handler); }
/** * Dispatches a handle action taking into account the routing parameters * * @return object */ PHP_METHOD(Phalcon_Dispatcher, dispatch) { zval *_30$$6 = NULL, *_50$$39 = NULL; zval *value = NULL, *handler = NULL, *dependencyInjector = NULL, *namespaceName = NULL, *handlerName = NULL, *actionName = NULL, *params = NULL, *eventsManager = NULL, *actionSuffix = NULL, *handlerClass = NULL, *status = NULL, *actionMethod = NULL, *e = NULL, *_0, *_1$$3, *_2$$3, *_3$$4 = NULL, *_4$$4, *_5$$7 = NULL, *_6$$7 = NULL, *_10$$8 = NULL, *_11$$8 = NULL, *_13$$8, *_14$$6 = NULL, *_16$$12 = NULL, *_17$$12 = NULL, *_19$$13, *_22$$16 = NULL, *_23$$16 = NULL, *_25$$17, *_26$$19 = NULL, *_27$$19 = NULL, *_29$$20, *_31$$23 = NULL, *_32$$23 = NULL, *_34$$23, *_35$$22 = NULL, *_36$$22 = NULL, *_38$$26, *_39$$28 = NULL, *_40$$28 = NULL, *_42$$28, *_43$$31 = NULL, *_44$$31, *_45$$36 = NULL, *_46$$36 = NULL, *_48$$36, *_49$$39 = NULL, *_51$$40 = NULL, *_53$$41, *_54$$44 = NULL, *_55$$44 = NULL, *_57$$44, *_59$$47 = NULL, *_60$$47, *_61$$50; zend_bool hasService = 0, wasFresh; zephir_fcall_cache_entry *_7 = NULL, *_8 = NULL, *_9 = NULL, *_12 = NULL, *_15 = NULL, *_18 = NULL, *_20 = NULL, *_21 = NULL, *_24 = NULL, *_28 = NULL, *_33 = NULL, *_37 = NULL, *_41 = NULL, *_47 = NULL, *_52 = NULL, *_56 = NULL, *_58 = NULL; int ZEPHIR_LAST_CALL_STATUS, numberDispatches = 0; ZEPHIR_MM_GROW(); wasFresh = 0; _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_INIT_VAR(_1$$3); ZVAL_STRING(_1$$3, "A dependency injection container is required to access related dispatching services", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_2$$3); ZVAL_LONG(_2$$3, 0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "_throwdispatchexception", NULL, 0, _1$$3, _2$$3); zephir_check_temp_parameter(_1$$3); zephir_check_call_status(); RETURN_MM_BOOL(0); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC); ZEPHIR_CPY_WRT(eventsManager, _0); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_4$$4); ZVAL_STRING(_4$$4, "dispatch:beforeDispatchLoop", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_3$$4, eventsManager, "fire", NULL, 0, _4$$4, this_ptr); zephir_check_temp_parameter(_4$$4); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_3$$4)) { RETURN_MM_BOOL(0); } } ZEPHIR_INIT_VAR(value); ZVAL_NULL(value); ZEPHIR_INIT_VAR(handler); ZVAL_NULL(handler); numberDispatches = 0; ZEPHIR_OBS_VAR(actionSuffix); zephir_read_property_this(&actionSuffix, this_ptr, SL("_actionSuffix"), PH_NOISY_CC); if (0) { zephir_update_property_this(this_ptr, SL("_finished"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_finished"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } while (1) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (!(!(zephir_is_true(_0)))) { break; } numberDispatches++; if (numberDispatches == 256) { ZEPHIR_INIT_NVAR(_5$$7); ZVAL_STRING(_5$$7, "Dispatcher has detected a cyclic routing causing stability problems", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_6$$7); ZVAL_LONG(_6$$7, 1); ZEPHIR_CALL_METHOD(NULL, this_ptr, "_throwdispatchexception", &_7, 0, _5$$7, _6$$7); zephir_check_temp_parameter(_5$$7); zephir_check_call_status(); break; } if (1) { zephir_update_property_this(this_ptr, SL("_finished"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_finished"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } ZEPHIR_CALL_METHOD(NULL, this_ptr, "_resolveemptyproperties", &_8, 0); zephir_check_call_status(); ZEPHIR_OBS_NVAR(namespaceName); zephir_read_property_this(&namespaceName, this_ptr, SL("_namespaceName"), PH_NOISY_CC); ZEPHIR_OBS_NVAR(handlerName); zephir_read_property_this(&handlerName, this_ptr, SL("_handlerName"), PH_NOISY_CC); ZEPHIR_OBS_NVAR(actionName); zephir_read_property_this(&actionName, this_ptr, SL("_actionName"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&handlerClass, this_ptr, "gethandlerclass", &_9, 0); zephir_check_call_status(); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_11$$8); ZVAL_STRING(_11$$8, "dispatch:beforeDispatch", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_10$$8, eventsManager, "fire", &_12, 0, _11$$8, this_ptr); zephir_check_temp_parameter(_11$$8); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_10$$8)) { continue; } _13$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_13$$8)) { continue; } } ZEPHIR_CALL_METHOD(&_14$$6, dependencyInjector, "has", &_15, 0, handlerClass); zephir_check_call_status(); hasService = zephir_get_boolval(_14$$6); if (!(hasService)) { hasService = zephir_class_exists(handlerClass, 1 TSRMLS_CC); } if (!(hasService)) { ZEPHIR_INIT_LNVAR(_16$$12); ZEPHIR_CONCAT_VS(_16$$12, handlerClass, " handler class cannot be loaded"); ZEPHIR_INIT_NVAR(_17$$12); ZVAL_LONG(_17$$12, 2); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_18, 0, _16$$12, _17$$12); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _19$$13 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_19$$13)) { continue; } } break; } ZEPHIR_CALL_METHOD(&handler, dependencyInjector, "getshared", &_20, 0, handlerClass); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_14$$6, dependencyInjector, "wasfreshinstance", &_21, 0); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_14$$6)) { wasFresh = 1; } if (Z_TYPE_P(handler) != IS_OBJECT) { ZEPHIR_INIT_NVAR(_22$$16); ZVAL_STRING(_22$$16, "Invalid handler returned from the services container", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_23$$16); ZVAL_LONG(_23$$16, 3); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_24, 0, _22$$16, _23$$16); zephir_check_temp_parameter(_22$$16); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _25$$17 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_25$$17)) { continue; } } break; } zephir_update_property_this(this_ptr, SL("_activeHandler"), handler TSRMLS_CC); ZEPHIR_OBS_NVAR(params); zephir_read_property_this(¶ms, this_ptr, SL("_params"), PH_NOISY_CC); if (Z_TYPE_P(params) != IS_ARRAY) { ZEPHIR_INIT_NVAR(_26$$19); ZVAL_STRING(_26$$19, "Action parameters must be an Array", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_27$$19); ZVAL_LONG(_27$$19, 4); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_28, 0, _26$$19, _27$$19); zephir_check_temp_parameter(_26$$19); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _29$$20 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_29$$20)) { continue; } } break; } ZEPHIR_INIT_NVAR(actionMethod); ZEPHIR_CONCAT_VV(actionMethod, actionName, actionSuffix); ZEPHIR_INIT_NVAR(_30$$6); zephir_create_array(_30$$6, 2, 0 TSRMLS_CC); zephir_array_fast_append(_30$$6, handler); zephir_array_fast_append(_30$$6, actionMethod); if (!(zephir_is_callable(_30$$6 TSRMLS_CC))) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_32$$23); ZVAL_STRING(_32$$23, "dispatch:beforeNotFoundAction", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_31$$23, eventsManager, "fire", &_33, 0, _32$$23, this_ptr); zephir_check_temp_parameter(_32$$23); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_31$$23)) { continue; } _34$$23 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_34$$23)) { continue; } } ZEPHIR_INIT_LNVAR(_35$$22); ZEPHIR_CONCAT_SVSVS(_35$$22, "Action '", actionName, "' was not found on handler '", handlerName, "'"); ZEPHIR_INIT_NVAR(_36$$22); ZVAL_LONG(_36$$22, 5); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_37, 0, _35$$22, _36$$22); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _38$$26 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_38$$26)) { continue; } } break; } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_40$$28); ZVAL_STRING(_40$$28, "dispatch:beforeExecuteRoute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_39$$28, eventsManager, "fire", &_41, 0, _40$$28, this_ptr); zephir_check_temp_parameter(_40$$28); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_39$$28)) { continue; } _42$$28 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_42$$28)) { continue; } } if ((zephir_method_exists_ex(handler, SS("beforeexecuteroute") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&_43$$31, handler, "beforeexecuteroute", NULL, 0, this_ptr); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_43$$31)) { continue; } _44$$31 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_44$$31)) { continue; } } if (wasFresh == 1) { if ((zephir_method_exists_ex(handler, SS("initialize") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(NULL, handler, "initialize", NULL, 0); zephir_check_call_status(); } if (zephir_is_true(eventsManager)) { ZEPHIR_INIT_NVAR(_46$$36); ZVAL_STRING(_46$$36, "dispatch:afterInitialize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_45$$36, eventsManager, "fire", &_47, 0, _46$$36, this_ptr); zephir_check_temp_parameter(_46$$36); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_45$$36)) { continue; } _48$$36 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_48$$36)) { continue; } } } zephir_update_property_this(this_ptr, SL("_lastHandler"), handler TSRMLS_CC); /* try_start_1: */ ZEPHIR_INIT_NVAR(_49$$39); ZEPHIR_INIT_NVAR(_50$$39); zephir_create_array(_50$$39, 2, 0 TSRMLS_CC); zephir_array_fast_append(_50$$39, handler); zephir_array_fast_append(_50$$39, actionMethod); ZEPHIR_CALL_USER_FUNC_ARRAY(_49$$39, _50$$39, params); zephir_check_call_status_or_jump(try_end_1); zephir_update_property_this(this_ptr, SL("_returnedValue"), _49$$39 TSRMLS_CC); try_end_1: if (EG(exception)) { ZEPHIR_CPY_WRT(e, EG(exception)); if (zephir_instance_of_ev(e, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); zephir_update_property_this(this_ptr, SL("_lastHandler"), handler TSRMLS_CC); ZEPHIR_CALL_METHOD(&_51$$40, this_ptr, "_handleexception", &_52, 0, e); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_51$$40)) { _53$$41 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_53$$41)) { continue; } } else { zephir_throw_exception_debug(e, "phalcon/dispatcher.zep", 522 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_55$$44); ZVAL_STRING(_55$$44, "dispatch:afterExecuteRoute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_54$$44, eventsManager, "fire", &_56, 0, _55$$44, this_ptr, value); zephir_check_temp_parameter(_55$$44); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_54$$44)) { continue; } _57$$44 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_57$$44)) { continue; } ZEPHIR_INIT_NVAR(_55$$44); ZVAL_STRING(_55$$44, "dispatch:afterDispatch", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_58, 0, _55$$44, this_ptr); zephir_check_temp_parameter(_55$$44); zephir_check_call_status(); } if ((zephir_method_exists_ex(handler, SS("afterexecuteroute") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&_59$$47, handler, "afterexecuteroute", NULL, 0, this_ptr, value); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_59$$47)) { continue; } _60$$47 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_60$$47)) { continue; } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_61$$50); ZVAL_STRING(_61$$50, "dispatch:afterDispatchLoop", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _61$$50, this_ptr); zephir_check_temp_parameter(_61$$50); zephir_check_call_status(); } RETURN_CCTOR(handler); }
/** * Returns current row in the resultset */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) { zephir_fcall_cache_entry *_5 = NULL, *_7 = NULL; int ZEPHIR_LAST_CALL_STATUS; zend_class_entry *_4; zval *row, *hydrateMode, *columnMap, *activeRow = NULL, *modelName = NULL, *_0, *_1, *_2, *_3 = NULL, *_6; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(activeRow); zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); if (Z_TYPE_P(activeRow) != IS_NULL) { RETURN_CCTOR(activeRow); } ZEPHIR_OBS_VAR(row); zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); if (Z_TYPE_P(row) != IS_ARRAY) { zephir_update_property_this(this_ptr, SL("_activeRow"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); RETURN_MM_BOOL(0); } ZEPHIR_OBS_VAR(hydrateMode); zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); ZEPHIR_OBS_VAR(columnMap); zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); do { if (ZEPHIR_IS_LONG(hydrateMode, 0)) { if (ZEPHIR_GLOBAL(orm).late_state_binding) { ZEPHIR_INIT_VAR(modelName); ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); ZEPHIR_OBS_VAR(_0); zephir_read_property_this(&_0, this_ptr, SL("_model"), PH_NOISY_CC); if (zephir_instance_of_ev(_0, phalcon_mvc_model_ce TSRMLS_CC)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(modelName); zephir_get_class(modelName, _1, 0 TSRMLS_CC); } _1 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 0); _4 = zephir_fetch_class(modelName TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&activeRow, _4, "cloneresultmap", NULL, 0, _1, row, columnMap, _3, _2); zephir_check_call_status(); } else { _2 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 0); ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_5, 345, _2, row, columnMap, _3, _6); zephir_check_call_status(); } break; } ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_7, 346, row, columnMap, hydrateMode); zephir_check_call_status(); break; } while(0); zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); RETURN_CCTOR(activeRow); }
/** * Resolves the service * * @param array parameters * @return mixed */ PHP_METHOD(Phalcon_Di_Service, resolve) { zend_class_entry *_1$$15; zend_bool found = 0; zend_long ZEPHIR_LAST_CALL_STATUS; zval *parameters = NULL, parameters_sub, *dependencyInjector = NULL, dependencyInjector_sub, __$true, __$false, __$null, shared, definition, sharedInstance, instance, builder, _0$$15, _2$$22; zval *this_ptr = getThis(); ZVAL_UNDEF(¶meters_sub); ZVAL_UNDEF(&dependencyInjector_sub); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_NULL(&__$null); ZVAL_UNDEF(&shared); ZVAL_UNDEF(&definition); ZVAL_UNDEF(&sharedInstance); ZVAL_UNDEF(&instance); ZVAL_UNDEF(&builder); ZVAL_UNDEF(&_0$$15); ZVAL_UNDEF(&_2$$22); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 2, ¶meters, &dependencyInjector); if (!parameters) { parameters = ¶meters_sub; parameters = &__$null; } if (!dependencyInjector) { dependencyInjector = &dependencyInjector_sub; dependencyInjector = &__$null; } ZEPHIR_OBS_VAR(&shared); zephir_read_property(&shared, this_ptr, SL("_shared"), PH_NOISY_CC); if (zephir_is_true(&shared)) { ZEPHIR_OBS_VAR(&sharedInstance); zephir_read_property(&sharedInstance, this_ptr, SL("_sharedInstance"), PH_NOISY_CC); if (Z_TYPE_P(&sharedInstance) != IS_NULL) { RETURN_CCTOR(&sharedInstance); } } found = 1; ZEPHIR_INIT_VAR(&instance); ZVAL_NULL(&instance); ZEPHIR_OBS_VAR(&definition); zephir_read_property(&definition, this_ptr, SL("_definition"), PH_NOISY_CC); if (Z_TYPE_P(&definition) == IS_STRING) { if (zephir_class_exists(&definition, 1 TSRMLS_CC)) { if (Z_TYPE_P(parameters) == IS_ARRAY) { if (zephir_fast_count_int(parameters TSRMLS_CC)) { ZEPHIR_INIT_NVAR(&instance); ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&instance, &definition, parameters TSRMLS_CC); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(&instance); ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&instance, &definition TSRMLS_CC); zephir_check_call_status(); } } else { ZEPHIR_INIT_NVAR(&instance); ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&instance, &definition TSRMLS_CC); zephir_check_call_status(); } } else { found = 0; } } else { if (Z_TYPE_P(&definition) == IS_OBJECT) { if (zephir_instance_of_ev(&definition, zend_ce_closure TSRMLS_CC)) { if (Z_TYPE_P(dependencyInjector) == IS_OBJECT) { _1$$15 = zephir_fetch_class_str_ex(SL("Closure"), ZEND_FETCH_CLASS_AUTO); ZEPHIR_CALL_CE_STATIC(&_0$$15, _1$$15, "bind", NULL, 0, &definition, dependencyInjector); zephir_check_call_status(); ZEPHIR_CPY_WRT(&definition, &_0$$15); } if (Z_TYPE_P(parameters) == IS_ARRAY) { ZEPHIR_INIT_NVAR(&instance); ZEPHIR_CALL_USER_FUNC_ARRAY(&instance, &definition, parameters); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(&instance); ZEPHIR_CALL_USER_FUNC(&instance, &definition); zephir_check_call_status(); } } else { ZEPHIR_CPY_WRT(&instance, &definition); } } else { if (Z_TYPE_P(&definition) == IS_ARRAY) { ZEPHIR_INIT_VAR(&builder); object_init_ex(&builder, phalcon_di_service_builder_ce); if (zephir_has_constructor(&builder TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, &builder, "__construct", NULL, 0); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&instance, &builder, "build", NULL, 171, dependencyInjector, &definition, parameters); zephir_check_call_status(); } else { found = 0; } } } if (found == 0) { ZEPHIR_INIT_VAR(&_2$$22); object_init_ex(&_2$$22, phalcon_di_exception_serviceresolutionexception_ce); ZEPHIR_CALL_METHOD(NULL, &_2$$22, "__construct", NULL, 4); zephir_check_call_status(); zephir_throw_exception_debug(&_2$$22, "phalcon/di/service.zep", 186 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (zephir_is_true(&shared)) { zephir_update_property_zval(this_ptr, SL("_sharedInstance"), &instance); } if (1) { zephir_update_property_zval(this_ptr, SL("_resolved"), &__$true); } else { zephir_update_property_zval(this_ptr, SL("_resolved"), &__$false); } RETURN_CCTOR(&instance); }
/** * Validates the form * * @param array data * @param object entity */ PHP_METHOD(Phalcon_Forms_Form, isValid) { zend_object_iterator *_17$$15; HashTable *_8, *_12$$11; HashPosition _7, _11$$11; zend_bool validationStatus = 0, _5, _10$$11; zephir_fcall_cache_entry *_1 = NULL, *_14 = NULL, *_15 = NULL, *_20 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *data = NULL, *entity = NULL, *messages = NULL, *element = NULL, *validators = NULL, *name = NULL, *filters = NULL, *validator = NULL, *validation = NULL, *elementMessage = NULL, *_0, *_6, **_9, *_16 = NULL, *_2$$6, *_3$$7, *_4$$8 = NULL, **_13$$11, *_18$$16 = NULL, *_19$$16 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 2, &data, &entity); if (!data) { ZEPHIR_CPY_WRT(data, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(data); } if (!entity) { entity = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_elements"), PH_NOISY_CC); if (ZEPHIR_IS_EMPTY(_0)) { RETURN_MM_BOOL(1); } if (Z_TYPE_P(data) != IS_ARRAY) { ZEPHIR_OBS_NVAR(data); zephir_read_property_this(&data, this_ptr, SL("_data"), PH_NOISY_CC); } if (Z_TYPE_P(entity) == IS_OBJECT) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "bind", &_1, 0, data, entity); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(_2$$6); zephir_read_property_this(&_2$$6, this_ptr, SL("_entity"), PH_NOISY_CC); if (Z_TYPE_P(_2$$6) == IS_OBJECT) { _3$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_entity"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, this_ptr, "bind", &_1, 0, data, _3$$7); zephir_check_call_status(); } } if ((zephir_method_exists_ex(this_ptr, SS("beforevalidation") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&_4$$8, this_ptr, "beforevalidation", NULL, 0, data, entity); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_4$$8)) { RETURN_MM_BOOL(0); } } validationStatus = 1; ZEPHIR_CALL_METHOD(&validation, this_ptr, "getvalidation", NULL, 0); zephir_check_call_status(); _5 = Z_TYPE_P(validation) != IS_OBJECT; if (!(_5)) { _5 = !((zephir_instance_of_ev(validation, phalcon_validationinterface_ce TSRMLS_CC))); } if (_5) { ZEPHIR_INIT_NVAR(validation); object_init_ex(validation, phalcon_validation_ce); ZEPHIR_CALL_METHOD(NULL, validation, "__construct", NULL, 216); zephir_check_call_status(); } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_elements"), PH_NOISY_CC); zephir_is_iterable(_6, &_8, &_7, 0, 0, "phalcon/forms/form.zep", 338); for ( ; zend_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS ; zend_hash_move_forward_ex(_8, &_7) ) { ZEPHIR_GET_HVALUE(element, _9); ZEPHIR_CALL_METHOD(&validators, element, "getvalidators", NULL, 0); zephir_check_call_status(); _10$$11 = Z_TYPE_P(validators) != IS_ARRAY; if (!(_10$$11)) { _10$$11 = zephir_fast_count_int(validators TSRMLS_CC) == 0; } if (_10$$11) { continue; } ZEPHIR_CALL_METHOD(&name, element, "getname", NULL, 0); zephir_check_call_status(); zephir_is_iterable(validators, &_12$$11, &_11$$11, 0, 0, "phalcon/forms/form.zep", 325); for ( ; zend_hash_get_current_data_ex(_12$$11, (void**) &_13$$11, &_11$$11) == SUCCESS ; zend_hash_move_forward_ex(_12$$11, &_11$$11) ) { ZEPHIR_GET_HVALUE(validator, _13$$11); ZEPHIR_CALL_METHOD(NULL, validation, "add", &_14, 217, name, validator); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&filters, element, "getfilters", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(filters) == IS_ARRAY) { ZEPHIR_CALL_METHOD(NULL, validation, "setfilters", &_15, 218, name, filters); zephir_check_call_status(); } } ZEPHIR_CALL_METHOD(&messages, validation, "validate", NULL, 219, data, entity); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_16, messages, "count", NULL, 0); zephir_check_call_status(); if (zephir_is_true(_16)) { _17$$15 = zephir_get_iterator(messages TSRMLS_CC); _17$$15->funcs->rewind(_17$$15 TSRMLS_CC); for (;_17$$15->funcs->valid(_17$$15 TSRMLS_CC) == SUCCESS && !EG(exception); _17$$15->funcs->move_forward(_17$$15 TSRMLS_CC)) { { zval **ZEPHIR_TMP_ITERATOR_PTR; _17$$15->funcs->get_current_data(_17$$15, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC); ZEPHIR_CPY_WRT(elementMessage, (*ZEPHIR_TMP_ITERATOR_PTR)); } ZEPHIR_CALL_METHOD(&_19$$16, elementMessage, "getfield", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_18$$16, this_ptr, "get", &_20, 0, _19$$16); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, _18$$16, "appendmessage", NULL, 0, elementMessage); zephir_check_call_status(); } _17$$15->funcs->dtor(_17$$15 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, messages, "rewind", NULL, 0); zephir_check_call_status(); validationStatus = 0; } if (!(validationStatus)) { zephir_update_property_this(this_ptr, SL("_messages"), messages TSRMLS_CC); } if ((zephir_method_exists_ex(this_ptr, SS("aftervalidation") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "aftervalidation", NULL, 0, messages); zephir_check_call_status(); } RETURN_MM_BOOL(validationStatus); }
/** * Modifies a table column based on a definition */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, modifyColumn) { HashTable *_2$$4; HashPosition _1$$4; zephir_fcall_cache_entry *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *tableName_param = NULL, *schemaName_param = NULL, *column, *currentColumn = NULL, *sql = NULL, *queries = NULL, *query = NULL, *exception = NULL, *_0, **_3$$4, *_4$$5 = NULL, *_6$$3, *_7$$8 = NULL, *_8$$8, *_9$$8; zval *tableName = NULL, *schemaName = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &tableName_param, &schemaName_param, &column, ¤tColumn); if (UNEXPECTED(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(tableName_param) == IS_STRING)) { zephir_get_strval(tableName, tableName_param); } else { ZEPHIR_INIT_VAR(tableName); ZVAL_EMPTY_STRING(tableName); } if (UNEXPECTED(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(schemaName_param) == IS_STRING)) { zephir_get_strval(schemaName, schemaName_param); } else { ZEPHIR_INIT_VAR(schemaName); ZVAL_EMPTY_STRING(schemaName); } if (!currentColumn) { currentColumn = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&sql, _0, "modifycolumn", NULL, 0, tableName, schemaName, column, currentColumn); zephir_check_call_status(); ZEPHIR_INIT_VAR(queries); zephir_fast_explode_str(queries, SL(";"), sql, LONG_MAX TSRMLS_CC); if (zephir_fast_count_int(queries TSRMLS_CC) > 1) { /* try_start_1: */ ZEPHIR_CALL_METHOD(NULL, this_ptr, "begin", NULL, 0); zephir_check_call_status_or_jump(try_end_1); zephir_is_iterable(queries, &_2$$4, &_1$$4, 0, 0, "phalcon/db/adapter/pdo/postgresql.zep", 344); for ( ; zend_hash_get_current_data_ex(_2$$4, (void**) &_3$$4, &_1$$4) == SUCCESS ; zend_hash_move_forward_ex(_2$$4, &_1$$4) ) { ZEPHIR_GET_HVALUE(query, _3$$4); if (ZEPHIR_IS_EMPTY(query)) { continue; } ZEPHIR_INIT_LNVAR(_4$$5); ZEPHIR_CONCAT_VS(_4$$5, query, ";"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "query", &_5, 0, _4$$5); zephir_check_call_status_or_jump(try_end_1); } ZEPHIR_RETURN_CALL_METHOD(this_ptr, "commit", NULL, 0); zephir_check_call_status_or_jump(try_end_1); RETURN_MM(); try_end_1: if (EG(exception)) { ZEPHIR_INIT_VAR(_6$$3); ZEPHIR_CPY_WRT(_6$$3, EG(exception)); if (zephir_instance_of_ev(_6$$3, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CPY_WRT(exception, _6$$3); ZEPHIR_CALL_METHOD(NULL, this_ptr, "rollback", NULL, 0); zephir_check_call_status(); zephir_throw_exception_debug(exception, "phalcon/db/adapter/pdo/postgresql.zep", 349 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } else { ZEPHIR_INIT_VAR(_7$$8); if (!(ZEPHIR_IS_EMPTY(sql))) { zephir_array_fetch_long(&_8$$8, queries, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 353 TSRMLS_CC); ZEPHIR_INIT_VAR(_9$$8); ZEPHIR_CONCAT_VS(_9$$8, _8$$8, ";"); ZEPHIR_CALL_METHOD(&_7$$8, this_ptr, "execute", NULL, 0, _9$$8); zephir_check_call_status(); } else { ZVAL_BOOL(_7$$8, 1); } RETURN_CCTOR(_7$$8); } RETURN_MM_BOOL(1); }
PHP_METHOD(Pdm_Db_Adapter_AbstractPdo, bindStatmentParameters) { zephir_fcall_cache_entry *_4 = NULL, *_5 = NULL, *_7 = NULL; int ZEPHIR_LAST_CALL_STATUS; HashTable *_1; HashPosition _0; zend_bool hasBindParams, hasBindTypes, _3; zval *statement, *bindParams = NULL, *bindTypes = NULL, *wildcard = NULL, *value = NULL, *parameter = NULL, *type = NULL, *castValue = NULL, **_2, *_6 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &statement, &bindParams, &bindTypes); if (!bindParams) { ZEPHIR_INIT_VAR(bindParams); array_init(bindParams); } if (!bindTypes) { ZEPHIR_INIT_VAR(bindTypes); array_init(bindTypes); } else { ZEPHIR_SEPARATE_PARAM(bindTypes); } if (!(zephir_instance_of_ev(statement, zephir_get_internal_ce(SS("pdostatement") TSRMLS_CC) TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'statement' must be an instance of 'PDOStatement'", "", 0); return; } if (Z_TYPE_P(bindTypes) != IS_ARRAY) { ZEPHIR_INIT_NVAR(bindTypes); array_init(bindTypes); } if (zephir_fast_count_int(bindParams TSRMLS_CC) > 0) { hasBindParams = 1; } else { hasBindParams = 0; } if (zephir_fast_count_int(bindTypes TSRMLS_CC) > 0) { hasBindTypes = 1; } else { hasBindTypes = 0; } zephir_is_iterable(bindParams, &_1, &_0, 0, 0); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HMKEY(wildcard, _1, _0); ZEPHIR_GET_HVALUE(value, _2); if (Z_TYPE_P(wildcard) == IS_LONG) { ZEPHIR_INIT_NVAR(parameter); ZVAL_LONG(parameter, (zephir_get_numberval(wildcard) + 1)); } else { if (Z_TYPE_P(wildcard) == IS_STRING) { ZEPHIR_CPY_WRT(parameter, wildcard); } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(pdm_db_adapter_exception_ce, "Invalid bind parameter (1)", "pdm/db/adapter/abstractpdo.zep", 126); return; } } _3 = hasBindParams; if (_3) { _3 = hasBindTypes; } if (_3) { ZEPHIR_OBS_NVAR(type); if (!(zephir_array_isset_fetch(&type, bindTypes, wildcard, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(type); ZVAL_LONG(type, 2); } if (ZEPHIR_IS_LONG(type, 32)) { ZEPHIR_INIT_NVAR(castValue); ZVAL_DOUBLE(castValue, zephir_get_doubleval(value)); ZEPHIR_INIT_NVAR(type); ZVAL_LONG(type, 1024); } else { ZEPHIR_CPY_WRT(castValue, value); } if (ZEPHIR_IS_LONG(type, 1024)) { Z_SET_ISREF_P(castValue); ZEPHIR_CALL_METHOD(NULL, statement, "bindparam", &_4, parameter, castValue); zephir_check_call_status(); Z_UNSET_ISREF_P(castValue); } else { Z_SET_ISREF_P(castValue); ZEPHIR_CALL_METHOD(NULL, statement, "bindparam", &_5, parameter, castValue, type); zephir_check_call_status(); Z_UNSET_ISREF_P(castValue); } } else { ZEPHIR_INIT_NVAR(_6); ZVAL_LONG(_6, 2); Z_SET_ISREF_P(value); ZEPHIR_CALL_METHOD(NULL, statement, "bindparam", &_7, parameter, value, _6); zephir_check_call_status(); Z_UNSET_ISREF_P(value); } } RETURN_CCTOR(statement); }
/** * Executes the validation */ PHP_METHOD(Phalcon_Validation_Validator_Callback, validate) { zend_bool _1$$3; zend_long ZEPHIR_LAST_CALL_STATUS; zval *field = NULL; zval *validation, *field_param = NULL, *message = NULL, *label = NULL, *replacePairs = NULL, *code = NULL, *callback = NULL, *returnedValue = NULL, *data = NULL, *_0, *_2$$6 = NULL, *_3$$6 = NULL, *_4$$6; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &validation, &field_param); if (UNEXPECTED(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(field_param) == IS_STRING)) { zephir_get_strval(field, field_param); } else { ZEPHIR_INIT_VAR(field); ZVAL_EMPTY_STRING(field); } ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "callback", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&callback, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); if (zephir_is_callable(callback TSRMLS_CC)) { ZEPHIR_CALL_METHOD(&data, validation, "getentity", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(data)) { ZEPHIR_CALL_METHOD(&data, validation, "getdata", NULL, 0); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&returnedValue, "call_user_func", NULL, 403, callback, data); zephir_check_call_status(); _1$$3 = Z_TYPE_P(returnedValue) == IS_OBJECT; if (_1$$3) { _1$$3 = zephir_instance_of_ev(returnedValue, phalcon_validation_validator_ce TSRMLS_CC); } if (Z_TYPE_P(returnedValue) == IS_BOOL) { if (!(zephir_is_true(returnedValue))) { ZEPHIR_CALL_METHOD(&label, this_ptr, "preparelabel", NULL, 0, validation, field); zephir_check_call_status(); ZEPHIR_INIT_VAR(_2$$6); ZVAL_STRING(_2$$6, "Callback", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _2$$6); zephir_check_temp_parameter(_2$$6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&code, this_ptr, "preparecode", NULL, 0, field); zephir_check_call_status(); ZEPHIR_INIT_VAR(replacePairs); zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_2$$6); object_init_ex(_2$$6, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_3$$6, "strtr", NULL, 27, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_4$$6); ZVAL_STRING(_4$$6, "Callback", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _2$$6, "__construct", NULL, 470, _3$$6, field, _4$$6, code); zephir_check_temp_parameter(_4$$6); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2$$6); zephir_check_call_status(); RETURN_MM_BOOL(0); } RETURN_MM_BOOL(1); } else if (_1$$3) { ZEPHIR_RETURN_CALL_METHOD(returnedValue, "validate", NULL, 0, validation, field); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_validator_exception_ce, "Callback must return boolean or Phalcon\\Validation\\Validator object", "phalcon/validation/validator/callback.zep", 114); return; } RETURN_MM_BOOL(1); }
/** * Sends SQL statements to the database server returning the success state. * Use this method only when the SQL statement sent to the server is returning rows * * <code> * //Querying data * $resultset = $connection->query("SELECT * FROM robots WHERE type = 'mechanical'"); * $resultset = $connection->query("SELECT * FROM robots WHERE type = ?", ["mechanical"]); * </code> * * @param string sqlStatement * @param array bindParams * @param array bindTypes * @return Pdm\Db\ResultInterface|\PDO|bool * <\Pdm\Db\ResultInterface> | <\PDOStatement> | boolean */ PHP_METHOD(Pdm_Db_Adapter_AbstractPdo, query) { int ZEPHIR_LAST_CALL_STATUS; zend_bool _0; zval *sqlStatement_param = NULL, *bindParams = NULL, *bindTypes = NULL, *statement = NULL, *result, *affectedRows = NULL, *_1, *_2 = NULL; zval *sqlStatement = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &sqlStatement_param, &bindParams, &bindTypes); if (unlikely(Z_TYPE_P(sqlStatement_param) != IS_STRING && Z_TYPE_P(sqlStatement_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlStatement' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (unlikely(Z_TYPE_P(sqlStatement_param) == IS_STRING)) { sqlStatement = sqlStatement_param; } else { ZEPHIR_INIT_VAR(sqlStatement); ZVAL_EMPTY_STRING(sqlStatement); } if (!bindParams) { ZEPHIR_INIT_VAR(bindParams); array_init(bindParams); } if (!bindTypes) { ZEPHIR_INIT_VAR(bindTypes); array_init(bindTypes); } _0 = Z_TYPE_P(bindParams) == IS_ARRAY; if (_0) { _0 = zephir_fast_count_int(bindParams TSRMLS_CC) > 0; } if (_0) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("pdo"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&statement, _1, "prepare", NULL, sqlStatement); zephir_check_call_status(); if (Z_TYPE_P(statement) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&_2, this_ptr, "executeprepared", NULL, statement, bindParams, bindTypes); zephir_check_call_status(); ZEPHIR_CPY_WRT(statement, _2); } } else { _1 = zephir_fetch_nproperty_this(this_ptr, SL("pdo"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&statement, _1, "query", NULL, sqlStatement); zephir_check_call_status(); } if (Z_TYPE_P(statement) == IS_OBJECT) { if (zephir_instance_of_ev(statement, zephir_get_internal_ce(SS("pdostatement") TSRMLS_CC) TSRMLS_CC)) { ZEPHIR_CALL_METHOD(&affectedRows, statement, "rowcount", NULL); zephir_check_call_status(); if (Z_TYPE_P(affectedRows) == IS_LONG) { zephir_update_property_this(this_ptr, SL("affectedRows"), affectedRows TSRMLS_CC); } ZEPHIR_INIT_VAR(result); object_init_ex(result, pdm_db_result_pdo_ce); ZEPHIR_CALL_METHOD(NULL, result, "__construct", NULL, this_ptr, statement, sqlStatement, bindParams, bindTypes); zephir_check_call_status(); RETURN_CCTOR(result); } } RETURN_CCTOR(statement); }
/** * Loads registered template engines, if none is registered it will use Phalcon\Mvc\View\Engine\Php * * @return array */ PHP_METHOD(Phalcon_Mvc_View_Simple, _loadTemplateEngines) { zephir_fcall_cache_entry *_5 = NULL, *_7 = NULL; HashTable *_3; HashPosition _2; zephir_nts_static zephir_fcall_cache_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *engines = NULL, *dependencyInjector, *registeredEngines, *arguments, *extension = NULL, *engineService = NULL, *engineObject = NULL, *_0 = NULL, **_4, *_6 = NULL; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(engines); zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(engines)) { ZEPHIR_OBS_VAR(dependencyInjector); zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(engines); array_init(engines); ZEPHIR_OBS_VAR(registeredEngines); zephir_read_property_this(®isteredEngines, this_ptr, SL("_registeredEngines"), PH_NOISY_CC); if (Z_TYPE_P(registeredEngines) != IS_ARRAY) { ZEPHIR_INIT_VAR(_0); object_init_ex(_0, phalcon_mvc_view_engine_php_ce); ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_1, this_ptr, dependencyInjector); zephir_check_call_status(); zephir_array_update_string(&engines, SL(".phtml"), &_0, PH_COPY | PH_SEPARATE); } else { if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the application services", "phalcon/mvc/view/simple.zep", 141); return; } ZEPHIR_INIT_VAR(arguments); zephir_create_array(arguments, 2, 0 TSRMLS_CC); zephir_array_fast_append(arguments, this_ptr); zephir_array_fast_append(arguments, dependencyInjector); zephir_is_iterable(registeredEngines, &_3, &_2, 0, 0, "phalcon/mvc/view/simple.zep", 173); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HMKEY(extension, _3, _2); ZEPHIR_GET_HVALUE(engineService, _4); if (Z_TYPE_P(engineService) == IS_OBJECT) { if (zephir_instance_of_ev(engineService, zend_ce_closure TSRMLS_CC)) { ZEPHIR_INIT_NVAR(engineObject); ZEPHIR_CALL_USER_FUNC_ARRAY(engineObject, engineService, arguments); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(engineObject, engineService); } } else { if (Z_TYPE_P(engineService) == IS_STRING) { ZEPHIR_CALL_METHOD(&engineObject, dependencyInjector, "getshared", &_5, engineService, arguments); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(_0); object_init_ex(_0, phalcon_mvc_view_exception_ce); ZEPHIR_INIT_LNVAR(_6); ZEPHIR_CONCAT_SV(_6, "Invalid template engine registration for extension: ", extension); ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_7, _6); zephir_check_call_status(); zephir_throw_exception_debug(_0, "phalcon/mvc/view/simple.zep", 167 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } zephir_array_update_zval(&engines, extension, &engineObject, PH_COPY | PH_SEPARATE); } } zephir_update_property_this(this_ptr, SL("_engines"), engines TSRMLS_CC); } else { ZEPHIR_OBS_NVAR(engines); zephir_read_property_this(&engines, this_ptr, SL("_engines"), PH_NOISY_CC); } RETURN_CCTOR(engines); }
/** * Internal sanitize wrapper to filter_var */ PHP_METHOD(Phalcon_Filter, _sanitize) { zval *_2$$4, *_9$$10; zend_bool _1$$3; zephir_fcall_cache_entry *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *filter = NULL, *_14$$19; zval *value, *filter_param = NULL, *filterObject = NULL, *_0, _3$$5, *_4$$5 = NULL, _6$$6, _7$$8, _8$$9, _10$$10, *_11$$12, *_12$$12, *_13$$19; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &value, &filter_param); if (unlikely(Z_TYPE_P(filter_param) != IS_STRING && Z_TYPE_P(filter_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'filter' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(filter_param) == IS_STRING)) { zephir_get_strval(filter, filter_param); } else { ZEPHIR_INIT_VAR(filter); ZVAL_EMPTY_STRING(filter); } ZEPHIR_OBS_VAR(filterObject); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_filters"), PH_NOISY_CC); if (zephir_array_isset_fetch(&filterObject, _0, filter, 0 TSRMLS_CC)) { _1$$3 = zephir_instance_of_ev(filterObject, zend_ce_closure TSRMLS_CC); if (!(_1$$3)) { _1$$3 = zephir_is_callable(filterObject TSRMLS_CC); } if (_1$$3) { ZEPHIR_INIT_VAR(_2$$4); zephir_create_array(_2$$4, 1, 0 TSRMLS_CC); zephir_array_fast_append(_2$$4, value); ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, filterObject, _2$$4); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_RETURN_CALL_METHOD(filterObject, "filter", NULL, 0, value); zephir_check_call_status(); RETURN_MM(); } do { if (ZEPHIR_IS_STRING(filter, "email")) { ZEPHIR_SINIT_VAR(_3$$5); ZVAL_STRING(&_3$$5, "FILTER_SANITIZE_EMAIL", 0); ZEPHIR_CALL_FUNCTION(&_4$$5, "constant", NULL, 187, &_3$$5); zephir_check_call_status(); ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_5, 188, value, _4$$5); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "int")) { ZEPHIR_SINIT_VAR(_6$$6); ZVAL_LONG(&_6$$6, 519); ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_5, 188, value, &_6$$6); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "int!")) { RETURN_MM_LONG(zephir_get_intval(value)); } if (ZEPHIR_IS_STRING(filter, "absint")) { ZEPHIR_SINIT_VAR(_7$$8); ZVAL_LONG(&_7$$8, zephir_get_intval(value)); ZEPHIR_RETURN_CALL_FUNCTION("abs", NULL, 189, &_7$$8); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "string")) { ZEPHIR_SINIT_VAR(_8$$9); ZVAL_LONG(&_8$$9, 513); ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_5, 188, value, &_8$$9); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "float")) { ZEPHIR_INIT_VAR(_9$$10); zephir_create_array(_9$$10, 1, 0 TSRMLS_CC); add_assoc_long_ex(_9$$10, SS("flags"), 4096); ZEPHIR_SINIT_VAR(_10$$10); ZVAL_LONG(&_10$$10, 520); ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_5, 188, value, &_10$$10, _9$$10); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "float!")) { RETURN_MM_DOUBLE(zephir_get_doubleval(value)); } if (ZEPHIR_IS_STRING(filter, "alphanum")) { ZEPHIR_INIT_VAR(_11$$12); ZVAL_STRING(_11$$12, "/[^A-Za-z0-9]/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_12$$12); ZVAL_STRING(_12$$12, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 29, _11$$12, _12$$12, value); zephir_check_temp_parameter(_11$$12); zephir_check_temp_parameter(_12$$12); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "trim")) { zephir_fast_trim(return_value, value, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "striptags")) { ZEPHIR_RETURN_CALL_FUNCTION("strip_tags", NULL, 190, value); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "lower")) { if ((zephir_function_exists_ex(SS("mb_strtolower") TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_FUNCTION("mb_strtolower", NULL, 191, value); zephir_check_call_status(); RETURN_MM(); } zephir_fast_strtolower(return_value, value); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "upper")) { if ((zephir_function_exists_ex(SS("mb_strtoupper") TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_FUNCTION("mb_strtoupper", NULL, 192, value); zephir_check_call_status(); RETURN_MM(); } zephir_fast_strtoupper(return_value, value); RETURN_MM(); } ZEPHIR_INIT_VAR(_13$$19); object_init_ex(_13$$19, phalcon_filter_exception_ce); ZEPHIR_INIT_VAR(_14$$19); ZEPHIR_CONCAT_SVS(_14$$19, "Sanitize filter '", filter, "' is not supported"); ZEPHIR_CALL_METHOD(NULL, _13$$19, "__construct", NULL, 9, _14$$19); zephir_check_call_status(); zephir_throw_exception_debug(_13$$19, "phalcon/filter.zep", 213 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } while(0); ZEPHIR_MM_RESTORE(); }
/** * Prepare an HTML string of information about a single variable. */ PHP_METHOD(Phalcon_Debug_Dump, output) { zend_bool _17$$5, _18$$5, _19$$5; HashTable *_8$$4, *_42$$11, *_76$$20; HashPosition _7$$4, _41$$11, _75$$20; zval *_123, *_1$$4, *_13$$5 = NULL, *_26$$8, *_68$$8, *_32$$9, *_46$$12 = NULL, *_60$$14 = NULL, *_81$$22 = NULL, *_87$$23 = NULL, *_95$$24, *_100$$25, *_104$$26, *_108$$27, *_114$$28, *_119$$29; zephir_fcall_cache_entry *_4 = NULL, *_6 = NULL, *_12 = NULL, *_23 = NULL, *_31 = NULL, *_53 = NULL, *_57 = NULL, *_62 = NULL; int tab, ZEPHIR_LAST_CALL_STATUS; zval *name = NULL, *_0$$3; zval *variable, *name_param = NULL, *tab_param = NULL, *key = NULL, *value = NULL, *output = NULL, *space = NULL, *type = NULL, *attr = NULL, *_99 = NULL, *_124 = NULL, *_125, _126, *_2$$4 = NULL, *_3$$4, _5$$4 = zval_used_for_init, **_9$$4, *_25$$4 = NULL, _10$$5 = zval_used_for_init, *_11$$5 = NULL, *_14$$5 = NULL, *_15$$5 = NULL, *_16$$5 = NULL, *_20$$7 = NULL, *_21$$7 = NULL, *_22$$7 = NULL, *_24$$7 = NULL, *_27$$8 = NULL, *_28$$8 = NULL, _29$$8 = zval_used_for_init, *_30$$8 = NULL, *_36$$8, *_67$$8 = NULL, *_69$$8 = NULL, *_70$$8, *_71$$8, *_94$$8 = NULL, *_33$$9 = NULL, *_34$$9, _35$$9, _37$$10, *_38$$10 = NULL, *_39$$10, *_40$$11 = NULL, **_43$$11, _44$$12 = zval_used_for_init, *_45$$12 = NULL, *_47$$12 = NULL, *_48$$12 = NULL, *_49$$12 = NULL, *_50$$12 = NULL, *_51$$12 = NULL, *_52$$12 = NULL, *_54$$14 = NULL, _55$$14 = zval_used_for_init, *_56$$14 = NULL, *_59$$14 = NULL, *_61$$14 = NULL, *_63$$14 = NULL, *_64$$14 = NULL, *_65$$14 = NULL, *_66$$14 = NULL, *_58$$17, _72$$19, *_73$$19 = NULL, *_74$$19, **_77$$20, _91$$20, *_92$$20 = NULL, *_93$$20, *_78$$21 = NULL, _79$$22 = zval_used_for_init, *_80$$22 = NULL, *_82$$22 = NULL, *_83$$22 = NULL, *_84$$22 = NULL, _85$$23 = zval_used_for_init, *_86$$23 = NULL, *_88$$23 = NULL, *_89$$23 = NULL, *_90$$23 = NULL, *_96$$24 = NULL, *_97$$24, _98$$24, *_101$$25 = NULL, *_102$$25, _103$$25, *_105$$26 = NULL, *_106$$26, _107$$26, *_109$$27 = NULL, *_110$$27, _111$$27 = zval_used_for_init, _112$$27, *_113$$27 = NULL, *_115$$28 = NULL, *_116$$28, *_117$$28 = NULL, _118$$28, *_120$$29 = NULL, *_121$$29, _122$$29; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &variable, &name_param, &tab_param); if (!name_param) { ZEPHIR_INIT_VAR(name); ZVAL_EMPTY_STRING(name); } else { zephir_get_strval(name, name_param); } if (!tab_param) { tab = 1; } else { tab = zephir_get_intval(tab_param); } ZEPHIR_INIT_VAR(space); ZVAL_STRING(space, " ", 1); ZEPHIR_INIT_VAR(output); ZVAL_STRING(output, "", 1); if (!(!name) && Z_STRLEN_P(name)) { ZEPHIR_INIT_VAR(_0$$3); ZEPHIR_CONCAT_VS(_0$$3, name, " "); ZEPHIR_CPY_WRT(output, _0$$3); } if (Z_TYPE_P(variable) == IS_ARRAY) { ZEPHIR_INIT_VAR(_1$$4); zephir_create_array(_1$$4, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_3$$4); ZVAL_STRING(_3$$4, "arr", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "getstyle", &_4, 0, _3$$4); zephir_check_temp_parameter(_3$$4); zephir_check_call_status(); zephir_array_update_string(&_1$$4, SL(":style"), &_2$$4, PH_COPY | PH_SEPARATE); add_assoc_long_ex(_1$$4, SS(":count"), zephir_fast_count_int(variable TSRMLS_CC)); ZEPHIR_SINIT_VAR(_5$$4); ZVAL_STRING(&_5$$4, "<b style =':style'>Array</b> (<span style =':style'>:count</span>) (\n", 0); ZEPHIR_CALL_FUNCTION(&_2$$4, "strtr", &_6, 26, &_5$$4, _1$$4); zephir_check_call_status(); zephir_concat_self(&output, _2$$4 TSRMLS_CC); zephir_is_iterable(variable, &_8$$4, &_7$$4, 0, 0, "phalcon/debug/dump.zep", 156); for ( ; zephir_hash_get_current_data_ex(_8$$4, (void**) &_9$$4, &_7$$4) == SUCCESS ; zephir_hash_move_forward_ex(_8$$4, &_7$$4) ) { ZEPHIR_GET_HMKEY(key, _8$$4, _7$$4); ZEPHIR_GET_HVALUE(value, _9$$4); ZEPHIR_SINIT_NVAR(_10$$5); ZVAL_LONG(&_10$$5, tab); ZEPHIR_CALL_FUNCTION(&_11$$5, "str_repeat", &_12, 142, space, &_10$$5); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_13$$5); zephir_create_array(_13$$5, 2, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(_15$$5); ZVAL_STRING(_15$$5, "arr", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_14$$5, this_ptr, "getstyle", &_4, 0, _15$$5); zephir_check_temp_parameter(_15$$5); zephir_check_call_status(); zephir_array_update_string(&_13$$5, SL(":style"), &_14$$5, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_13$$5, SL(":key"), &key, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_NVAR(_10$$5); ZVAL_STRING(&_10$$5, "[<span style=':style'>:key</span>] => ", 0); ZEPHIR_CALL_FUNCTION(&_14$$5, "strtr", &_6, 26, &_10$$5, _13$$5); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_16$$5); ZEPHIR_CONCAT_VV(_16$$5, _11$$5, _14$$5); zephir_concat_self(&output, _16$$5 TSRMLS_CC); _17$$5 = tab == 1; if (_17$$5) { _17$$5 = !ZEPHIR_IS_STRING(name, ""); } _18$$5 = _17$$5; if (_18$$5) { _18$$5 = !(Z_TYPE_P(key) == IS_LONG); } _19$$5 = _18$$5; if (_19$$5) { _19$$5 = ZEPHIR_IS_EQUAL(name, key); } if (_19$$5) { continue; } else { ZEPHIR_INIT_NVAR(_21$$7); ZVAL_STRING(_21$$7, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_22$$7); ZVAL_LONG(_22$$7, (tab + 1)); ZEPHIR_CALL_METHOD(&_20$$7, this_ptr, "output", &_23, 175, value, _21$$7, _22$$7); zephir_check_temp_parameter(_21$$7); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_24$$7); ZEPHIR_CONCAT_VS(_24$$7, _20$$7, "\n"); zephir_concat_self(&output, _24$$7 TSRMLS_CC); } } ZEPHIR_SINIT_NVAR(_5$$4); ZVAL_LONG(&_5$$4, (tab - 1)); ZEPHIR_CALL_FUNCTION(&_25$$4, "str_repeat", &_12, 142, space, &_5$$4); zephir_check_call_status(); ZEPHIR_CONCAT_VVS(return_value, output, _25$$4, ")"); RETURN_MM(); } if (Z_TYPE_P(variable) == IS_OBJECT) { ZEPHIR_INIT_VAR(_26$$8); zephir_create_array(_26$$8, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_28$$8); ZVAL_STRING(_28$$8, "obj", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_27$$8, this_ptr, "getstyle", &_4, 0, _28$$8); zephir_check_temp_parameter(_28$$8); zephir_check_call_status(); zephir_array_update_string(&_26$$8, SL(":style"), &_27$$8, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_28$$8); zephir_get_class(_28$$8, variable, 0 TSRMLS_CC); zephir_array_update_string(&_26$$8, SL(":class"), &_28$$8, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_VAR(_29$$8); ZVAL_STRING(&_29$$8, "<b style=':style'>Object</b> :class", 0); ZEPHIR_CALL_FUNCTION(&_27$$8, "strtr", &_6, 26, &_29$$8, _26$$8); zephir_check_call_status(); zephir_concat_self(&output, _27$$8 TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_30$$8, "get_parent_class", &_31, 176, variable); zephir_check_call_status(); if (zephir_is_true(_30$$8)) { ZEPHIR_INIT_VAR(_32$$9); zephir_create_array(_32$$9, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_34$$9); ZVAL_STRING(_34$$9, "obj", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_33$$9, this_ptr, "getstyle", &_4, 0, _34$$9); zephir_check_temp_parameter(_34$$9); zephir_check_call_status(); zephir_array_update_string(&_32$$9, SL(":style"), &_33$$9, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_FUNCTION(&_33$$9, "get_parent_class", &_31, 176, variable); zephir_check_call_status(); zephir_array_update_string(&_32$$9, SL(":parent"), &_33$$9, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_VAR(_35$$9); ZVAL_STRING(&_35$$9, " <b style=':style'>extends</b> :parent", 0); ZEPHIR_CALL_FUNCTION(&_33$$9, "strtr", &_6, 26, &_35$$9, _32$$9); zephir_check_call_status(); zephir_concat_self(&output, _33$$9 TSRMLS_CC); } zephir_concat_self_str(&output, SL(" (\n") TSRMLS_CC); _36$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_detailed"), PH_NOISY_CC); if (zephir_instance_of_ev(variable, phalcon_di_ce TSRMLS_CC)) { ZEPHIR_SINIT_VAR(_37$$10); ZVAL_LONG(&_37$$10, tab); ZEPHIR_CALL_FUNCTION(&_38$$10, "str_repeat", &_12, 142, space, &_37$$10); zephir_check_call_status(); ZEPHIR_INIT_VAR(_39$$10); ZEPHIR_CONCAT_VS(_39$$10, _38$$10, "[skipped]\n"); zephir_concat_self(&output, _39$$10 TSRMLS_CC); } else if (!(zephir_is_true(_36$$8))) { ZEPHIR_CALL_FUNCTION(&_40$$11, "get_object_vars", NULL, 21, variable); zephir_check_call_status(); zephir_is_iterable(_40$$11, &_42$$11, &_41$$11, 0, 0, "phalcon/debug/dump.zep", 177); for ( ; zephir_hash_get_current_data_ex(_42$$11, (void**) &_43$$11, &_41$$11) == SUCCESS ; zephir_hash_move_forward_ex(_42$$11, &_41$$11) ) { ZEPHIR_GET_HMKEY(key, _42$$11, _41$$11); ZEPHIR_GET_HVALUE(value, _43$$11); ZEPHIR_SINIT_NVAR(_44$$12); ZVAL_LONG(&_44$$12, tab); ZEPHIR_CALL_FUNCTION(&_45$$12, "str_repeat", &_12, 142, space, &_44$$12); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_46$$12); zephir_create_array(_46$$12, 3, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(_48$$12); ZVAL_STRING(_48$$12, "obj", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_47$$12, this_ptr, "getstyle", &_4, 0, _48$$12); zephir_check_temp_parameter(_48$$12); zephir_check_call_status(); zephir_array_update_string(&_46$$12, SL(":style"), &_47$$12, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_46$$12, SL(":key"), &key, PH_COPY | PH_SEPARATE); add_assoc_stringl_ex(_46$$12, SS(":type"), SL("public"), 1); ZEPHIR_SINIT_NVAR(_44$$12); ZVAL_STRING(&_44$$12, "-><span style=':style'>:key</span> (<span style=':style'>:type</span>) = ", 0); ZEPHIR_CALL_FUNCTION(&_47$$12, "strtr", &_6, 26, &_44$$12, _46$$12); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_49$$12); ZEPHIR_CONCAT_VV(_49$$12, _45$$12, _47$$12); zephir_concat_self(&output, _49$$12 TSRMLS_CC); ZEPHIR_INIT_NVAR(_48$$12); ZVAL_STRING(_48$$12, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_51$$12); ZVAL_LONG(_51$$12, (tab + 1)); ZEPHIR_CALL_METHOD(&_50$$12, this_ptr, "output", &_23, 175, value, _48$$12, _51$$12); zephir_check_temp_parameter(_48$$12); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_52$$12); ZEPHIR_CONCAT_VS(_52$$12, _50$$12, "\n"); zephir_concat_self(&output, _52$$12 TSRMLS_CC); } } else { do { ZEPHIR_MAKE_REF(variable); ZEPHIR_CALL_FUNCTION(&attr, "each", &_53, 177, variable); ZEPHIR_UNREF(variable); zephir_check_call_status(); if (!(zephir_is_true(attr))) { continue; } ZEPHIR_OBS_NVAR(key); zephir_array_fetch_string(&key, attr, SL("key"), PH_NOISY, "phalcon/debug/dump.zep", 187 TSRMLS_CC); ZEPHIR_OBS_NVAR(value); zephir_array_fetch_string(&value, attr, SL("value"), PH_NOISY, "phalcon/debug/dump.zep", 188 TSRMLS_CC); if (!(zephir_is_true(key))) { continue; } ZEPHIR_INIT_NVAR(_54$$14); ZEPHIR_SINIT_NVAR(_55$$14); ZVAL_LONG(&_55$$14, 0); ZEPHIR_CALL_FUNCTION(&_56$$14, "chr", &_57, 141, &_55$$14); zephir_check_call_status(); zephir_fast_explode(_54$$14, _56$$14, key, LONG_MAX TSRMLS_CC); ZEPHIR_CPY_WRT(key, _54$$14); ZEPHIR_INIT_NVAR(type); ZVAL_STRING(type, "public", 1); if (zephir_array_isset_long(key, 1)) { ZEPHIR_INIT_NVAR(type); ZVAL_STRING(type, "private", 1); zephir_array_fetch_long(&_58$$17, key, 1, PH_NOISY | PH_READONLY, "phalcon/debug/dump.zep", 200 TSRMLS_CC); if (ZEPHIR_IS_STRING(_58$$17, "*")) { ZEPHIR_INIT_NVAR(type); ZVAL_STRING(type, "protected", 1); } } ZEPHIR_SINIT_NVAR(_55$$14); ZVAL_LONG(&_55$$14, tab); ZEPHIR_CALL_FUNCTION(&_59$$14, "str_repeat", &_12, 142, space, &_55$$14); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_60$$14); zephir_create_array(_60$$14, 3, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(_54$$14); ZVAL_STRING(_54$$14, "obj", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_61$$14, this_ptr, "getstyle", &_4, 0, _54$$14); zephir_check_temp_parameter(_54$$14); zephir_check_call_status(); zephir_array_update_string(&_60$$14, SL(":style"), &_61$$14, PH_COPY | PH_SEPARATE); ZEPHIR_MAKE_REF(key); ZEPHIR_CALL_FUNCTION(&_61$$14, "end", &_62, 178, key); ZEPHIR_UNREF(key); zephir_check_call_status(); zephir_array_update_string(&_60$$14, SL(":key"), &_61$$14, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_60$$14, SL(":type"), &type, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_NVAR(_55$$14); ZVAL_STRING(&_55$$14, "-><span style=':style'>:key</span> (<span style=':style'>:type</span>) = ", 0); ZEPHIR_CALL_FUNCTION(&_61$$14, "strtr", &_6, 26, &_55$$14, _60$$14); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_63$$14); ZEPHIR_CONCAT_VV(_63$$14, _59$$14, _61$$14); zephir_concat_self(&output, _63$$14 TSRMLS_CC); ZEPHIR_INIT_NVAR(_54$$14); ZVAL_STRING(_54$$14, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_65$$14); ZVAL_LONG(_65$$14, (tab + 1)); ZEPHIR_CALL_METHOD(&_64$$14, this_ptr, "output", &_23, 175, value, _54$$14, _65$$14); zephir_check_temp_parameter(_54$$14); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_66$$14); ZEPHIR_CONCAT_VS(_66$$14, _64$$14, "\n"); zephir_concat_self(&output, _66$$14 TSRMLS_CC); } while (zephir_is_true(attr)); } ZEPHIR_CALL_FUNCTION(&attr, "get_class_methods", NULL, 179, variable); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_29$$8); ZVAL_LONG(&_29$$8, tab); ZEPHIR_CALL_FUNCTION(&_67$$8, "str_repeat", &_12, 142, space, &_29$$8); zephir_check_call_status(); ZEPHIR_INIT_VAR(_68$$8); zephir_create_array(_68$$8, 3, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(_28$$8); ZVAL_STRING(_28$$8, "obj", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_69$$8, this_ptr, "getstyle", &_4, 0, _28$$8); zephir_check_temp_parameter(_28$$8); zephir_check_call_status(); zephir_array_update_string(&_68$$8, SL(":style"), &_69$$8, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_28$$8); zephir_get_class(_28$$8, variable, 0 TSRMLS_CC); zephir_array_update_string(&_68$$8, SL(":class"), &_28$$8, PH_COPY | PH_SEPARATE); add_assoc_long_ex(_68$$8, SS(":count"), zephir_fast_count_int(attr TSRMLS_CC)); ZEPHIR_SINIT_NVAR(_29$$8); ZVAL_STRING(&_29$$8, ":class <b style=':style'>methods</b>: (<span style=':style'>:count</span>) (\n", 0); ZEPHIR_CALL_FUNCTION(&_69$$8, "strtr", &_6, 26, &_29$$8, _68$$8); zephir_check_call_status(); ZEPHIR_INIT_VAR(_70$$8); ZEPHIR_CONCAT_VV(_70$$8, _67$$8, _69$$8); zephir_concat_self(&output, _70$$8 TSRMLS_CC); ZEPHIR_INIT_NVAR(_28$$8); zephir_get_class(_28$$8, variable, 0 TSRMLS_CC); _71$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_methods"), PH_NOISY_CC); if (zephir_fast_in_array(_28$$8, _71$$8 TSRMLS_CC)) { ZEPHIR_SINIT_VAR(_72$$19); ZVAL_LONG(&_72$$19, tab); ZEPHIR_CALL_FUNCTION(&_73$$19, "str_repeat", &_12, 142, space, &_72$$19); zephir_check_call_status(); ZEPHIR_INIT_VAR(_74$$19); ZEPHIR_CONCAT_VS(_74$$19, _73$$19, "[already listed]\n"); zephir_concat_self(&output, _74$$19 TSRMLS_CC); } else { zephir_is_iterable(attr, &_76$$20, &_75$$20, 0, 0, "phalcon/debug/dump.zep", 226); for ( ; zephir_hash_get_current_data_ex(_76$$20, (void**) &_77$$20, &_75$$20) == SUCCESS ; zephir_hash_move_forward_ex(_76$$20, &_75$$20) ) { ZEPHIR_GET_HVALUE(value, _77$$20); ZEPHIR_INIT_NVAR(_78$$21); zephir_get_class(_78$$21, variable, 0 TSRMLS_CC); zephir_update_property_array_append(this_ptr, SL("_methods"), _78$$21 TSRMLS_CC); if (ZEPHIR_IS_STRING(value, "__construct")) { ZEPHIR_SINIT_NVAR(_79$$22); ZVAL_LONG(&_79$$22, (tab + 1)); ZEPHIR_CALL_FUNCTION(&_80$$22, "str_repeat", &_12, 142, space, &_79$$22); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_81$$22); zephir_create_array(_81$$22, 2, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(_83$$22); ZVAL_STRING(_83$$22, "obj", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_82$$22, this_ptr, "getstyle", &_4, 0, _83$$22); zephir_check_temp_parameter(_83$$22); zephir_check_call_status(); zephir_array_update_string(&_81$$22, SL(":style"), &_82$$22, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_81$$22, SL(":method"), &value, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_NVAR(_79$$22); ZVAL_STRING(&_79$$22, "-><span style=':style'>:method</span>(); [<b style=':style'>constructor</b>]\n", 0); ZEPHIR_CALL_FUNCTION(&_82$$22, "strtr", &_6, 26, &_79$$22, _81$$22); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_84$$22); ZEPHIR_CONCAT_VV(_84$$22, _80$$22, _82$$22); zephir_concat_self(&output, _84$$22 TSRMLS_CC); } else { ZEPHIR_SINIT_NVAR(_85$$23); ZVAL_LONG(&_85$$23, (tab + 1)); ZEPHIR_CALL_FUNCTION(&_86$$23, "str_repeat", &_12, 142, space, &_85$$23); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_87$$23); zephir_create_array(_87$$23, 2, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(_89$$23); ZVAL_STRING(_89$$23, "obj", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_88$$23, this_ptr, "getstyle", &_4, 0, _89$$23); zephir_check_temp_parameter(_89$$23); zephir_check_call_status(); zephir_array_update_string(&_87$$23, SL(":style"), &_88$$23, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_87$$23, SL(":method"), &value, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_NVAR(_85$$23); ZVAL_STRING(&_85$$23, "-><span style=':style'>:method</span>();\n", 0); ZEPHIR_CALL_FUNCTION(&_88$$23, "strtr", &_6, 26, &_85$$23, _87$$23); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_90$$23); ZEPHIR_CONCAT_VV(_90$$23, _86$$23, _88$$23); zephir_concat_self(&output, _90$$23 TSRMLS_CC); } } ZEPHIR_SINIT_VAR(_91$$20); ZVAL_LONG(&_91$$20, tab); ZEPHIR_CALL_FUNCTION(&_92$$20, "str_repeat", &_12, 142, space, &_91$$20); zephir_check_call_status(); ZEPHIR_INIT_VAR(_93$$20); ZEPHIR_CONCAT_VS(_93$$20, _92$$20, ")\n"); zephir_concat_self(&output, _93$$20 TSRMLS_CC); } ZEPHIR_SINIT_NVAR(_29$$8); ZVAL_LONG(&_29$$8, (tab - 1)); ZEPHIR_CALL_FUNCTION(&_94$$8, "str_repeat", &_12, 142, space, &_29$$8); zephir_check_call_status(); ZEPHIR_CONCAT_VVS(return_value, output, _94$$8, ")"); RETURN_MM(); } if (Z_TYPE_P(variable) == IS_LONG) { ZEPHIR_INIT_VAR(_95$$24); zephir_create_array(_95$$24, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_97$$24); ZVAL_STRING(_97$$24, "int", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_96$$24, this_ptr, "getstyle", &_4, 0, _97$$24); zephir_check_temp_parameter(_97$$24); zephir_check_call_status(); zephir_array_update_string(&_95$$24, SL(":style"), &_96$$24, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_95$$24, SL(":var"), &variable, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_VAR(_98$$24); ZVAL_STRING(&_98$$24, "<b style=':style'>Integer</b> (<span style=':style'>:var</span>)", 0); ZEPHIR_CALL_FUNCTION(&_96$$24, "strtr", &_6, 26, &_98$$24, _95$$24); zephir_check_call_status(); ZEPHIR_CONCAT_VV(return_value, output, _96$$24); RETURN_MM(); } ZEPHIR_CALL_FUNCTION(&_99, "is_float", NULL, 180, variable); zephir_check_call_status(); if (zephir_is_true(_99)) { ZEPHIR_INIT_VAR(_100$$25); zephir_create_array(_100$$25, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_102$$25); ZVAL_STRING(_102$$25, "float", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_101$$25, this_ptr, "getstyle", &_4, 0, _102$$25); zephir_check_temp_parameter(_102$$25); zephir_check_call_status(); zephir_array_update_string(&_100$$25, SL(":style"), &_101$$25, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_100$$25, SL(":var"), &variable, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_VAR(_103$$25); ZVAL_STRING(&_103$$25, "<b style=':style'>Float</b> (<span style=':style'>:var</span>)", 0); ZEPHIR_CALL_FUNCTION(&_101$$25, "strtr", &_6, 26, &_103$$25, _100$$25); zephir_check_call_status(); ZEPHIR_CONCAT_VV(return_value, output, _101$$25); RETURN_MM(); } if (zephir_is_numeric(variable)) { ZEPHIR_INIT_VAR(_104$$26); zephir_create_array(_104$$26, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_106$$26); ZVAL_STRING(_106$$26, "num", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_105$$26, this_ptr, "getstyle", &_4, 0, _106$$26); zephir_check_temp_parameter(_106$$26); zephir_check_call_status(); zephir_array_update_string(&_104$$26, SL(":style"), &_105$$26, PH_COPY | PH_SEPARATE); add_assoc_long_ex(_104$$26, SS(":length"), zephir_fast_strlen_ev(variable)); zephir_array_update_string(&_104$$26, SL(":var"), &variable, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_VAR(_107$$26); ZVAL_STRING(&_107$$26, "<b style=':style'>Numeric string</b> (<span style=':style'>:length</span>) \"<span style=':style'>:var</span>\"", 0); ZEPHIR_CALL_FUNCTION(&_105$$26, "strtr", &_6, 26, &_107$$26, _104$$26); zephir_check_call_status(); ZEPHIR_CONCAT_VV(return_value, output, _105$$26); RETURN_MM(); } if (Z_TYPE_P(variable) == IS_STRING) { ZEPHIR_INIT_VAR(_108$$27); zephir_create_array(_108$$27, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_110$$27); ZVAL_STRING(_110$$27, "str", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_109$$27, this_ptr, "getstyle", &_4, 0, _110$$27); zephir_check_temp_parameter(_110$$27); zephir_check_call_status(); zephir_array_update_string(&_108$$27, SL(":style"), &_109$$27, PH_COPY | PH_SEPARATE); add_assoc_long_ex(_108$$27, SS(":length"), zephir_fast_strlen_ev(variable)); ZEPHIR_SINIT_VAR(_111$$27); ZVAL_LONG(&_111$$27, 4); ZEPHIR_SINIT_VAR(_112$$27); ZVAL_STRING(&_112$$27, "utf-8", 0); ZEPHIR_CALL_FUNCTION(&_109$$27, "htmlentities", NULL, 161, variable, &_111$$27, &_112$$27); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_113$$27, "nl2br", NULL, 181, _109$$27); zephir_check_call_status(); zephir_array_update_string(&_108$$27, SL(":var"), &_113$$27, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_NVAR(_111$$27); ZVAL_STRING(&_111$$27, "<b style=':style'>String</b> (<span style=':style'>:length</span>) \"<span style=':style'>:var</span>\"", 0); ZEPHIR_CALL_FUNCTION(&_113$$27, "strtr", &_6, 26, &_111$$27, _108$$27); zephir_check_call_status(); ZEPHIR_CONCAT_VV(return_value, output, _113$$27); RETURN_MM(); } if (Z_TYPE_P(variable) == IS_BOOL) { ZEPHIR_INIT_VAR(_114$$28); zephir_create_array(_114$$28, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_116$$28); ZVAL_STRING(_116$$28, "bool", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_115$$28, this_ptr, "getstyle", &_4, 0, _116$$28); zephir_check_temp_parameter(_116$$28); zephir_check_call_status(); zephir_array_update_string(&_114$$28, SL(":style"), &_115$$28, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_117$$28); if (zephir_is_true(variable)) { ZEPHIR_INIT_NVAR(_117$$28); ZVAL_STRING(_117$$28, "TRUE", 1); } else { ZEPHIR_INIT_NVAR(_117$$28); ZVAL_STRING(_117$$28, "FALSE", 1); } zephir_array_update_string(&_114$$28, SL(":var"), &_117$$28, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_VAR(_118$$28); ZVAL_STRING(&_118$$28, "<b style=':style'>Boolean</b> (<span style=':style'>:var</span>)", 0); ZEPHIR_CALL_FUNCTION(&_115$$28, "strtr", &_6, 26, &_118$$28, _114$$28); zephir_check_call_status(); ZEPHIR_CONCAT_VV(return_value, output, _115$$28); RETURN_MM(); } if (Z_TYPE_P(variable) == IS_NULL) { ZEPHIR_INIT_VAR(_119$$29); zephir_create_array(_119$$29, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_121$$29); ZVAL_STRING(_121$$29, "null", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_120$$29, this_ptr, "getstyle", &_4, 0, _121$$29); zephir_check_temp_parameter(_121$$29); zephir_check_call_status(); zephir_array_update_string(&_119$$29, SL(":style"), &_120$$29, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_VAR(_122$$29); ZVAL_STRING(&_122$$29, "<b style=':style'>NULL</b>", 0); ZEPHIR_CALL_FUNCTION(&_120$$29, "strtr", &_6, 26, &_122$$29, _119$$29); zephir_check_call_status(); ZEPHIR_CONCAT_VV(return_value, output, _120$$29); RETURN_MM(); } ZEPHIR_INIT_VAR(_123); zephir_create_array(_123, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_125); ZVAL_STRING(_125, "other", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_124, this_ptr, "getstyle", &_4, 0, _125); zephir_check_temp_parameter(_125); zephir_check_call_status(); zephir_array_update_string(&_123, SL(":style"), &_124, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_123, SL(":var"), &variable, PH_COPY | PH_SEPARATE); ZEPHIR_SINIT_VAR(_126); ZVAL_STRING(&_126, "(<span style=':style'>:var</span>)", 0); ZEPHIR_CALL_FUNCTION(&_124, "strtr", &_6, 26, &_126, _123); zephir_check_call_status(); ZEPHIR_CONCAT_VV(return_value, output, _124); RETURN_MM(); }
/** * Returns current row in the resultset */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) { zend_class_entry *_5$$6; zval *row = NULL, *hydrateMode = NULL, *columnMap = NULL, *activeRow = NULL, *modelName = NULL, *_0$$6, *_2$$6, *_3$$6, *_4$$6, *_1$$7, *_7$$9, *_8$$9, *_9$$9; zephir_fcall_cache_entry *_6 = NULL, *_10 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(activeRow); zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC); if (Z_TYPE_P(activeRow) != IS_NULL) { RETURN_CCTOR(activeRow); } ZEPHIR_OBS_VAR(row); zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC); if (Z_TYPE_P(row) != IS_ARRAY) { if (0) { zephir_update_property_this(getThis(), SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(getThis(), SL("_activeRow"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } RETURN_MM_BOOL(0); } ZEPHIR_OBS_VAR(hydrateMode); zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); ZEPHIR_OBS_VAR(columnMap); zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); do { if (ZEPHIR_IS_LONG(hydrateMode, 0)) { if (ZEPHIR_GLOBAL(orm).late_state_binding) { ZEPHIR_OBS_VAR(_0$$6); zephir_read_property_this(&_0$$6, this_ptr, SL("_model"), PH_NOISY_CC); if (zephir_instance_of_ev(_0$$6, phalcon_mvc_model_ce TSRMLS_CC)) { _1$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); ZEPHIR_INIT_VAR(modelName); zephir_get_class(modelName, _1$$7, 0 TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(modelName); ZVAL_STRING(modelName, "Phalcon\\Mvc\\Model", 1); } _2$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); _3$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_4$$6); ZVAL_LONG(_4$$6, 0); _5$$6 = zephir_fetch_class(modelName TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&activeRow, _5$$6, "cloneresultmap", NULL, 0, _2$$6, row, columnMap, _4$$6, _3$$6); zephir_check_call_status(); } else { _7$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC); _8$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_9$$9); ZVAL_LONG(_9$$9, 0); ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_6, 384, _7$$9, row, columnMap, _9$$9, _8$$9); zephir_check_call_status(); } break; } ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_10, 385, row, columnMap, hydrateMode); zephir_check_call_status(); break; } while(0); zephir_update_property_this(getThis(), SL("_activeRow"), activeRow TSRMLS_CC); RETURN_CCTOR(activeRow); }
/** * @param \Ouchbase\Entity entity * @param bool concurrent If entity may have concurrent updates * @throws \Ouchbase\Exception\EntityLogicException * @return this */ PHP_METHOD(Ouchbase_Repository, refresh) { zephir_fcall_cache_entry *_12 = NULL, *_14 = NULL, *_15 = NULL; HashTable *_9; HashPosition _8; zval *_4; int ZEPHIR_LAST_CALL_STATUS; zend_bool concurrent; zval *entity = NULL, *concurrent_param = NULL, *_0, *_1 = NULL, *_2, *_3 = NULL, *cas, *data = NULL, *dataWithCas = NULL, *_5 = NULL, *refreshed = NULL, *_6, *property = NULL, *propertyReflection = NULL, *_7 = NULL, **_10, *_11 = NULL, *_13 = NULL, *_16; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &entity, &concurrent_param); ZEPHIR_SEPARATE_PARAM(entity); if (!concurrent_param) { concurrent = 0; } else { concurrent = zephir_get_boolval(concurrent_param); } if (!(zephir_instance_of_ev(entity, ouchbase_entity_ce TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'entity' must be an instance of 'Ouchbase\\Entity'", "", 0); return; } _0 = zephir_fetch_nproperty_this(this_ptr, SL("im"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_1, _0, "contains", NULL, entity); zephir_check_call_status(); if (!(zephir_is_true(_1))) { ZEPHIR_INIT_VAR(_2); object_init_ex(_2, ouchbase_exception_entitylogicexception_ce); ZEPHIR_INIT_VAR(_3); ZVAL_STRING(_3, "was not persisted", 0); ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, entity, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); zephir_throw_exception_debug(_2, "ouchbase/Repository.zep", 97 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (zephir_instance_of_ev(entity, ouchbase_entityproxy_ce TSRMLS_CC)) { ZEPHIR_CALL_METHOD(&entity, entity, "_getobject", NULL); zephir_check_call_status(); } ZEPHIR_INIT_VAR(_4); array_init_size(_4, 2); ZEPHIR_CALL_METHOD(&_5, entity, "getid", NULL); zephir_check_call_status(); zephir_array_fast_append(_4, _5); ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "__getWithCas", 0); ZEPHIR_CALL_METHOD(&dataWithCas, this_ptr, "executewithouttimeouts", NULL, _3, _4); zephir_check_temp_parameter(_3); zephir_check_call_status(); ZEPHIR_OBS_VAR(data); zephir_array_fetch_string(&data, dataWithCas, SL("data"), PH_NOISY TSRMLS_CC); ZEPHIR_OBS_VAR(cas); zephir_array_fetch_string(&cas, dataWithCas, SL("cas"), PH_NOISY TSRMLS_CC); if (!(zephir_is_true(data))) { RETURN_THIS(); } if (!(Z_TYPE_P(data) == IS_ARRAY)) { ZEPHIR_INIT_NVAR(_3); zephir_json_decode(_3, &(_3), data, zephir_get_intval(ZEPHIR_GLOBAL(global_true)) TSRMLS_CC); ZEPHIR_CPY_WRT(data, _3); } ZEPHIR_CALL_METHOD(&refreshed, this_ptr, "toobject", NULL, data); zephir_check_call_status(); _6 = zephir_fetch_nproperty_this(this_ptr, SL("im"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, _6, "updateoriginaldata", NULL, entity, data); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_5, this_ptr, "getclassreflection", NULL); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7, _5, "getproperties", NULL); zephir_check_call_status(); zephir_is_iterable(_7, &_9, &_8, 0, 0); for ( ; zephir_hash_get_current_data_ex(_9, (void**) &_10, &_8) == SUCCESS ; zephir_hash_move_forward_ex(_9, &_8) ) { ZEPHIR_GET_HVALUE(property, _10); ZEPHIR_CALL_METHOD(&_11, property, "getname", NULL); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&propertyReflection, this_ptr, "getpropertyreflection", &_12, _11); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_13, propertyReflection, "getvalue", &_14, refreshed); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, propertyReflection, "setvalue", &_15, entity, _13); zephir_check_call_status(); } if (concurrent) { _16 = zephir_fetch_nproperty_this(this_ptr, SL("uow"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, _16, "persist", NULL, entity, cas); zephir_check_call_status(); } RETURN_THIS(); }
PHP_METHOD(Xs_FieldMeta, getCustomTokenizer) { zend_class_entry *_15, *_17; int ZEPHIR_LAST_CALL_STATUS; zval *name = NULL, *arg = NULL, *_7 = NULL, *_9 = NULL, *_11 = NULL; zval *tokenizer = NULL, *m = NULL, *_0, *_1, *_2, *_3, _4, *_5 = NULL, *_6, *_8 = NULL, *_10, *_12 = NULL, *_13 = NULL, *_14 = NULL, *_16 = NULL; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(m); ZVAL_NULL(m); ZEPHIR_OBS_VAR(tokenizer); _0 = zephir_fetch_static_property_ce(xs_fieldmeta_ce, SL("tokenizers") TSRMLS_CC); _1 = zephir_fetch_nproperty_this(this_ptr, SL("tokenizer"), PH_NOISY_CC); if (zephir_array_isset_fetch(&tokenizer, _0, _1, 0 TSRMLS_CC)) { RETURN_CCTOR(tokenizer); } ZEPHIR_INIT_VAR(_2); _3 = zephir_fetch_nproperty_this(this_ptr, SL("tokenizer"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_4); ZVAL_STRING(&_4, "/^([^\\(]+)\\((.*)\\)$/", 0); zephir_preg_match(_2, &_4, _3, m, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_2)) { ZEPHIR_INIT_VAR(_5); zephir_array_fetch_long(&_6, m, 1, PH_NOISY | PH_READONLY, "xs/fieldmeta.zep", 125 TSRMLS_CC); zephir_ucfirst(_5, _6); zephir_get_strval(_7, _5); ZEPHIR_INIT_VAR(name); ZEPHIR_CONCAT_SSV(name, "Xs", "\\Tokenizer", _7); ZEPHIR_OBS_VAR(_8); zephir_array_fetch_long(&_8, m, 2, PH_NOISY, "xs/fieldmeta.zep", 126 TSRMLS_CC); zephir_get_strval(_9, _8); ZEPHIR_CPY_WRT(arg, _9); } else { ZEPHIR_INIT_NVAR(_5); _10 = zephir_fetch_nproperty_this(this_ptr, SL("tokenizer"), PH_NOISY_CC); zephir_ucfirst(_5, _10); zephir_get_strval(_11, _5); ZEPHIR_INIT_NVAR(name); ZEPHIR_CONCAT_SSV(name, "Xs", "\\Tokenizer", _11); ZEPHIR_INIT_NVAR(arg); ZVAL_EMPTY_STRING(arg); } if (unlikely(!(zephir_class_exists(name, zephir_is_true(ZEPHIR_GLOBAL(global_true)) TSRMLS_CC)))) { ZEPHIR_INIT_NVAR(_5); object_init_ex(_5, xs_exception_ce); _10 = zephir_fetch_nproperty_this(this_ptr, SL("name"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_12); ZEPHIR_CONCAT_SVSVS(_12, "Undefined custom tokenizer ", name, " for field `", _10, "`"); ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 4, _12); zephir_check_call_status(); zephir_throw_exception_debug(_5, "xs/fieldmeta.zep", 133 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_NVAR(tokenizer); if (zephir_fast_strlen_ev(arg) > 0) { zephir_fetch_safe_class(_14, name); _15 = zend_fetch_class(Z_STRVAL_P(_14), Z_STRLEN_P(_14), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(tokenizer, _15); if (zephir_has_constructor(tokenizer TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, tokenizer, "__construct", NULL, 0, arg); zephir_check_call_status(); } } else { zephir_fetch_safe_class(_16, name); _17 = zend_fetch_class(Z_STRVAL_P(_16), Z_STRLEN_P(_16), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(tokenizer, _17); if (zephir_has_constructor(tokenizer TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, tokenizer, "__construct", NULL, 0); zephir_check_call_status(); } } if (unlikely(!((zephir_instance_of_ev(tokenizer, xs_tokenizer_ce TSRMLS_CC))))) { ZEPHIR_INIT_NVAR(_5); object_init_ex(_5, xs_exception_ce); _10 = zephir_fetch_nproperty_this(this_ptr, SL("name"), PH_NOISY_CC); ZEPHIR_INIT_LNVAR(_12); ZEPHIR_CONCAT_VSVS(_12, name, " for field `", _10, "` does not implement Tokenizer interface"); ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 4, _12); zephir_check_call_status(); zephir_throw_exception_debug(_5, "xs/fieldmeta.zep", 143 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_OBS_NVAR(_8); zephir_read_property_this(&_8, this_ptr, SL("tokenizer"), PH_NOISY_CC); zephir_update_static_property_array_multi_ce(xs_fieldmeta_ce, SL("tokenizers"), &tokenizer TSRMLS_CC, SL("z"), 1, _8); RETURN_CCTOR(tokenizer); }
PHP_METHOD(PhalconPlus_Db_Mysql, getConnection) { zval __$true, __$false, tryTimes, e, _0, _1$$4, _2$$4, _4$$3, _5$$5, _6$$5, _7$$5, _9$$5, _12$$6, _14$$6, _15$$6, _16$$6, _17$$6, _18$$7, _19$$7, _20$$7; zephir_fcall_cache_entry *_3 = NULL, *_8 = NULL, *_10 = NULL, *_13 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS, _11$$5; zval *this_ptr = getThis(); ZVAL_BOOL(&__$true, 1); ZVAL_BOOL(&__$false, 0); ZVAL_UNDEF(&tryTimes); ZVAL_UNDEF(&e); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$4); ZVAL_UNDEF(&_4$$3); ZVAL_UNDEF(&_5$$5); ZVAL_UNDEF(&_6$$5); ZVAL_UNDEF(&_7$$5); ZVAL_UNDEF(&_9$$5); ZVAL_UNDEF(&_12$$6); ZVAL_UNDEF(&_14$$6); ZVAL_UNDEF(&_15$$6); ZVAL_UNDEF(&_16$$6); ZVAL_UNDEF(&_17$$6); ZVAL_UNDEF(&_18$$7); ZVAL_UNDEF(&_19$$7); ZVAL_UNDEF(&_20$$7); ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(&tryTimes); zephir_read_property(&tryTimes, this_ptr, SL("retryTimes"), PH_NOISY_CC); while (1) { zephir_read_property(&_0, this_ptr, SL("connected"), PH_NOISY_CC | PH_READONLY); if (!(!(zephir_is_true(&_0)))) { break; } /* try_start_1: */ ZEPHIR_INIT_NVAR(&_1$$4); object_init_ex(&_1$$4, zephir_get_internal_ce(SL("phalcon\\db\\adapter\\pdo\\mysql"))); zephir_read_property(&_2$$4, this_ptr, SL("descriptor"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(NULL, &_1$$4, "__construct", &_3, 0, &_2$$4); zephir_check_call_status_or_jump(try_end_1); zephir_update_property_zval(this_ptr, SL("connection"), &_1$$4); if (1) { zephir_update_property_zval(this_ptr, SL("connected"), &__$true); } else { zephir_update_property_zval(this_ptr, SL("connected"), &__$false); } try_end_1: if (EG(exception)) { ZEPHIR_INIT_NVAR(&_4$$3); ZVAL_OBJ(&_4$$3, EG(exception)); Z_ADDREF_P(&_4$$3); if (zephir_instance_of_ev(&_4$$3, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CPY_WRT(&e, &_4$$3); ZEPHIR_INIT_NVAR(&_5$$5); zephir_read_property(&_6$$5, this_ptr, SL("descriptor"), PH_NOISY_CC | PH_READONLY); zephir_json_encode(&_5$$5, &_6$$5, 0 ); ZEPHIR_CALL_FUNCTION(&_7$$5, "strval", &_8, 27, &tryTimes); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_9$$5); ZEPHIR_CONCAT_SVSVS(&_9$$5, "PHP Fatal error: PhalconPlus::Db::MySQL::connect() failed to connect to MySQL. Detail: ", &_5$$5, ". We will try ", &_7$$5, " times for you."); ZEPHIR_CALL_FUNCTION(NULL, "error_log", &_10, 50, &_9$$5); zephir_check_call_status(); _11$$5 = (zephir_get_numberval(&tryTimes) - 1); ZEPHIR_INIT_NVAR(&tryTimes); ZVAL_LONG(&tryTimes, _11$$5); if (ZEPHIR_GT_LONG(&tryTimes, 0)) { zephir_read_property(&_12$$6, this_ptr, SL("retryInterval"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_FUNCTION(NULL, "usleep", &_13, 57, &_12$$6); zephir_check_call_status(); zephir_read_property(&_14$$6, this_ptr, SL("retryTimes"), PH_NOISY_CC | PH_READONLY); ZEPHIR_SINIT_NVAR(_15$$6); zephir_sub_function(&_15$$6, &_14$$6, &tryTimes); ZEPHIR_CALL_FUNCTION(&_16$$6, "strval", &_8, 27, &_15$$6); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_17$$6); ZEPHIR_CONCAT_SVS(&_17$$6, "PHP Notice: PhalconPlus::Db::MySQL::connnect() retry to connect to MySQL for the ", &_16$$6, " time ... "); ZEPHIR_CALL_FUNCTION(NULL, "error_log", &_10, 50, &_17$$6); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(&_18$$7); zephir_read_property(&_19$$7, this_ptr, SL("descriptor"), PH_NOISY_CC | PH_READONLY); zephir_json_encode(&_18$$7, &_19$$7, 0 ); ZEPHIR_INIT_LNVAR(_20$$7); ZEPHIR_CONCAT_SV(&_20$$7, "PHP Fatal error: PhalconPlus::Db::MySQL::connect() finally failed to connect to MySQL. Detail: ", &_18$$7); ZEPHIR_CALL_FUNCTION(NULL, "error_log", &_10, 50, &_20$$7); zephir_check_call_status(); zephir_throw_exception_debug(&e, "phalconplus/Db/Mysql.zep", 77 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } } RETURN_MM_MEMBER(getThis(), "connection"); }