PHP_METHOD(Test_Flow, testWhileDoNextTest) { int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_2 = NULL; zval *variable, *returnValue, *_0 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &variable); ZEPHIR_INIT_VAR(returnValue); array_init(returnValue); do { Z_SET_ISREF_P(variable); ZEPHIR_CALL_FUNCTION(&_0, "current", &_1, variable); Z_UNSET_ISREF_P(variable); zephir_check_call_status(); zephir_array_append(&returnValue, _0, PH_SEPARATE, "test/flow.zep", 430); Z_SET_ISREF_P(variable); ZEPHIR_CALL_FUNCTION(&_0, "next", &_2, variable); Z_UNSET_ISREF_P(variable); zephir_check_call_status(); } while (zephir_is_true(_0)); RETURN_CCTOR(returnValue); }
PHP_METHOD(Test_Flow, testWhileDoNextTest) { zval *variable, *returnValue, *_0 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &variable); ZEPHIR_INIT_VAR(returnValue); array_init(returnValue); do { Z_SET_ISREF_P(variable); ZEPHIR_INIT_NVAR(_0); zephir_call_func_p1(_0, "current", variable); Z_UNSET_ISREF_P(variable); zephir_array_append(&returnValue, _0, PH_SEPARATE); Z_SET_ISREF_P(variable); ZEPHIR_INIT_NVAR(_0); zephir_call_func_p1(_0, "next", variable); Z_UNSET_ISREF_P(variable); } while (zephir_is_true(_0)); RETURN_CCTOR(returnValue); }
/** * Check whether internal resource has rows to fetch * * @return boolean */ PHP_METHOD(Phalcon_Model_Resultset, valid){ zval *result = NULL, *row = NULL, *rows = NULL; zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL; zval *c0 = NULL, *c1 = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL; PHALCON_MM_GROW(); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, "_type", sizeof("_type")-1, PHALCON_NOISY TSRMLS_CC); if (zend_is_true(t0)) { PHALCON_ALLOC_ZVAL_MM(t1); phalcon_read_property(&t1, this_ptr, "_result", sizeof("_result")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(result, t1); if (Z_TYPE_P(result) != IS_BOOL || (Z_TYPE_P(result) == IS_BOOL && Z_BVAL_P(result))) { PHALCON_INIT_VAR(c0); ZVAL_LONG(c0, 1); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "setfetchmode", c0, PHALCON_NO_CHECK); PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CALL_METHOD_PARAMS_1(r0, result, "fetcharray", result, PHALCON_NO_CHECK); PHALCON_CPY_WRT(row, r0); if (zend_is_true(row)) { PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_ALLOC_ZVAL_MM(t2); phalcon_read_property(&t2, this_ptr, "_model", sizeof("_model")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CALL_STATIC_PARAMS_2(r1, "phalcon_model_base", "dumpresult", t2, row); phalcon_update_property_zval(this_ptr, "_activeRow", strlen("_activeRow"), r1 TSRMLS_CC); PHALCON_MM_RESTORE(); RETURN_TRUE; } else { PHALCON_INIT_VAR(c1); ZVAL_LONG(c1, 2); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "setfetchmode", c1, PHALCON_NO_CHECK); } } } else { PHALCON_ALLOC_ZVAL_MM(t3); phalcon_read_property(&t3, this_ptr, "_rows", sizeof("_rows")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(rows, t3); PHALCON_ALLOC_ZVAL_MM(r2); Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1(r2, "current", rows, 0x054); Z_UNSET_ISREF_P(rows); PHALCON_CPY_WRT(row, r2); if (zend_is_true(row)) { Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("next", rows, 0x059); Z_UNSET_ISREF_P(rows); phalcon_update_property_zval(this_ptr, "_activeRow", strlen("_activeRow"), row TSRMLS_CC); PHALCON_MM_RESTORE(); RETURN_TRUE; } } PHALCON_MM_RESTORE(); RETURN_FALSE; }
/** * Changes internal pointer to a specific position in the resultset */ PHP_METHOD(Phalcon_Model_Resultset, seek){ zval *position = NULL, *rows = NULL, *i = NULL; zval *r0 = NULL, *r1 = NULL; zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &position) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CALL_FUNC_PARAMS_1(r0, "intval", position, 0x020); phalcon_update_property_zval(this_ptr, "_pointer", strlen("_pointer"), r0 TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, "_type", sizeof("_type")-1, PHALCON_NOISY TSRMLS_CC); if (zend_is_true(t0)) { PHALCON_ALLOC_ZVAL_MM(t1); phalcon_read_property(&t1, this_ptr, "_connection", sizeof("_connection")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(t2); phalcon_read_property(&t2, this_ptr, "_resultResource", sizeof("_resultResource")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CALL_METHOD_PARAMS_2_NORETURN(t1, "dataseek", position, t2, PHALCON_NO_CHECK); } else { PHALCON_ALLOC_ZVAL_MM(t3); phalcon_read_property(&t3, this_ptr, "_rows", sizeof("_rows")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(rows, t3); Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("reset", rows, 0x055); Z_UNSET_ISREF_P(rows); PHALCON_INIT_VAR(i); ZVAL_LONG(i, 0); fs_fd08_0: PHALCON_INIT_VAR(r1); is_smaller_function(r1, i, position TSRMLS_CC); if (!zend_is_true(r1)) { goto fe_fd08_0; } Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("next", rows, 0x059); Z_UNSET_ISREF_P(rows); PHALCON_SEPARATE(i); increment_function(i); goto fs_fd08_0; fe_fd08_0: if(0){} } PHALCON_MM_RESTORE(); }
/** * Changes internal pointer to a specific position in the resultset * * @param int $position */ PHP_METHOD(Phalcon_Mvc_Model_Resultset, seek){ zval *position = NULL, *int_position = NULL, *type = NULL, *result = NULL, *rows = NULL; zval *i = NULL; zval *r0 = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &position) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_INIT_VAR(int_position); PHALCON_CALL_FUNC_PARAMS_1(int_position, "intval", position); phalcon_update_property_zval(this_ptr, SL("_pointer"), int_position TSRMLS_CC); PHALCON_INIT_VAR(type); phalcon_read_property(&type, this_ptr, SL("_type"), PH_NOISY_CC); if (zend_is_true(type)) { PHALCON_INIT_VAR(result); phalcon_read_property(&result, this_ptr, SL("_result"), PH_NOISY_CC); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "dataseek", position, PH_NO_CHECK); } else { PHALCON_INIT_VAR(rows); phalcon_read_property(&rows, this_ptr, SL("_rows"), PH_NOISY_CC); Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("reset", rows); Z_UNSET_ISREF_P(rows); PHALCON_INIT_VAR(i); ZVAL_LONG(i, 0); fs_ebc1_0: PHALCON_INIT_VAR(r0); is_smaller_function(r0, i, position TSRMLS_CC); if (!zend_is_true(r0)) { goto fe_ebc1_0; } Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("next", rows); Z_UNSET_ISREF_P(rows); PHALCON_SEPARATE(i); increment_function(i); goto fs_ebc1_0; fe_ebc1_0: if(0){} } PHALCON_MM_RESTORE(); }
static zend_always_inline void zend_pzval_unlock_func(zval *z, zend_free_op *should_free, int unref TSRMLS_DC) { if (!Z_DELREF_P(z)) { Z_SET_REFCOUNT_P(z, 1); Z_UNSET_ISREF_P(z); should_free->var = z; /* should_free->is_var = 1; */ } else { should_free->var = 0; if (unref && Z_ISREF_P(z) && Z_REFCOUNT_P(z) == 1) { Z_UNSET_ISREF_P(z); } GC_ZVAL_CHECK_POSSIBLE_ROOT(z); } }
/** * Defined by Iterator interface * * @return boolean */ PHP_METHOD(Yaf_Session, valid) { zend_bool _3; int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_1 = NULL; zval *key = NULL, *_0, *_2; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("session"), PH_NOISY_CC); Z_SET_ISREF_P(_0); ZEPHIR_CALL_FUNCTION(&key, "key", &_1, _0); Z_UNSET_ISREF_P(_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_2); _3 = Z_TYPE_P(key) == IS_NULL; if (!(_3)) { _3 = ZEPHIR_IS_FALSE(key); } if (_3) { ZVAL_BOOL(_2, 0); } else { ZVAL_BOOL(_2, 1); } RETURN_CCTOR(_2); }
static zval *com_property_read(zval *object, zval *member, int type TSRMLS_DC) { zval *return_value; php_com_dotnet_object *obj; VARIANT v; HRESULT res; MAKE_STD_ZVAL(return_value); ZVAL_NULL(return_value); Z_SET_REFCOUNT_P(return_value, 0); Z_UNSET_ISREF_P(return_value); obj = CDNO_FETCH(object); if (V_VT(&obj->v) == VT_DISPATCH) { VariantInit(&v); convert_to_string_ex(&member); res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1 TSRMLS_CC); if (res == SUCCESS) { php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC); VariantClear(&v); } else if (res == DISP_E_BADPARAMCOUNT) { php_com_saproxy_create(object, return_value, member TSRMLS_CC); } } else { php_com_throw_exception(E_INVALIDARG, "this variant has no properties" TSRMLS_CC); } return return_value; }
/** * Rewinds resultset to its beginning * */ PHP_METHOD(Phalcon_Mvc_Model_Resultset, rewind){ zval *type = NULL, *result = NULL, *rows = NULL; zval *c0 = NULL; PHALCON_MM_GROW(); PHALCON_INIT_VAR(type); phalcon_read_property(&type, this_ptr, SL("_type"), PH_NOISY_CC); if (zend_is_true(type)) { PHALCON_INIT_VAR(result); phalcon_read_property(&result, this_ptr, SL("_result"), PH_NOISY_CC); if (Z_TYPE_P(result) != IS_BOOL || (Z_TYPE_P(result) == IS_BOOL && Z_BVAL_P(result))) { phalcon_update_property_long(this_ptr, SL("_pointer"), 1 TSRMLS_CC); PHALCON_INIT_VAR(c0); ZVAL_LONG(c0, 0); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "dataseek", c0, PH_NO_CHECK); } } else { PHALCON_INIT_VAR(rows); phalcon_read_property(&rows, this_ptr, SL("_rows"), PH_NOISY_CC); Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("reset", rows); Z_UNSET_ISREF_P(rows); } PHALCON_MM_RESTORE(); }
PHP_METHOD(Test_Pregmatch, testPregMatchFallback) { int ZEPHIR_LAST_CALL_STATUS; zval *pattern, *subject, *matches = NULL, *_0, *_1; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(matches); ZVAL_NULL(matches); ZEPHIR_INIT_NVAR(matches); array_init(matches); ZEPHIR_INIT_VAR(pattern); ZVAL_STRING(pattern, "/def$/", 1); ZEPHIR_INIT_VAR(subject); ZVAL_STRING(subject, "abcdef", 1); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 0); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 0); Z_SET_ISREF_P(matches); ZEPHIR_RETURN_CALL_FUNCTION("preg_match", NULL, 49, pattern, subject, matches, _0, _1); Z_UNSET_ISREF_P(matches); zephir_check_call_status(); RETURN_MM(); }
/** * Rewinds resultset to its beginning * */ PHP_METHOD(Phalcon_Model_Resultset, rewind){ zval *result = NULL; zval *t0 = NULL, *t1 = NULL, *t2 = NULL; zval *c0 = NULL; PHALCON_MM_GROW(); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, "_type", sizeof("_type")-1, PHALCON_NOISY TSRMLS_CC); if (zend_is_true(t0)) { PHALCON_ALLOC_ZVAL_MM(t1); phalcon_read_property(&t1, this_ptr, "_result", sizeof("_result")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(result, t1); if (Z_TYPE_P(result) != IS_BOOL || (Z_TYPE_P(result) == IS_BOOL && Z_BVAL_P(result))) { phalcon_update_property_long(this_ptr, "pointer", strlen("pointer"), 1 TSRMLS_CC); PHALCON_INIT_VAR(c0); ZVAL_LONG(c0, 0); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "dataseek", c0, PHALCON_NO_CHECK); } } else { PHALCON_ALLOC_ZVAL_MM(t2); phalcon_read_property(&t2, this_ptr, "_rows", sizeof("_rows")-1, PHALCON_NOISY TSRMLS_CC); Z_SET_ISREF_P(t2); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("reset", t2, 0x055); Z_UNSET_ISREF_P(t2); } PHALCON_MM_RESTORE(); }
void phalcon_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy){ zend_make_printable_zval(expr, expr_copy, use_copy); if (use_copy) { Z_SET_REFCOUNT_P(expr_copy, 1); Z_UNSET_ISREF_P(expr_copy); } }
/** * Render view */ PHP_METHOD(Owl_Mvc_View, render) { int ZEPHIR_LAST_CALL_STATUS; zval *parameters = NULL; zval *path_param = NULL, *parameters_param = NULL, *_0, *_1, *_2, *_3, *_4, *tmp = NULL; zval *path = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &path_param, ¶meters_param); if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(path_param) == IS_STRING)) { zephir_get_strval(path, path_param); } else { ZEPHIR_INIT_VAR(path); ZVAL_EMPTY_STRING(path); } if (!parameters_param) { ZEPHIR_INIT_VAR(parameters); array_init(parameters); } else { zephir_get_arrval(parameters, parameters_param); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("path"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_VV(_1, _0, path); if (!((zephir_file_exists(_1 TSRMLS_CC) == SUCCESS))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(owl_exception_ce, "File is not exists", "owl/Mvc/View.zep", 21); return; } ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 23); zephir_check_call_status(); if (!(Z_TYPE_P(parameters) == IS_NULL)) { ZEPHIR_INIT_VAR(_2); ZVAL_LONG(_2, 0); Z_SET_ISREF_P(parameters); ZEPHIR_CALL_FUNCTION(NULL, "extract", NULL, 24, parameters, _2); Z_UNSET_ISREF_P(parameters); zephir_check_call_status(); } _3 = zephir_fetch_nproperty_this(this_ptr, SL("path"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_4); ZEPHIR_CONCAT_VV(_4, _3, path); if (zephir_require_zval(_4 TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } ZEPHIR_CALL_FUNCTION(&tmp, "ob_get_contents", NULL, 25); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 26); zephir_check_call_status(); RETURN_CCTOR(tmp); }
/** * Check whether internal resource has rows to fetch * * @return boolean */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, valid){ zval *type = NULL, *result = NULL, *row = NULL, *model = NULL, *active_row = NULL, *rows = NULL; PHALCON_MM_GROW(); PHALCON_INIT_VAR(type); phalcon_read_property(&type, this_ptr, SL("_type"), PH_NOISY_CC); if (zend_is_true(type)) { PHALCON_INIT_VAR(result); phalcon_read_property(&result, this_ptr, SL("_result"), PH_NOISY_CC); if (Z_TYPE_P(result) != IS_BOOL || (Z_TYPE_P(result) == IS_BOOL && Z_BVAL_P(result))) { PHALCON_INIT_VAR(row); PHALCON_CALL_METHOD_PARAMS_1(row, result, "fetcharray", result, PH_NO_CHECK); if (Z_TYPE_P(row) != IS_BOOL || (Z_TYPE_P(row) == IS_BOOL && Z_BVAL_P(row))) { PHALCON_INIT_VAR(model); phalcon_read_property(&model, this_ptr, SL("_model"), PH_NOISY_CC); PHALCON_INIT_VAR(active_row); PHALCON_CALL_STATIC_PARAMS_2(active_row, "phalcon\\mvc\\model", "dumpresult", model, row); phalcon_update_property_zval(this_ptr, SL("_activeRow"), active_row TSRMLS_CC); PHALCON_MM_RESTORE(); RETURN_TRUE; } } } else { PHALCON_INIT_VAR(rows); phalcon_read_property(&rows, this_ptr, SL("_rows"), PH_NOISY_CC); Z_SET_ISREF_P(rows); PHALCON_INIT_VAR(row); PHALCON_CALL_FUNC_PARAMS_1(row, "current", rows); Z_UNSET_ISREF_P(rows); if (zend_is_true(row)) { Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("next", rows); Z_UNSET_ISREF_P(rows); phalcon_update_property_zval(this_ptr, SL("_activeRow"), row TSRMLS_CC); PHALCON_MM_RESTORE(); RETURN_TRUE; } } PHALCON_MM_RESTORE(); RETURN_FALSE; }
/** * Executes the validator * * @return boolean */ PHP_METHOD(Phalcon_Model_Validator_Email, validate){ zval *regs = NULL, *field_name = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL, *r5 = NULL, *r6 = NULL; zval *r7 = NULL, *r8 = NULL; zval *c0 = NULL, *c1 = NULL, *c2 = NULL; PHALCON_MM_GROW(); PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CALL_METHOD(r0, this_ptr, "isrequired", PHALCON_NO_CHECK); if (zend_is_true(r0)) { PHALCON_INIT_VAR(regs); ZVAL_NULL(regs); PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_CALL_METHOD(r1, this_ptr, "getfieldname", PHALCON_NO_CHECK); PHALCON_CPY_WRT(field_name, r1); PHALCON_ALLOC_ZVAL_MM(r2); PHALCON_INIT_VAR(c0); ZVAL_STRING(c0, "/^[a-zA-Z0-9_\\.\\+]+@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*$/", 1); PHALCON_ALLOC_ZVAL_MM(r3); PHALCON_CALL_METHOD(r3, this_ptr, "getvalue", PHALCON_NO_CHECK); Z_SET_ISREF_P(regs); PHALCON_CALL_FUNC_PARAMS_3(r2, "preg_match", c0, r3, regs, 0x006); Z_UNSET_ISREF_P(regs); if (zend_is_true(r2)) { PHALCON_ALLOC_ZVAL_MM(r4); phalcon_array_fetch_long(&r4, regs, 0, PHALCON_NOISY TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(r5); PHALCON_CALL_METHOD(r5, this_ptr, "getvalue", PHALCON_NO_CHECK); PHALCON_INIT_VAR(r6); is_not_equal_function(r6, r4, r5 TSRMLS_CC); if (zend_is_true(r6)) { PHALCON_ALLOC_ZVAL_MM(r7); PHALCON_CONCAT_SVS(r7, "Value of field '", field_name, "' should be a valid e-mail"); PHALCON_INIT_VAR(c1); ZVAL_STRING(c1, "email", 1); PHALCON_CALL_METHOD_PARAMS_3_NORETURN(this_ptr, "appendmessage", r7, field_name, c1, PHALCON_NO_CHECK); PHALCON_MM_RESTORE(); RETURN_FALSE; } } else { PHALCON_ALLOC_ZVAL_MM(r8); PHALCON_CONCAT_SVS(r8, "Value of field '", field_name, "' should be a valid e-mail"); PHALCON_INIT_VAR(c2); ZVAL_STRING(c2, "email", 1); PHALCON_CALL_METHOD_PARAMS_3_NORETURN(this_ptr, "appendmessage", r8, field_name, c2, PHALCON_NO_CHECK); PHALCON_MM_RESTORE(); RETURN_FALSE; } } PHALCON_MM_RESTORE(); RETURN_TRUE; }
/** * Initializes the class. It assigns the attributes that can be obtained and modified. */ PHP_METHOD(Phady_Security_Core_Models_Entities_Resources, init) { zval *_1, *_2 = NULL, *_3 = NULL, *_4 = NULL, *_6; int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_0 = NULL, *_5 = NULL; ZEPHIR_MM_GROW(); ZEPHIR_CALL_PARENT(NULL, phady_security_core_models_entities_resources_ce, this_ptr, "init", &_0, 56); zephir_check_call_status(); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_set"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "resource_id", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_3); ZVAL_STRING(_3, "module_id", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_4); ZVAL_STRING(_4, "name", ZEPHIR_TEMP_PARAM_COPY); Z_SET_ISREF_P(_1); ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_5, 57, _1, _2, _3, _4); zephir_check_temp_parameter(_2); zephir_check_temp_parameter(_3); zephir_check_temp_parameter(_4); Z_UNSET_ISREF_P(_1); zephir_check_call_status(); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_get"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_2); ZVAL_STRING(_2, "resource_id", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "module_id", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_4); ZVAL_STRING(_4, "name", ZEPHIR_TEMP_PARAM_COPY); Z_SET_ISREF_P(_6); ZEPHIR_CALL_FUNCTION(NULL, "array_push", &_5, 57, _6, _2, _3, _4); zephir_check_temp_parameter(_2); zephir_check_temp_parameter(_3); zephir_check_temp_parameter(_4); Z_UNSET_ISREF_P(_6); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Rewinds resultset to its beginning * */ PHP_METHOD(Phalcon_Mvc_Model_Resultset, rewind){ zval *type, *result = NULL, *active_row, *zero, *rows = NULL; PHALCON_MM_GROW(); PHALCON_OBS_VAR(type); phalcon_read_property_this(&type, this_ptr, SL("_type"), PH_NOISY_CC); if (zend_is_true(type)) { /** * Here, the resultset act as a result that is fetched one by one */ PHALCON_OBS_VAR(result); phalcon_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); if (PHALCON_IS_NOT_FALSE(result)) { PHALCON_OBS_VAR(active_row); phalcon_read_property_this(&active_row, this_ptr, SL("_activeRow"), PH_NOISY_CC); if (Z_TYPE_P(active_row) != IS_NULL) { PHALCON_INIT_VAR(zero); ZVAL_LONG(zero, 0); phalcon_call_method_p1_noret(result, "dataseek", zero); } } } else { /** * Here, the resultset act as an array */ PHALCON_OBS_VAR(rows); phalcon_read_property_this(&rows, this_ptr, SL("_rows"), PH_NOISY_CC); if (Z_TYPE_P(rows) == IS_NULL) { PHALCON_OBS_NVAR(result); phalcon_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); if (Z_TYPE_P(result) == IS_OBJECT) { PHALCON_INIT_NVAR(rows); phalcon_call_method(rows, result, "fetchall"); phalcon_update_property_this(this_ptr, SL("_rows"), rows TSRMLS_CC); } } if (Z_TYPE_P(rows) == IS_ARRAY) { Z_SET_ISREF_P(rows); phalcon_call_func_p1_noret("reset", rows); Z_UNSET_ISREF_P(rows); } } phalcon_update_property_long(this_ptr, SL("_pointer"), 0 TSRMLS_CC); PHALCON_MM_RESTORE(); }
/* {{{ my_copy_zval */ zval* my_copy_zval(zval* dst, const zval* src, int persistent TSRMLS_DC) { zval **tmp; assert(dst != NULL); assert(src != NULL); memcpy(dst, src, sizeof(zval)); /* deep copies are refcount(1), but moved up for recursive * arrays, which end up being add_ref'd during its copy. */ Z_SET_REFCOUNT_P(dst, 1); Z_UNSET_ISREF_P(dst); switch (src->type & IS_CONSTANT_TYPE_MASK) { case IS_RESOURCE: php_error(E_ERROR, "Cannot copy resource"); break; case IS_BOOL: case IS_LONG: case IS_DOUBLE: case IS_NULL: break; case IS_CONSTANT: case IS_STRING: if (src->value.str.val) { dst->value.str.val = pestrndup(src->value.str.val, src->value.str.len, persistent); } break; #if ZEND_EXTENSION_API_NO < PHP_5_5_X_API_NO case IS_CONSTANT_ARRAY: #endif case IS_ARRAY: dst->value.ht = my_copy_hashtable(NULL, src->value.ht, (ht_copy_fun_t) my_copy_zval_ptr, (void*) &tmp, sizeof(zval *), persistent TSRMLS_CC); break; // XXX: we don't serialize object. case IS_OBJECT: php_error(E_ERROR, "Cannot copy Object."); break; #ifdef ZEND_ENGINE_2_4 case IS_CALLABLE: php_error(E_ERROR, "Cannot copy Callable."); // XXX: we don't serialize callbable object. break; #endif default: assert(0); } return dst; }
/* {{{ phpg_read_property() */ zval* phpg_read_property(zval *object, zval *member, int type PHPGTK_PROPERTY_END) { phpg_head_t *poh = NULL; zval tmp_member; zval result, *result_ptr = NULL; prop_info_t *pi = NULL; int ret; if (member->type != IS_STRING) { tmp_member = *member; zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; } ret = FAILURE; poh = (phpg_head_t *) zend_object_store_get_object(object TSRMLS_CC); if (poh->pi_hash) { ret = zend_hash_find(poh->pi_hash, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &pi); } if (ret == SUCCESS) { memset(&result, 0, sizeof(zval)); ZVAL_NULL(&result); ret = pi->read(poh, &result TSRMLS_CC); if (ret == SUCCESS) { ALLOC_ZVAL(result_ptr); *result_ptr = result; //INIT_PZVAL(result_ptr); Z_SET_REFCOUNT_P(result_ptr, 0); Z_UNSET_ISREF_P(result_ptr); } else { result_ptr = EG(uninitialized_zval_ptr); } } else { #if PHP_VERSION_ID < 50399 result_ptr = zend_get_std_object_handlers()->read_property(object, member, type TSRMLS_CC); #else result_ptr = zend_get_std_object_handlers()->read_property(object, member, type, NULL TSRMLS_CC); #endif } if (member == &tmp_member) { zval_dtor(member); } return result_ptr; }
/** * Defined by Iterator interface * * @return mixed */ PHP_METHOD(Yaf_Session, current) { int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_1 = NULL; zval *_0; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("session"), PH_NOISY_CC); Z_SET_ISREF_P(_0); ZEPHIR_RETURN_CALL_FUNCTION("current", &_1, _0); Z_UNSET_ISREF_P(_0); zephir_check_call_status(); RETURN_MM(); }
/** * Get the storage array of routes * * @return array */ PHP_METHOD(Prr_RouteCollection, all) { int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_1 = NULL; zval *_0; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("storage"), PH_NOISY_CC); Z_SET_ISREF_P(_0); ZEPHIR_CALL_FUNCTION(NULL, "reset", &_1, _0); Z_UNSET_ISREF_P(_0); zephir_check_call_status(); RETURN_MM_MEMBER(this_ptr, "storage"); }
/** * Rewinds resultset to its beginning */ PHP_METHOD(Phalcon_Mvc_Model_Resultset, rewind) { zephir_nts_static zephir_fcall_cache_entry *_3 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *rows = NULL, *result = NULL, *_0, *_1, *_2; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); if (zephir_is_true(_0)) { ZEPHIR_OBS_VAR(result); zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); if (!ZEPHIR_IS_FALSE_IDENTICAL(result)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("_activeRow"), PH_NOISY_CC); if (Z_TYPE_P(_1) != IS_NULL) { ZEPHIR_INIT_VAR(_2); ZVAL_LONG(_2, 0); ZEPHIR_CALL_METHOD(NULL, result, "dataseek", NULL, _2); zephir_check_call_status(); } } } else { ZEPHIR_OBS_VAR(rows); zephir_read_property_this(&rows, this_ptr, SL("_rows"), PH_NOISY_CC); if (Z_TYPE_P(rows) == IS_NULL) { ZEPHIR_OBS_NVAR(result); zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); if (Z_TYPE_P(result) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&rows, result, "fetchall", NULL); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_rows"), rows TSRMLS_CC); } } if (Z_TYPE_P(rows) == IS_ARRAY) { Z_SET_ISREF_P(rows); ZEPHIR_CALL_FUNCTION(NULL, "reset", &_3, rows); Z_UNSET_ISREF_P(rows); zephir_check_call_status(); } } ZEPHIR_INIT_ZVAL_NREF(_1); ZVAL_LONG(_1, 0); zephir_update_property_this(this_ptr, SL("_pointer"), _1 TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Test_Pregmatch, testPregMatch5Params) { int ZEPHIR_LAST_CALL_STATUS; zval *pattern, *subject, *matches, *flags, *offset; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 5, 0, &pattern, &subject, &matches, &flags, &offset); Z_SET_ISREF_P(matches); ZEPHIR_RETURN_CALL_FUNCTION("preg_match", NULL, 49, pattern, subject, matches, flags, offset); Z_UNSET_ISREF_P(matches); zephir_check_call_status(); RETURN_MM(); }
/** * Sorts an array */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, sort) { int ZEPHIR_LAST_CALL_STATUS; zval *value_param = NULL; zval *value = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &value_param); zephir_get_arrval(value, value_param); Z_SET_ISREF_P(value); ZEPHIR_CALL_FUNCTION(NULL, "asort", NULL, 381, value); Z_UNSET_ISREF_P(value); zephir_check_call_status(); RETURN_CTOR(value); }
/** * Rewind array position * * @see Iterator * @return boolean */ PHP_METHOD(Prr_RouteCollection, valid) { zend_bool _2; int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_1 = NULL; zval *key = NULL, *_0; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("storage"), PH_NOISY_CC); Z_SET_ISREF_P(_0); ZEPHIR_CALL_FUNCTION(&key, "key", &_1, _0); Z_UNSET_ISREF_P(_0); zephir_check_call_status(); _2 = Z_TYPE_P(key) != IS_NULL; if (_2) { _2 = !ZEPHIR_IS_FALSE_IDENTICAL(key); } RETURN_MM_BOOL(_2); }
/** * Makes a connection to the Beanstalkd server */ PHP_METHOD(Phalcon_Queue_Beanstalk, connect) { zephir_nts_static zephir_fcall_cache_entry *_4 = NULL, *_6 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *connection = NULL, *parameters, *_0, *_1, *_2, *_3, _5; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(connection); zephir_read_property_this(&connection, this_ptr, SL("_connection"), PH_NOISY_CC); if (Z_TYPE_P(connection) == IS_RESOURCE) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "disconnect", NULL); zephir_check_call_status(); } ZEPHIR_OBS_VAR(parameters); zephir_read_property_this(¶meters, this_ptr, SL("_parameters"), PH_NOISY_CC); zephir_array_fetch_string(&_0, parameters, SL("host"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 78 TSRMLS_CC); zephir_array_fetch_string(&_1, parameters, SL("port"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 78 TSRMLS_CC); ZEPHIR_INIT_VAR(_2); ZVAL_NULL(_2); ZEPHIR_INIT_VAR(_3); ZVAL_NULL(_3); Z_SET_ISREF_P(_2); ZEPHIR_CALL_FUNCTION(&connection, "fsockopen", &_4, _0, _1, _2, _3); Z_UNSET_ISREF_P(_2); zephir_check_call_status(); if (Z_TYPE_P(connection) != IS_RESOURCE) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_exception_ce, "Can't connect to Beanstalk server", "phalcon/queue/beanstalk.zep", 80); return; } ZEPHIR_SINIT_VAR(_5); ZVAL_LONG(&_5, -1); ZEPHIR_CALL_FUNCTION(NULL, "stream_set_timeout", &_6, connection, &_5, ZEPHIR_GLOBAL(global_null)); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_connection"), connection TSRMLS_CC); RETURN_CCTOR(connection); }
PHP_METHOD(Test_Pregmatch, testMatchAll) { int ZEPHIR_LAST_CALL_STATUS; zval *flags, *text, *matches, *_0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &flags); ZEPHIR_INIT_VAR(matches); array_init(matches); ZEPHIR_INIT_VAR(text); ZVAL_STRING(text, "test1,test2", 1); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "/(test[0-9]+)/", ZEPHIR_TEMP_PARAM_COPY); Z_SET_ISREF_P(matches); ZEPHIR_CALL_FUNCTION(NULL, "preg_match_all", NULL, 50, _0, text, matches, flags); zephir_check_temp_parameter(_0); Z_UNSET_ISREF_P(matches); zephir_check_call_status(); RETURN_CCTOR(matches); }
/** * Applies a format to a message before sending it to the log * * @param string $message * @param int $type * @param int $timestamp * @param array $context * * @return string */ PHP_METHOD(Phalcon_Logger_Formatter_Firephp, format) { zval *_18; HashTable *_7; HashPosition _6; zend_bool param, _11, _14; int type, timestamp, ZEPHIR_LAST_CALL_STATUS; zval *message_param = NULL, *type_param = NULL, *timestamp_param = NULL, *context = NULL, *meta, *body = NULL, *backtrace = NULL, *encoded, *len, *lastTrace = NULL, *_0 = NULL, *_1 = NULL, *_2, *backtraceItem = NULL, *key = NULL, _3, _4, *_5, **_8, *_9, *_10, *_12, *_13, *_15, *_16, *_17; zval *message = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &message_param, &type_param, ×tamp_param, &context); zephir_get_strval(message, message_param); type = zephir_get_intval(type_param); timestamp = zephir_get_intval(timestamp_param); if (!context) { context = ZEPHIR_GLOBAL(global_null); } if (Z_TYPE_P(context) == IS_ARRAY) { ZEPHIR_CALL_METHOD(&_0, this_ptr, "interpolate", NULL, 0, message, context); zephir_check_call_status(); zephir_get_strval(message, _0); } ZEPHIR_INIT_VAR(meta); zephir_create_array(meta, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, type); ZEPHIR_CALL_METHOD(&_0, this_ptr, "gettypestring", NULL, 0, _1); zephir_check_call_status(); zephir_array_update_string(&meta, SL("Type"), &_0, PH_COPY | PH_SEPARATE); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); if (zephir_is_true(_2)) { param = 0; ZEPHIR_INIT_NVAR(_1); ZEPHIR_GET_CONSTANT(_1, "PHP_VERSION"); ZEPHIR_SINIT_VAR(_3); ZVAL_STRING(&_3, "5.3.6", 0); ZEPHIR_SINIT_VAR(_4); ZVAL_STRING(&_4, "<", 0); ZEPHIR_CALL_FUNCTION(&_0, "version_compare", NULL, 248, _1, &_3, &_4); zephir_check_call_status(); if (!(zephir_is_true(_0))) { param = (2) ? 1 : 0; } ZEPHIR_CALL_FUNCTION(&backtrace, "debug_backtrace", NULL, 150, (param ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false))); zephir_check_call_status(); Z_SET_ISREF_P(backtrace); ZEPHIR_CALL_FUNCTION(&lastTrace, "end", NULL, 170, backtrace); Z_UNSET_ISREF_P(backtrace); zephir_check_call_status(); if (zephir_array_isset_string(lastTrace, SS("file"))) { zephir_array_fetch_string(&_5, lastTrace, SL("file"), PH_NOISY | PH_READONLY, "phalcon/logger/formatter/firephp.zep", 133 TSRMLS_CC); zephir_array_update_string(&meta, SL("File"), &_5, PH_COPY | PH_SEPARATE); } if (zephir_array_isset_string(lastTrace, SS("line"))) { zephir_array_fetch_string(&_5, lastTrace, SL("line"), PH_NOISY | PH_READONLY, "phalcon/logger/formatter/firephp.zep", 137 TSRMLS_CC); zephir_array_update_string(&meta, SL("Line"), &_5, PH_COPY | PH_SEPARATE); } zephir_is_iterable(backtrace, &_7, &_6, 1, 0, "phalcon/logger/formatter/firephp.zep", 146); for ( ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS ; zephir_hash_move_forward_ex(_7, &_6) ) { ZEPHIR_GET_HMKEY(key, _7, _6); ZEPHIR_GET_HVALUE(backtraceItem, _8); zephir_array_unset_string(&backtraceItem, SS("object"), PH_SEPARATE); zephir_array_unset_string(&backtraceItem, SS("args"), PH_SEPARATE); zephir_array_update_zval(&backtrace, key, &backtraceItem, PH_COPY | PH_SEPARATE); } } _9 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); if (zephir_is_true(_9)) { zephir_array_update_string(&meta, SL("Label"), &message, PH_COPY | PH_SEPARATE); } _10 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); _11 = !zephir_is_true(_10); if (_11) { _12 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); _11 = !zephir_is_true(_12); } _13 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); _14 = zephir_is_true(_13); if (_14) { _15 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); _14 = !zephir_is_true(_15); } if (_11) { ZEPHIR_CPY_WRT(body, message); } else if (_14) { ZEPHIR_INIT_NVAR(body); ZVAL_STRING(body, "", 1); } else { ZEPHIR_INIT_NVAR(body); array_init(body); _16 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC); if (zephir_is_true(_16)) { zephir_array_update_string(&body, SL("backtrace"), &backtrace, PH_COPY | PH_SEPARATE); } _17 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC); if (!(zephir_is_true(_17))) { zephir_array_update_string(&body, SL("message"), &message, PH_COPY | PH_SEPARATE); } } ZEPHIR_INIT_VAR(_18); zephir_create_array(_18, 2, 0 TSRMLS_CC); zephir_array_fast_append(_18, meta); zephir_array_fast_append(_18, body); ZEPHIR_INIT_VAR(encoded); zephir_json_encode(encoded, &(encoded), _18, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(len); ZVAL_LONG(len, zephir_fast_strlen_ev(encoded)); ZEPHIR_CONCAT_VSVS(return_value, len, "|", encoded, "|"); RETURN_MM(); }
/** * Returns an array of Phalcon\Db\Column objects describing a table * * <code> * print_r($connection->describeColumns("posts")); * </code> * * @param string table * @param string schema * @return Phalcon\Db\Column[] */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns) { zephir_fcall_cache_entry *_17 = NULL; zephir_nts_static zephir_fcall_cache_entry *_10 = NULL; HashTable *_5; HashPosition _4; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema_param = NULL, *columns, *columnType = NULL, *field = NULL, *definition = NULL, *oldColumn = NULL, *sizePattern, *matches = NULL, *matchOne = NULL, *matchTwo = NULL, *columnName, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7 = NULL, *_8 = NULL, *_9 = NULL, *_11 = NULL, *_12, *_13, *_14, *_15 = NULL, *_16; zval *table = NULL, *schema = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema_param); zephir_get_strval(table, table_param); if (!schema_param) { ZEPHIR_INIT_VAR(schema); ZVAL_EMPTY_STRING(schema); } else { zephir_get_strval(schema, schema_param); } ZEPHIR_INIT_VAR(oldColumn); ZVAL_NULL(oldColumn); ZEPHIR_INIT_VAR(sizePattern); ZVAL_STRING(sizePattern, "#\\(([0-9]+)(?:,\\s*([0-9]+))*\\)#", 1); ZEPHIR_INIT_VAR(columns); array_init(columns); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describecolumns", NULL, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/mysql.zep", 271); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(field, _6); ZEPHIR_INIT_NVAR(definition); zephir_create_array(definition, 1, 0 TSRMLS_CC); add_assoc_long_ex(definition, SS("bindType"), 2); ZEPHIR_OBS_NVAR(columnType); zephir_array_fetch_long(&columnType, field, 1, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 115 TSRMLS_CC); while (1) { if (zephir_memnstr_str(columnType, SL("enum"), "phalcon/db/adapter/pdo/mysql.zep", 122)) { ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 5); zephir_array_update_string(&definition, SL("type"), &_3, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/mysql.zep", 130)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 0); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 1); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("varchar"), "phalcon/db/adapter/pdo/mysql.zep", 140)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 2); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("datetime"), "phalcon/db/adapter/pdo/mysql.zep", 148)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 4); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("decimal"), "phalcon/db/adapter/pdo/mysql.zep", 156)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 3); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 32); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/mysql.zep", 166)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/mysql.zep", 174)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("text"), "phalcon/db/adapter/pdo/mysql.zep", 182)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 6); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("float"), "phalcon/db/adapter/pdo/mysql.zep", 190)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 7); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 3); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 2); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("("), "phalcon/db/adapter/pdo/mysql.zep", 207)) { ZEPHIR_INIT_NVAR(matches); ZVAL_NULL(matches); Z_SET_ISREF_P(matches); ZEPHIR_CALL_FUNCTION(&_9, "preg_match", &_10, sizePattern, columnType, matches); Z_UNSET_ISREF_P(matches); zephir_check_call_status(); if (zephir_is_true(_9)) { ZEPHIR_OBS_NVAR(matchOne); if (zephir_array_isset_long_fetch(&matchOne, matches, 1, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, zephir_get_intval(matchOne)); zephir_array_update_string(&definition, SL("size"), &_8, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(matchTwo); if (zephir_array_isset_long_fetch(&matchTwo, matches, 2, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_11); ZVAL_LONG(_11, zephir_get_intval(matchTwo)); zephir_array_update_string(&definition, SL("scale"), &_11, PH_COPY | PH_SEPARATE); } } } if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/mysql.zep", 222)) { zephir_array_update_string(&definition, SL("unsigned"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(oldColumn) == IS_NULL) { zephir_array_update_string(&definition, SL("first"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } else { zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_12, field, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 238 TSRMLS_CC); if (ZEPHIR_IS_STRING(_12, "PRI")) { zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_13, field, 2, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 245 TSRMLS_CC); if (ZEPHIR_IS_STRING(_13, "NO")) { zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_14, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 252 TSRMLS_CC); if (ZEPHIR_IS_STRING(_14, "auto_increment")) { zephir_array_update_string(&definition, SL("autoIncrement"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(_15); zephir_array_fetch_long(&_15, field, 4, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 259 TSRMLS_CC); if (Z_TYPE_P(_15) != IS_NULL) { zephir_array_fetch_long(&_16, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 260 TSRMLS_CC); zephir_array_update_string(&definition, SL("default"), &_16, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&columnName, field, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 266 TSRMLS_CC); ZEPHIR_INIT_NVAR(_7); object_init_ex(_7, phalcon_db_column_ce); ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_17, columnName, definition); zephir_check_call_status(); zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/mysql.zep", 267); ZEPHIR_CPY_WRT(oldColumn, columnName); } RETURN_CCTOR(columns); }
/** * Handles routing information received from command-line arguments * * @param array arguments */ PHP_METHOD(Phalcon_Cli_Router, handle) { zval *_16 = NULL; zval *_6 = NULL, *_11 = NULL; zephir_nts_static zephir_fcall_cache_entry *_5 = NULL, *_19 = NULL; int ZEPHIR_LAST_CALL_STATUS; HashTable *_3, *_8; HashPosition _2, _7; zend_bool _0; zval *arguments = NULL, *moduleName = NULL, *taskName = NULL, *actionName = NULL, *params = NULL, *route = NULL, *parts = NULL, *pattern = NULL, *routeFound = NULL, *matches, *paths = NULL, *beforeMatch = NULL, *converters = NULL, *converter = NULL, *part = NULL, *position = NULL, *matchPosition = NULL, *strParams, *_1, **_4, **_9, *_10 = NULL, *_12, *_13, *_14, *_15, _17, *_18 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &arguments); if (!arguments) { arguments = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(routeFound); ZVAL_BOOL(routeFound, 0); ZEPHIR_INIT_VAR(parts); array_init(parts); ZEPHIR_INIT_VAR(params); array_init(params); ZEPHIR_INIT_VAR(matches); ZVAL_NULL(matches); zephir_update_property_this(this_ptr, SL("_wasMatched"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_matchedRoute"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); if (Z_TYPE_P(arguments) != IS_ARRAY) { _0 = Z_TYPE_P(arguments) != IS_STRING; if (_0) { _0 = Z_TYPE_P(arguments) != IS_NULL; } if (_0) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "Arguments must be an array or string", "phalcon/cli/router.zep", 223); return; } _1 = zephir_fetch_nproperty_this(this_ptr, SL("_routes"), PH_NOISY_CC); zephir_is_iterable(_1, &_3, &_2, 0, 1, "phalcon/cli/router.zep", 323); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_backwards_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(route, _4); ZEPHIR_CALL_METHOD(&pattern, route, "getcompiledpattern", NULL); zephir_check_call_status(); if (zephir_memnstr_str(pattern, SL("^"), "phalcon/cli/router.zep", 233)) { Z_SET_ISREF_P(matches); ZEPHIR_CALL_FUNCTION(&routeFound, "preg_match", &_5, pattern, arguments, matches); Z_UNSET_ISREF_P(matches); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(routeFound); ZVAL_BOOL(routeFound, ZEPHIR_IS_EQUAL(pattern, arguments)); } if (zephir_is_true(routeFound)) { ZEPHIR_CALL_METHOD(&beforeMatch, route, "getbeforematch", NULL); zephir_check_call_status(); if (Z_TYPE_P(beforeMatch) != IS_NULL) { if (!(zephir_is_callable(beforeMatch TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "Before-Match callback is not callable in matched route", "phalcon/cli/router.zep", 251); return; } ZEPHIR_INIT_NVAR(routeFound); ZEPHIR_INIT_NVAR(_6); zephir_create_array(_6, 3, 0 TSRMLS_CC); zephir_array_fast_append(_6, arguments); zephir_array_fast_append(_6, route); zephir_array_fast_append(_6, this_ptr); ZEPHIR_CALL_USER_FUNC_ARRAY(routeFound, beforeMatch, _6); zephir_check_call_status(); } } if (zephir_is_true(routeFound)) { ZEPHIR_CALL_METHOD(&paths, route, "getpaths", NULL); zephir_check_call_status(); ZEPHIR_CPY_WRT(parts, paths); if (Z_TYPE_P(matches) == IS_ARRAY) { ZEPHIR_CALL_METHOD(&converters, route, "getconverters", NULL); zephir_check_call_status(); zephir_is_iterable(paths, &_8, &_7, 0, 0, "phalcon/cli/router.zep", 312); for ( ; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS ; zephir_hash_move_forward_ex(_8, &_7) ) { ZEPHIR_GET_HMKEY(part, _8, _7); ZEPHIR_GET_HVALUE(position, _9); ZEPHIR_OBS_NVAR(matchPosition); if (zephir_array_isset_fetch(&matchPosition, matches, position, 0 TSRMLS_CC)) { if (Z_TYPE_P(converters) == IS_ARRAY) { ZEPHIR_OBS_NVAR(converter); if (zephir_array_isset_fetch(&converter, converters, part, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_10); ZEPHIR_INIT_NVAR(_6); zephir_create_array(_6, 1, 0 TSRMLS_CC); zephir_array_fast_append(_6, matchPosition); ZEPHIR_CALL_USER_FUNC_ARRAY(_10, converter, _6); zephir_check_call_status(); zephir_array_update_zval(&parts, part, &_10, PH_COPY | PH_SEPARATE); continue; } } zephir_array_update_zval(&parts, part, &matchPosition, PH_COPY | PH_SEPARATE); } else { if (Z_TYPE_P(converters) == IS_ARRAY) { ZEPHIR_OBS_NVAR(converter); if (zephir_array_isset_fetch(&converter, converters, part, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_10); ZEPHIR_INIT_NVAR(_11); zephir_create_array(_11, 1, 0 TSRMLS_CC); zephir_array_fast_append(_11, position); ZEPHIR_CALL_USER_FUNC_ARRAY(_10, converter, _11); zephir_check_call_status(); zephir_array_update_zval(&parts, part, &_10, PH_COPY | PH_SEPARATE); } } } } zephir_update_property_this(this_ptr, SL("_matches"), matches TSRMLS_CC); } zephir_update_property_this(this_ptr, SL("_matchedRoute"), route TSRMLS_CC); break; } } if (zephir_is_true(routeFound)) { zephir_update_property_this(this_ptr, SL("_wasMatched"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_wasMatched"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); _12 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultModule"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_module"), _12 TSRMLS_CC); _13 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultTask"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_task"), _13 TSRMLS_CC); _14 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAction"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_action"), _14 TSRMLS_CC); _15 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultParams"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_params"), _15 TSRMLS_CC); RETURN_THIS(); } } else { ZEPHIR_CPY_WRT(parts, arguments); } ZEPHIR_INIT_VAR(moduleName); ZVAL_NULL(moduleName); ZEPHIR_INIT_VAR(taskName); ZVAL_NULL(taskName); ZEPHIR_INIT_VAR(actionName); ZVAL_NULL(actionName); ZEPHIR_OBS_NVAR(moduleName); if (zephir_array_isset_string_fetch(&moduleName, parts, SS("module"), 0 TSRMLS_CC)) { zephir_array_unset_string(&parts, SS("module"), PH_SEPARATE); } else { ZEPHIR_OBS_NVAR(moduleName); zephir_read_property_this(&moduleName, this_ptr, SL("_defaultModule"), PH_NOISY_CC); } ZEPHIR_OBS_NVAR(taskName); if (zephir_array_isset_string_fetch(&taskName, parts, SS("task"), 0 TSRMLS_CC)) { zephir_array_unset_string(&parts, SS("task"), PH_SEPARATE); } else { ZEPHIR_OBS_NVAR(taskName); zephir_read_property_this(&taskName, this_ptr, SL("_defaultTask"), PH_NOISY_CC); } ZEPHIR_OBS_NVAR(actionName); if (zephir_array_isset_string_fetch(&actionName, parts, SS("action"), 0 TSRMLS_CC)) { zephir_array_unset_string(&parts, SS("action"), PH_SEPARATE); } else { ZEPHIR_OBS_NVAR(actionName); zephir_read_property_this(&actionName, this_ptr, SL("_defaultAction"), PH_NOISY_CC); } if (zephir_is_true(routeFound)) { ZEPHIR_OBS_NVAR(params); if (zephir_array_isset_string_fetch(¶ms, parts, SS("params"), 0 TSRMLS_CC)) { if (Z_TYPE_P(params) != IS_ARRAY) { zephir_get_strval(_16, params); ZEPHIR_SINIT_VAR(_17); ZVAL_LONG(&_17, 1); ZEPHIR_INIT_VAR(strParams); zephir_substr(strParams, _16, 1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); if (zephir_is_true(strParams)) { ZEPHIR_INIT_NVAR(params); ZEPHIR_CALL_CE_STATIC(&_18, phalcon_cli_router_route_ce, "getdelimiter", &_19); zephir_check_call_status(); zephir_fast_explode(params, _18, strParams, LONG_MAX TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(params); array_init(params); } } zephir_array_unset_string(&parts, SS("params"), PH_SEPARATE); } if (zephir_fast_count_int(params TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_10); zephir_fast_array_merge(_10, &(params), &(parts) TSRMLS_CC); ZEPHIR_CPY_WRT(params, _10); } else { ZEPHIR_CPY_WRT(params, parts); } } else { ZEPHIR_CPY_WRT(params, parts); } zephir_update_property_this(this_ptr, SL("_module"), moduleName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_task"), taskName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_action"), actionName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_params"), params TSRMLS_CC); ZEPHIR_MM_RESTORE(); }