/** * Applies a format to a message before sent it to the internal log * * @param string message * @param int type * @param int timestamp * @param array $context * @return string */ PHP_METHOD(Phalcon_Logger_Formatter_Line, format) { zend_long type, timestamp, ZEPHIR_LAST_CALL_STATUS; zval *message_param = NULL, *type_param = NULL, *timestamp_param = NULL, *context = NULL, *format = NULL, *_8, _9, *_10, *_11, *_0$$3, *_1$$3, _2$$3 = zval_used_for_init, *_3$$3 = NULL, *_4$$4, *_5$$4 = NULL, *_6$$4, _7$$4; 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); } ZEPHIR_OBS_VAR(format); zephir_read_property_this(&format, this_ptr, SL("_format"), PH_NOISY_CC); if (zephir_memnstr_str(format, SL("%date%"), "phalcon/logger/formatter/line.zep", 80)) { ZEPHIR_INIT_VAR(_0$$3); _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_dateFormat"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_2$$3); ZVAL_LONG(&_2$$3, timestamp); ZEPHIR_CALL_FUNCTION(&_3$$3, "date", NULL, 306, _1$$3, &_2$$3); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_2$$3); ZVAL_STRING(&_2$$3, "%date%", 0); zephir_fast_str_replace(&_0$$3, &_2$$3, _3$$3, format TSRMLS_CC); ZEPHIR_CPY_WRT(format, _0$$3); } if (zephir_memnstr_str(format, SL("%type%"), "phalcon/logger/formatter/line.zep", 87)) { ZEPHIR_INIT_VAR(_4$$4); ZEPHIR_INIT_VAR(_6$$4); ZVAL_LONG(_6$$4, type); ZEPHIR_CALL_METHOD(&_5$$4, this_ptr, "gettypestring", NULL, 0, _6$$4); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_7$$4); ZVAL_STRING(&_7$$4, "%type%", 0); zephir_fast_str_replace(&_4$$4, &_7$$4, _5$$4, format TSRMLS_CC); ZEPHIR_CPY_WRT(format, _4$$4); } ZEPHIR_INIT_VAR(_8); ZEPHIR_SINIT_VAR(_9); ZVAL_STRING(&_9, "%message%", 0); zephir_fast_str_replace(&_8, &_9, message, format TSRMLS_CC); ZEPHIR_INIT_VAR(_10); ZEPHIR_GET_CONSTANT(_10, "PHP_EOL"); ZEPHIR_INIT_VAR(_11); ZEPHIR_CONCAT_VV(_11, _8, _10); ZEPHIR_CPY_WRT(format, _11); if (Z_TYPE_P(context) == IS_ARRAY) { ZEPHIR_RETURN_CALL_METHOD(this_ptr, "interpolate", NULL, 0, format, context); zephir_check_call_status(); RETURN_MM(); } RETURN_CCTOR(format); }
/** * Applies a format to a message before sent it to the internal log * * @param string message * @param int type * @param int timestamp * @param array $context * @return string */ PHP_METHOD(Phalcon_Logger_Formatter_Line, format) { int type, timestamp, ZEPHIR_LAST_CALL_STATUS; zval *message_param = NULL, *type_param = NULL, *timestamp_param = NULL, *context = NULL, *format = NULL, *_0 = NULL, *_1, _2 = zval_used_for_init, *_3 = NULL, *_4; 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); } ZEPHIR_OBS_VAR(format); zephir_read_property_this(&format, this_ptr, SL("_format"), PH_NOISY_CC); if (zephir_memnstr_str(format, SL("%date%"), "phalcon/logger/formatter/line.zep", 81)) { ZEPHIR_INIT_VAR(_0); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dateFormat"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_2); ZVAL_LONG(&_2, timestamp); ZEPHIR_CALL_FUNCTION(&_3, "date", NULL, 285, _1, &_2); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_2); ZVAL_STRING(&_2, "%date%", 0); zephir_fast_str_replace(&_0, &_2, _3, format TSRMLS_CC); ZEPHIR_CPY_WRT(format, _0); } if (zephir_memnstr_str(format, SL("%type%"), "phalcon/logger/formatter/line.zep", 88)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_VAR(_4); ZVAL_LONG(_4, type); ZEPHIR_CALL_METHOD(&_3, this_ptr, "gettypestring", NULL, 0, _4); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_2); ZVAL_STRING(&_2, "%type%", 0); zephir_fast_str_replace(&_0, &_2, _3, format TSRMLS_CC); ZEPHIR_CPY_WRT(format, _0); } ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_2); ZVAL_STRING(&_2, "%message%", 0); zephir_fast_str_replace(&_0, &_2, message, format TSRMLS_CC); ZEPHIR_CPY_WRT(format, _0); if (Z_TYPE_P(context) == IS_ARRAY) { ZEPHIR_RETURN_CALL_METHOD(this_ptr, "interpolate", NULL, 0, format, context); zephir_check_call_status(); RETURN_MM(); } RETURN_CCTOR(format); }
/** * Escapes a string with htmlentities */ PHP_METHOD(Phalcon_Debug, _escapeString) { int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_5 = NULL; zval *value, *_0, _1, _2, _3, _4; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &value); if (Z_TYPE_P(value) == IS_STRING) { ZEPHIR_INIT_VAR(_0); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "\n", 0); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "\\n", 0); zephir_fast_str_replace(&_0, &_1, &_2, value TSRMLS_CC); ZEPHIR_SINIT_VAR(_3); ZVAL_LONG(&_3, 2); ZEPHIR_SINIT_VAR(_4); ZVAL_STRING(&_4, "utf-8", 0); ZEPHIR_RETURN_CALL_FUNCTION("htmlentities", &_5, _0, &_3, &_4); zephir_check_call_status(); RETURN_MM(); } RETVAL_ZVAL(value, 1, 0); RETURN_MM(); }
/** * Escapes a string with htmlentities */ PHP_METHOD(Phalcon_Debug, _escapeString) { int ZEPHIR_LAST_CALL_STATUS; zval *value, *_0$$3, _1$$3, _2$$3, _3$$3, _4$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &value); if (Z_TYPE_P(value) == IS_STRING) { ZEPHIR_INIT_VAR(_0$$3); ZEPHIR_SINIT_VAR(_1$$3); ZVAL_STRING(&_1$$3, "\n", 0); ZEPHIR_SINIT_VAR(_2$$3); ZVAL_STRING(&_2$$3, "\\n", 0); zephir_fast_str_replace(&_0$$3, &_1$$3, &_2$$3, value TSRMLS_CC); ZEPHIR_SINIT_VAR(_3$$3); ZVAL_LONG(&_3$$3, 2); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "utf-8", 0); ZEPHIR_RETURN_CALL_FUNCTION("htmlentities", NULL, 158, _0$$3, &_3$$3, &_4$$3); zephir_check_call_status(); RETURN_MM(); } RETVAL_ZVAL(value, 1, 0); RETURN_MM(); }
PHP_METHOD(Test_Strings, issue1267) { zval _1; zephir_fcall_cache_entry *_5 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *value = NULL, value_sub, x, _0, _2, _3, _4, _6, _7; zval *this_ptr = getThis(); ZVAL_UNDEF(&value_sub); ZVAL_UNDEF(&x); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_6); ZVAL_UNDEF(&_7); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &value); ZEPHIR_SEPARATE_PARAM(value); ZEPHIR_INIT_VAR(&_0); ZEPHIR_INIT_VAR(&_1); zephir_create_array(&_1, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_2); ZVAL_STRING(&_2, "\\"); zephir_array_fast_append(&_1, &_2); ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "\""); zephir_array_fast_append(&_1, &_2); ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, "'"); zephir_array_fast_append(&_1, &_2); ZEPHIR_INIT_NVAR(&_2); ZVAL_STRING(&_2, ""); zephir_fast_str_replace(&_0, &_1, &_2, value TSRMLS_CC); ZEPHIR_CPY_WRT(value, &_0); ZVAL_LONG(&_3, 513); ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 79, value, &_3); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_4); ZEPHIR_INIT_NVAR(&_0); ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 80, value); zephir_check_call_status(); zephir_stripslashes(&_0, &_4); ZEPHIR_INIT_VAR(&x); zephir_fast_trim(&x, &_0, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); ZEPHIR_INIT_VAR(&_6); ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 80, value); zephir_check_call_status(); zephir_stripcslashes(&_6, &_7); zephir_fast_trim(return_value, &_6, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); RETURN_MM(); }
PHP_METHOD(BeeFramework_Input, xss_clean) { zval *_3; int ZEPHIR_LAST_CALL_STATUS; zval *value = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, _4; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &value); ZEPHIR_SEPARATE_PARAM(value); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "/([\\x00-\\x08,\\x0b-\\x0c,\\x0e-\\x19])/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", NULL, 6, _0, _1, value); zephir_check_temp_parameter(_0); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, _2); ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_VAR(_3); zephir_create_array(_3, 8, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "\"", 1); zephir_array_fast_append(_3, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "\\", 1); zephir_array_fast_append(_3, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "'", 1); zephir_array_fast_append(_3, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "/", 1); zephir_array_fast_append(_3, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "..", 1); zephir_array_fast_append(_3, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "../", 1); zephir_array_fast_append(_3, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "./", 1); zephir_array_fast_append(_3, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "//", 1); zephir_array_fast_append(_3, _1); ZEPHIR_SINIT_VAR(_4); ZVAL_STRING(&_4, "", 0); zephir_fast_str_replace(&_0, _3, &_4, value TSRMLS_CC); ZEPHIR_CPY_WRT(value, _0); RETVAL_ZVAL(value, 1, 0); RETURN_MM(); }
/** * Appends a message to the validator * * @param string message * @param string|array field * @param string type */ PHP_METHOD(Phalcon_Mvc_Model_Validator, appendMessage) { int ZEPHIR_LAST_CALL_STATUS; zval *message_param = NULL, *field = NULL, *type = NULL, *_0 = NULL, _1, _2; zval *message = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &message_param, &field, &type); if (unlikely(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(message_param) == IS_STRING)) { zephir_get_strval(message, message_param); } else { ZEPHIR_INIT_VAR(message); ZVAL_EMPTY_STRING(message); } if (!field) { field = ZEPHIR_GLOBAL(global_null); } if (!type) { ZEPHIR_CPY_WRT(type, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(type); } if (!(zephir_is_true(type))) { ZEPHIR_INIT_VAR(_0); zephir_get_class(_0, this_ptr, 0 TSRMLS_CC); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "Validator", 0); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "", 0); ZEPHIR_INIT_NVAR(type); zephir_fast_str_replace(&type, &_1, &_2, _0 TSRMLS_CC); } ZEPHIR_INIT_NVAR(_0); object_init_ex(_0, phalcon_mvc_model_message_ce); ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 296, message, field, type); zephir_check_call_status(); zephir_update_property_array_append(this_ptr, SL("_messages"), _0 TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Replaces placeholders by the values passed */ PHP_METHOD(Phalcon_Translate_Adapter, replacePlaceholders) { HashTable *_1; HashPosition _0; zval *translation_param = NULL, *placeholders = NULL, *key = NULL, *value = NULL, **_2, *_3 = NULL, *_4 = NULL; zval *translation = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &translation_param, &placeholders); if (unlikely(Z_TYPE_P(translation_param) != IS_STRING && Z_TYPE_P(translation_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'translation' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(translation_param) == IS_STRING)) { zephir_get_strval(translation, translation_param); } else { ZEPHIR_INIT_VAR(translation); ZVAL_EMPTY_STRING(translation); } if (!placeholders) { placeholders = ZEPHIR_GLOBAL(global_null); } if (Z_TYPE_P(placeholders) == IS_ARRAY) { if (zephir_fast_count_int(placeholders TSRMLS_CC)) { zephir_is_iterable(placeholders, &_1, &_0, 0, 0, "phalcon/translate/adapter.zep", 108); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HMKEY(key, _1, _0); ZEPHIR_GET_HVALUE(value, _2); ZEPHIR_INIT_NVAR(_3); ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_SVS(_4, "%", key, "%"); zephir_fast_str_replace(&_3, _4, value, translation TSRMLS_CC); zephir_get_strval(translation, _3); } } } RETURN_CTOR(translation); }
/** * Base64 encode a string, safe for URLs. * * @param string $str Data to encode. * * @return string URL-safe base64-encoded string. */ PHP_METHOD(Xpl_Base64Url, encode) { zval *_0, *_2; int ZEPHIR_LAST_CALL_STATUS; zval *data_param = NULL, *_1 = NULL, *_3 = NULL; zval *data = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &data_param); zephir_get_strval(data, data_param); ZEPHIR_INIT_VAR(_0); zephir_create_array(_0, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "+", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "/", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "=", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_VAR(_2); zephir_create_array(_2, 2, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "-", 1); zephir_array_fast_append(_2, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "_", 1); zephir_array_fast_append(_2, _1); ZEPHIR_CALL_FUNCTION(&_3, "base64_encode", NULL, 24, data); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_1); zephir_fast_str_replace(&_1, _0, _2, _3 TSRMLS_CC); RETURN_CCTOR(_1); }
/** * Replaces placeholders from pattern returning a valid PCRE regular expression * * @param string pattern * @return string */ PHP_METHOD(Test_Router_Route, compilePattern) { zval *pattern = NULL, *idPattern, *_0 = NULL, _1 = zval_used_for_init, _2 = zval_used_for_init; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &pattern); ZEPHIR_SEPARATE_PARAM(pattern); if (zephir_memnstr_str(pattern, SL(":"), "test/router/route.zep", 56)) { ZEPHIR_INIT_VAR(idPattern); ZVAL_STRING(idPattern, "/([a-zA-Z0-9\\_\\-]+)", 1); if (zephir_memnstr_str(pattern, SL("/:module"), "test/router/route.zep", 62)) { ZEPHIR_INIT_VAR(_0); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "/:module", 0); zephir_fast_str_replace(_0, &_1, idPattern, pattern); ZEPHIR_CPY_WRT(pattern, _0); } if (zephir_memnstr_str(pattern, SL("/:controller"), "test/router/route.zep", 67)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "/:controller", 0); zephir_fast_str_replace(_0, &_1, idPattern, pattern); ZEPHIR_CPY_WRT(pattern, _0); } if (zephir_memnstr_str(pattern, SL("/:namespace"), "test/router/route.zep", 72)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "/:namespace", 0); zephir_fast_str_replace(_0, &_1, idPattern, pattern); ZEPHIR_CPY_WRT(pattern, _0); } if (zephir_memnstr_str(pattern, SL("/:action"), "test/router/route.zep", 77)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "/:action", 0); zephir_fast_str_replace(_0, &_1, idPattern, pattern); ZEPHIR_CPY_WRT(pattern, _0); } if (zephir_memnstr_str(pattern, SL("/:params"), "test/router/route.zep", 82)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "/:params", 0); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "(/.*)*", 0); zephir_fast_str_replace(_0, &_1, &_2, pattern); ZEPHIR_CPY_WRT(pattern, _0); } if (zephir_memnstr_str(pattern, SL("/:int"), "test/router/route.zep", 87)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "/:int", 0); ZEPHIR_SINIT_NVAR(_2); ZVAL_STRING(&_2, "/([0-9]+)", 0); zephir_fast_str_replace(_0, &_1, &_2, pattern); ZEPHIR_CPY_WRT(pattern, _0); } } if (zephir_memnstr_str(pattern, SL("("), "test/router/route.zep", 93)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } if (zephir_memnstr_str(pattern, SL("["), "test/router/route.zep", 98)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } RETURN_CCTOR(pattern); }
/** * Returns current row in the resultset */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) { zephir_fcall_cache_entry *_8 = NULL, *_11 = NULL; HashTable *_2, *_5; HashPosition _1, _4; int dirtyState, ZEPHIR_LAST_CALL_STATUS; zval *row, *hydrateMode, *alias = NULL, *activeRow = NULL, *type = NULL, *columnTypes, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *_0, **_3, **_6, *_7 = NULL, *_9, *_10 = NULL, _12 = zval_used_for_init, _13 = zval_used_for_init; 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(this_ptr, SL("_activeRow"), row TSRMLS_CC); RETURN_CCTOR(row); } 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); 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); ZEPHIR_OBS_VAR(columnTypes); zephir_read_property_this(&columnTypes, this_ptr, SL("_columnTypes"), PH_NOISY_CC); dirtyState = 0; zephir_is_iterable(columnTypes, &_2, &_1, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 235); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(alias, _2, _1); ZEPHIR_GET_HVALUE(column, _3); 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", 136); return; } ZEPHIR_OBS_NVAR(type); zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 139 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", 145 TSRMLS_CC); ZEPHIR_OBS_NVAR(attributes); zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 146 TSRMLS_CC); ZEPHIR_OBS_NVAR(columnMap); zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 147 TSRMLS_CC); ZEPHIR_INIT_NVAR(rowModel); array_init(rowModel); zephir_is_iterable(attributes, &_5, &_4, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 165); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(attribute, _6); ZEPHIR_OBS_NVAR(columnValue); ZEPHIR_INIT_LNVAR(_7); ZEPHIR_CONCAT_SVSV(_7, "_", source, "_", attribute); zephir_array_fetch(&columnValue, row, _7, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 158 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); } zephir_array_fetch_string(&_9, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC); ZEPHIR_INIT_NVAR(_10); ZVAL_LONG(_10, dirtyState); ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_8, 0, _9, rowModel, columnMap, _10, keepSnapshots); zephir_check_call_status(); break; } ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_11, 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", 194 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", 202 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(_12); ZVAL_STRING(&_12, "_", 0); ZEPHIR_SINIT_NVAR(_13); ZVAL_STRING(&_13, "", 0); ZEPHIR_INIT_NVAR(attribute); zephir_fast_str_replace(&attribute, &_12, &_13, alias 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(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); RETURN_CCTOR(activeRow); }
/** * Checks for annotations in the public methods of the controller */ PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation) { zephir_fcall_cache_entry *_7 = NULL, *_11 = NULL; HashTable *_5, *_9; HashPosition _4, _8; int ZEPHIR_LAST_CALL_STATUS; zend_bool isRoute, _12; zval *module_param = NULL, *namespaceName_param = NULL, *controller_param = NULL, *action_param = NULL, *annotation, *name = NULL, *actionName, *routePrefix, *paths = NULL, *value = NULL, *uri = NULL, *route = NULL, *methods = NULL, *converts = NULL, *param = NULL, *convert = NULL, *conversorParam = NULL, *routeName = NULL, *beforeMatch = NULL, *_0, *_1, _2, *_3 = NULL, **_6, **_10; zval *module = NULL, *namespaceName = NULL, *controller = NULL, *action = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 5, 0, &module_param, &namespaceName_param, &controller_param, &action_param, &annotation); if (unlikely(Z_TYPE_P(module_param) != IS_STRING && Z_TYPE_P(module_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'module' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(module_param) == IS_STRING)) { zephir_get_strval(module, module_param); } else { ZEPHIR_INIT_VAR(module); ZVAL_EMPTY_STRING(module); } if (unlikely(Z_TYPE_P(namespaceName_param) != IS_STRING && Z_TYPE_P(namespaceName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'namespaceName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(namespaceName_param) == IS_STRING)) { zephir_get_strval(namespaceName, namespaceName_param); } else { ZEPHIR_INIT_VAR(namespaceName); ZVAL_EMPTY_STRING(namespaceName); } if (unlikely(Z_TYPE_P(controller_param) != IS_STRING && Z_TYPE_P(controller_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'controller' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(controller_param) == IS_STRING)) { zephir_get_strval(controller, controller_param); } else { ZEPHIR_INIT_VAR(controller); ZVAL_EMPTY_STRING(controller); } if (unlikely(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(action_param) == IS_STRING)) { zephir_get_strval(action, action_param); } else { ZEPHIR_INIT_VAR(action); ZVAL_EMPTY_STRING(action); } isRoute = 0; ZEPHIR_INIT_VAR(methods); ZVAL_NULL(methods); ZEPHIR_CALL_METHOD(&name, annotation, "getname", NULL, 0); zephir_check_call_status(); do { if (ZEPHIR_IS_STRING(name, "Route")) { isRoute = 1; break; } if (ZEPHIR_IS_STRING(name, "Get")) { isRoute = 1; ZEPHIR_INIT_NVAR(methods); ZVAL_STRING(methods, "GET", 1); break; } if (ZEPHIR_IS_STRING(name, "Post")) { isRoute = 1; ZEPHIR_INIT_NVAR(methods); ZVAL_STRING(methods, "POST", 1); break; } if (ZEPHIR_IS_STRING(name, "Put")) { isRoute = 1; ZEPHIR_INIT_NVAR(methods); ZVAL_STRING(methods, "PUT", 1); break; } if (ZEPHIR_IS_STRING(name, "Delete")) { isRoute = 1; ZEPHIR_INIT_NVAR(methods); ZVAL_STRING(methods, "DELETE", 1); break; } if (ZEPHIR_IS_STRING(name, "Options")) { isRoute = 1; ZEPHIR_INIT_NVAR(methods); ZVAL_STRING(methods, "OPTIONS", 1); break; } } while(0); if (isRoute == 1) { ZEPHIR_INIT_VAR(_0); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_actionSuffix"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "", 0); zephir_fast_str_replace(&_0, _1, &_2, action TSRMLS_CC); ZEPHIR_INIT_VAR(actionName); zephir_fast_strtolower(actionName, _0); ZEPHIR_OBS_VAR(routePrefix); zephir_read_property_this(&routePrefix, this_ptr, SL("_routePrefix"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3); ZVAL_STRING(_3, "paths", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&paths, annotation, "getnamedargument", NULL, 0, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); if (Z_TYPE_P(paths) != IS_ARRAY) { ZEPHIR_INIT_NVAR(paths); array_init(paths); } if (!(ZEPHIR_IS_EMPTY(module))) { zephir_array_update_string(&paths, SL("module"), &module, PH_COPY | PH_SEPARATE); } if (!(ZEPHIR_IS_EMPTY(namespaceName))) { zephir_array_update_string(&paths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); } zephir_array_update_string(&paths, SL("controller"), &controller, PH_COPY | PH_SEPARATE); zephir_array_update_string(&paths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 0); ZEPHIR_CALL_METHOD(&value, annotation, "getargument", NULL, 0, _3); zephir_check_call_status(); if (Z_TYPE_P(value) != IS_NULL) { if (!ZEPHIR_IS_STRING(value, "/")) { ZEPHIR_INIT_VAR(uri); ZEPHIR_CONCAT_VV(uri, routePrefix, value); } else { if (Z_TYPE_P(routePrefix) != IS_NULL) { ZEPHIR_CPY_WRT(uri, routePrefix); } else { ZEPHIR_CPY_WRT(uri, value); } } } else { ZEPHIR_INIT_NVAR(uri); ZEPHIR_CONCAT_VV(uri, routePrefix, actionName); } ZEPHIR_CALL_METHOD(&route, this_ptr, "add", NULL, 0, uri, paths); zephir_check_call_status(); if (Z_TYPE_P(methods) != IS_NULL) { ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "methods", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&methods, annotation, "getnamedargument", NULL, 0, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); if (Z_TYPE_P(methods) == IS_ARRAY) { ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); zephir_check_call_status(); } else { if (Z_TYPE_P(methods) == IS_STRING) { ZEPHIR_CALL_METHOD(NULL, route, "via", NULL, 0, methods); zephir_check_call_status(); } } } ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "converts", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); if (Z_TYPE_P(converts) == IS_ARRAY) { zephir_is_iterable(converts, &_5, &_4, 0, 0, "phalcon/mvc/router/annotations.zep", 354); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HMKEY(param, _5, _4); ZEPHIR_GET_HVALUE(convert, _6); ZEPHIR_CALL_METHOD(NULL, route, "convert", &_7, 0, param, convert); zephir_check_call_status(); } } ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "conversors", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&converts, annotation, "getnamedargument", NULL, 0, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); if (Z_TYPE_P(converts) == IS_ARRAY) { zephir_is_iterable(converts, &_9, &_8, 0, 0, "phalcon/mvc/router/annotations.zep", 364); for ( ; zephir_hash_get_current_data_ex(_9, (void**) &_10, &_8) == SUCCESS ; zephir_hash_move_forward_ex(_9, &_8) ) { ZEPHIR_GET_HMKEY(conversorParam, _9, _8); ZEPHIR_GET_HVALUE(convert, _10); ZEPHIR_CALL_METHOD(NULL, route, "convert", &_11, 0, conversorParam, convert); zephir_check_call_status(); } } ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "beforeMatch", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&beforeMatch, annotation, "getnamedargument", NULL, 0, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); _12 = Z_TYPE_P(beforeMatch) == IS_ARRAY; if (!(_12)) { _12 = Z_TYPE_P(beforeMatch) == IS_STRING; } if (_12) { ZEPHIR_CALL_METHOD(NULL, route, "beforematch", NULL, 0, beforeMatch); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "name", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&routeName, annotation, "getnamedargument", NULL, 0, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); if (Z_TYPE_P(routeName) == IS_STRING) { ZEPHIR_CALL_METHOD(NULL, route, "setname", NULL, 0, routeName); zephir_check_call_status(); } RETURN_MM_BOOL(1); } ZEPHIR_MM_RESTORE(); }
/** * Reconfigure the route adding a new pattern and a set of paths * * @param string pattern * @param array paths */ PHP_METHOD(Phalcon_Cli_Router_Route, reConfigure) { int ZEPHIR_LAST_CALL_STATUS, _0$$4; zval *pattern_param = NULL, *paths = NULL, *moduleName = NULL, *taskName = NULL, *actionName = NULL, *parts = NULL, *routePaths = NULL, *realClassName = NULL, *namespaceName = NULL, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_1$$9, *_2$$18, *_3$$18, *_4$$21, *_5$$21, _6$$21; zval *pattern = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &pattern_param, &paths); if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { zephir_get_strval(pattern, pattern_param); } else { ZEPHIR_INIT_VAR(pattern); ZVAL_EMPTY_STRING(pattern); } if (!paths) { paths = ZEPHIR_GLOBAL(global_null); } if (Z_TYPE_P(paths) != IS_NULL) { if (Z_TYPE_P(paths) == IS_STRING) { ZEPHIR_INIT_VAR(moduleName); ZVAL_NULL(moduleName); ZEPHIR_INIT_VAR(taskName); ZVAL_NULL(taskName); ZEPHIR_INIT_VAR(actionName); ZVAL_NULL(actionName); ZEPHIR_INIT_VAR(parts); zephir_fast_explode_str(parts, SL("::"), paths, LONG_MAX TSRMLS_CC); do { _0$$4 = zephir_fast_count_int(parts TSRMLS_CC); if (_0$$4 == 3) { ZEPHIR_OBS_NVAR(moduleName); zephir_array_fetch_long(&moduleName, parts, 0, PH_NOISY, "phalcon/cli/router/route.zep", 318 TSRMLS_CC); ZEPHIR_OBS_NVAR(taskName); zephir_array_fetch_long(&taskName, parts, 1, PH_NOISY, "phalcon/cli/router/route.zep", 319 TSRMLS_CC); ZEPHIR_OBS_NVAR(actionName); zephir_array_fetch_long(&actionName, parts, 2, PH_NOISY, "phalcon/cli/router/route.zep", 320 TSRMLS_CC); break; } if (_0$$4 == 2) { ZEPHIR_OBS_NVAR(taskName); zephir_array_fetch_long(&taskName, parts, 0, PH_NOISY, "phalcon/cli/router/route.zep", 324 TSRMLS_CC); ZEPHIR_OBS_NVAR(actionName); zephir_array_fetch_long(&actionName, parts, 1, PH_NOISY, "phalcon/cli/router/route.zep", 325 TSRMLS_CC); break; } if (_0$$4 == 1) { ZEPHIR_OBS_NVAR(taskName); zephir_array_fetch_long(&taskName, parts, 0, PH_NOISY, "phalcon/cli/router/route.zep", 329 TSRMLS_CC); break; } } while(0); ZEPHIR_INIT_VAR(routePaths); array_init(routePaths); if (Z_TYPE_P(moduleName) != IS_NULL) { zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(taskName) != IS_NULL) { if (zephir_memnstr_str(taskName, SL("\\"), "phalcon/cli/router/route.zep", 344)) { ZEPHIR_INIT_VAR(realClassName); zephir_get_class_ns(realClassName, taskName, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(namespaceName); zephir_get_ns_class(namespaceName, taskName, 0 TSRMLS_CC); if (zephir_is_true(namespaceName)) { zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE); } } else { ZEPHIR_CPY_WRT(realClassName, taskName); } ZEPHIR_INIT_VAR(_1$$9); zephir_uncamelize(_1$$9, realClassName, NULL ); zephir_array_update_string(&routePaths, SL("task"), &_1$$9, PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(actionName) != IS_NULL) { zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE); } } else { ZEPHIR_CPY_WRT(routePaths, paths); } } else { ZEPHIR_INIT_NVAR(routePaths); array_init(routePaths); } if (Z_TYPE_P(routePaths) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "The route contains invalid paths", "phalcon/cli/router/route.zep", 376); return; } if (!(zephir_start_with_str(pattern, SL("#")))) { if (zephir_memnstr_str(pattern, SL("{"), "phalcon/cli/router/route.zep", 384)) { ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern); zephir_check_call_status(); ZEPHIR_OBS_VAR(pcrePattern); zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "phalcon/cli/router/route.zep", 389 TSRMLS_CC); ZEPHIR_INIT_VAR(_2$$18); zephir_array_fetch_long(&_3$$18, extracted, 1, PH_NOISY | PH_READONLY, "phalcon/cli/router/route.zep", 390 TSRMLS_CC); zephir_fast_array_merge(_2$$18, &(routePaths), &(_3$$18) TSRMLS_CC); ZEPHIR_CPY_WRT(routePaths, _2$$18); } else { ZEPHIR_CPY_WRT(pcrePattern, pattern); } ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, pcrePattern); zephir_check_call_status(); } else { if (zephir_memnstr_str(pattern, SL(":delimiter"), "phalcon/cli/router/route.zep", 401)) { ZEPHIR_INIT_VAR(_4$$21); _5$$21 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_6$$21); ZVAL_STRING(&_6$$21, ":delimiter", 0); zephir_fast_str_replace(&_4$$21, &_6$$21, _5$$21, pattern TSRMLS_CC); zephir_get_strval(pattern, _4$$21); } ZEPHIR_CPY_WRT(compiledPattern, pattern); } zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Replaces placeholders from pattern returning a valid PCRE regular expression */ PHP_METHOD(Phalcon_Cli_Router_Route, compilePattern) { zval *pattern_param = NULL, *idPattern = NULL, *part = NULL, *_0$$3, *_4$$3, *_6$$3, *_8$$3, *_10$$3, *_12$$3, *_16$$3, *_1$$4, *_2$$4, _3$$4, *_5$$5, *_7$$6, *_9$$7, *_11$$8, *_13$$9, *_14$$9, *_15$$9, *_17$$10, *_18$$10, *_19$$10; zval *pattern = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &pattern_param); if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { zephir_get_strval(pattern, pattern_param); } else { ZEPHIR_INIT_VAR(pattern); ZVAL_EMPTY_STRING(pattern); } if (zephir_memnstr_str(pattern, SL(":"), "phalcon/cli/router/route.zep", 94)) { _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_VAR(idPattern); ZEPHIR_CONCAT_VS(idPattern, _0$$3, "([a-zA-Z0-9\\_\\-]+)"); if (zephir_memnstr_str(pattern, SL(":delimiter"), "phalcon/cli/router/route.zep", 100)) { ZEPHIR_INIT_VAR(_1$$4); _2$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_3$$4); ZVAL_STRING(&_3$$4, ":delimiter", 0); zephir_fast_str_replace(&_1$$4, &_3$$4, _2$$4, pattern TSRMLS_CC); zephir_get_strval(pattern, _1$$4); } _4$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_VAR(part); ZEPHIR_CONCAT_VS(part, _4$$3, ":module"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 106)) { ZEPHIR_INIT_VAR(_5$$5); zephir_fast_str_replace(&_5$$5, part, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _5$$5); } _6$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(part); ZEPHIR_CONCAT_VS(part, _6$$3, ":task"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 112)) { ZEPHIR_INIT_VAR(_7$$6); zephir_fast_str_replace(&_7$$6, part, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _7$$6); } _8$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(part); ZEPHIR_CONCAT_VS(part, _8$$3, ":namespace"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 118)) { ZEPHIR_INIT_VAR(_9$$7); zephir_fast_str_replace(&_9$$7, part, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _9$$7); } _10$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(part); ZEPHIR_CONCAT_VS(part, _10$$3, ":action"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 124)) { ZEPHIR_INIT_VAR(_11$$8); zephir_fast_str_replace(&_11$$8, part, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _11$$8); } _12$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(part); ZEPHIR_CONCAT_VS(part, _12$$3, ":params"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 130)) { ZEPHIR_INIT_VAR(_13$$9); _14$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_15$$9); ZEPHIR_CONCAT_SVS(_15$$9, "(", _14$$9, ".*)*"); zephir_fast_str_replace(&_13$$9, part, _15$$9, pattern TSRMLS_CC); zephir_get_strval(pattern, _13$$9); } _16$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(part); ZEPHIR_CONCAT_VS(part, _16$$3, ":int"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 136)) { ZEPHIR_INIT_VAR(_17$$10); _18$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_19$$10); ZEPHIR_CONCAT_VS(_19$$10, _18$$10, "([0-9]+)"); zephir_fast_str_replace(&_17$$10, part, _19$$10, pattern TSRMLS_CC); zephir_get_strval(pattern, _17$$10); } } if (zephir_memnstr_str(pattern, SL("("), "phalcon/cli/router/route.zep", 142)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } if (zephir_memnstr_str(pattern, SL("["), "phalcon/cli/router/route.zep", 147)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } RETURN_CTOR(pattern); }
/** * Shows a backtrace item */ PHP_METHOD(Phalcon_Debug, showTraceItem) { zend_bool _40$$24; HashTable *_18$$14; HashPosition _17$$14; zval *_1, *_26$$16 = NULL; zephir_fcall_cache_entry *_21 = NULL, *_47 = NULL; zval *trace = NULL; zval *n_param = NULL, *trace_param = NULL, *className = NULL, *prepareInternalClass = NULL, *preparedFunctionName = NULL, *html = NULL, *classReflection = NULL, *prepareUriClass = NULL, *functionName = NULL, *functionReflection = NULL, *traceArgs = NULL, *arguments = NULL, *argument = NULL, *filez = NULL, *line = NULL, *showFiles = NULL, *lines = NULL, *numberLines = NULL, *showFileFragment = NULL, *beforeLine = NULL, *afterLine = NULL, *lastLine = NULL, *linePosition = NULL, *currentLine = NULL, *classNameWithLink = NULL, *functionNameWithLink = NULL, _0, *_16, *_2$$3, *_3$$3, _4$$3, *_11$$3, *_12$$3, _5$$4, _6$$4, *_7$$5 = NULL, *_8$$6, _9$$6, _10$$6, *_13$$10 = NULL, _14$$11, _15$$11, **_19$$14, *_23$$14, *_24$$14, *_20$$15 = NULL, *_22$$15 = NULL, *_25$$16, *_27$$16, _28$$18, _29$$18, *_30$$18, _31$$23, *_32$$23, *_33$$26 = NULL, *_34$$26 = NULL, *_35$$26 = NULL, _36$$26 = zval_used_for_init, *_37$$27 = NULL, _38$$27 = zval_used_for_init, _39$$27 = zval_used_for_init, *_41$$29 = NULL, _42$$29 = zval_used_for_init, _43$$29 = zval_used_for_init, _44$$29 = zval_used_for_init, _45$$29 = zval_used_for_init, *_46$$29 = NULL; int n, ZEPHIR_LAST_CALL_STATUS, firstLine = 0, i = 0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &n_param, &trace_param); n = zephir_get_intval(n_param); trace = trace_param; ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, n); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "<tr><td align=\"right\" valign=\"top\" class=\"error-number\">#", &_0, "</td><td>"); ZEPHIR_CPY_WRT(html, _1); ZEPHIR_OBS_VAR(className); if (zephir_array_isset_string_fetch(&className, trace, SS("class"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_2$$3); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "/^Phalcon/", 0); zephir_preg_match(_3$$3, &_4$$3, className, _2$$3, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_3$$3)) { ZEPHIR_SINIT_VAR(_5$$4); ZVAL_STRING(&_5$$4, "\\", 0); ZEPHIR_SINIT_VAR(_6$$4); ZVAL_STRING(&_6$$4, "/", 0); ZEPHIR_INIT_VAR(prepareUriClass); zephir_fast_str_replace(&prepareUriClass, &_5$$4, &_6$$4, className TSRMLS_CC); ZEPHIR_INIT_VAR(classNameWithLink); ZEPHIR_CONCAT_SVSVS(classNameWithLink, "<a target=\"_new\" href=\"//api.phalconphp.com/class/", prepareUriClass, ".html\">", className, "</a>"); } else { ZEPHIR_INIT_VAR(classReflection); object_init_ex(classReflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, classReflection, "__construct", NULL, 91, className); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7$$5, classReflection, "isinternal", NULL, 163); zephir_check_call_status(); if (zephir_is_true(_7$$5)) { ZEPHIR_INIT_VAR(_8$$6); zephir_fast_strtolower(_8$$6, className); ZEPHIR_SINIT_VAR(_9$$6); ZVAL_STRING(&_9$$6, "_", 0); ZEPHIR_SINIT_VAR(_10$$6); ZVAL_STRING(&_10$$6, "-", 0); ZEPHIR_INIT_VAR(prepareInternalClass); zephir_fast_str_replace(&prepareInternalClass, &_9$$6, &_10$$6, _8$$6 TSRMLS_CC); ZEPHIR_INIT_NVAR(classNameWithLink); ZEPHIR_CONCAT_SVSVS(classNameWithLink, "<a target=\"_new\" href=\"http://php.net/manual/en/class.", prepareInternalClass, ".php\">", className, "</a>"); } else { ZEPHIR_CPY_WRT(classNameWithLink, className); } } ZEPHIR_INIT_VAR(_11$$3); ZEPHIR_CONCAT_SVS(_11$$3, "<span class=\"error-class\">", classNameWithLink, "</span>"); zephir_concat_self(&html, _11$$3 TSRMLS_CC); zephir_array_fetch_string(&_12$$3, trace, SL("type"), PH_NOISY | PH_READONLY, "phalcon/debug.zep", 386 TSRMLS_CC); zephir_concat_self(&html, _12$$3 TSRMLS_CC); } ZEPHIR_OBS_VAR(functionName); zephir_array_fetch_string(&functionName, trace, SL("function"), PH_NOISY, "phalcon/debug.zep", 392 TSRMLS_CC); if (zephir_array_isset_string(trace, SS("class"))) { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } else { if ((zephir_function_exists(functionName TSRMLS_CC) == SUCCESS)) { ZEPHIR_INIT_VAR(functionReflection); object_init_ex(functionReflection, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, functionReflection, "__construct", NULL, 82, functionName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_13$$10, functionReflection, "isinternal", NULL, 164); zephir_check_call_status(); if (zephir_is_true(_13$$10)) { ZEPHIR_SINIT_VAR(_14$$11); ZVAL_STRING(&_14$$11, "_", 0); ZEPHIR_SINIT_VAR(_15$$11); ZVAL_STRING(&_15$$11, "-", 0); ZEPHIR_INIT_VAR(preparedFunctionName); zephir_fast_str_replace(&preparedFunctionName, &_14$$11, &_15$$11, functionName TSRMLS_CC); ZEPHIR_INIT_NVAR(functionNameWithLink); ZEPHIR_CONCAT_SVSVS(functionNameWithLink, "<a target=\"_new\" href=\"http://php.net/manual/en/function.", preparedFunctionName, ".php\">", functionName, "</a>"); } else { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } } else { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } } ZEPHIR_INIT_VAR(_16); ZEPHIR_CONCAT_SVS(_16, "<span class=\"error-function\">", functionNameWithLink, "</span>"); zephir_concat_self(&html, _16 TSRMLS_CC); ZEPHIR_OBS_VAR(traceArgs); if (zephir_array_isset_string_fetch(&traceArgs, trace, SS("args"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(arguments); array_init(arguments); zephir_is_iterable(traceArgs, &_18$$14, &_17$$14, 0, 0, "phalcon/debug.zep", 441); for ( ; zend_hash_get_current_data_ex(_18$$14, (void**) &_19$$14, &_17$$14) == SUCCESS ; zend_hash_move_forward_ex(_18$$14, &_17$$14) ) { ZEPHIR_GET_HVALUE(argument, _19$$14); ZEPHIR_CALL_METHOD(&_20$$15, this_ptr, "_getvardump", &_21, 0, argument); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_22$$15); ZEPHIR_CONCAT_SVS(_22$$15, "<span class=\"error-parameter\">", _20$$15, "</span>"); zephir_array_append(&arguments, _22$$15, PH_SEPARATE, "phalcon/debug.zep", 435); } ZEPHIR_INIT_VAR(_23$$14); zephir_fast_join_str(_23$$14, SL(", "), arguments TSRMLS_CC); ZEPHIR_INIT_VAR(_24$$14); ZEPHIR_CONCAT_SVS(_24$$14, "(", _23$$14, ")"); zephir_concat_self(&html, _24$$14 TSRMLS_CC); } ZEPHIR_OBS_VAR(filez); if (zephir_array_isset_string_fetch(&filez, trace, SS("file"), 0 TSRMLS_CC)) { ZEPHIR_OBS_VAR(_25$$16); zephir_array_fetch_string(&_25$$16, trace, SL("line"), PH_NOISY, "phalcon/debug.zep", 449 TSRMLS_CC); zephir_get_strval(_26$$16, _25$$16); ZEPHIR_CPY_WRT(line, _26$$16); ZEPHIR_INIT_VAR(_27$$16); ZEPHIR_CONCAT_SVSVS(_27$$16, "<br/><div class=\"error-file\">", filez, " (", line, ")</div>"); zephir_concat_self(&html, _27$$16 TSRMLS_CC); ZEPHIR_OBS_VAR(showFiles); zephir_read_property_this(&showFiles, this_ptr, SL("_showFiles"), PH_NOISY_CC); if (zephir_is_true(showFiles)) { ZEPHIR_CALL_FUNCTION(&lines, "file", NULL, 165, filez); zephir_check_call_status(); ZEPHIR_INIT_VAR(numberLines); ZVAL_LONG(numberLines, zephir_fast_count_int(lines TSRMLS_CC)); ZEPHIR_OBS_VAR(showFileFragment); zephir_read_property_this(&showFileFragment, this_ptr, SL("_showFileFragment"), PH_NOISY_CC); if (zephir_is_true(showFileFragment)) { ZEPHIR_INIT_VAR(beforeLine); ZVAL_LONG(beforeLine, (zephir_get_numberval(line) - 7)); if (ZEPHIR_LT_LONG(beforeLine, 1)) { firstLine = 1; } else { firstLine = zephir_get_numberval(beforeLine); } ZEPHIR_INIT_VAR(afterLine); ZVAL_LONG(afterLine, (zephir_get_numberval(line) + 5)); if (ZEPHIR_GT(afterLine, numberLines)) { ZEPHIR_CPY_WRT(lastLine, numberLines); } else { ZEPHIR_CPY_WRT(lastLine, afterLine); } ZEPHIR_SINIT_VAR(_28$$18); ZVAL_LONG(&_28$$18, firstLine); ZEPHIR_SINIT_VAR(_29$$18); ZVAL_LONG(&_29$$18, firstLine); ZEPHIR_INIT_VAR(_30$$18); ZEPHIR_CONCAT_SVSVSVS(_30$$18, "<pre class=\"prettyprint highlight:", &_28$$18, ":", line, " linenums:", &_29$$18, "\">"); zephir_concat_self(&html, _30$$18 TSRMLS_CC); } else { firstLine = 1; ZEPHIR_CPY_WRT(lastLine, numberLines); ZEPHIR_SINIT_VAR(_31$$23); ZVAL_LONG(&_31$$23, firstLine); ZEPHIR_INIT_VAR(_32$$23); ZEPHIR_CONCAT_SVSVS(_32$$23, "<pre class=\"prettyprint highlight:", &_31$$23, ":", line, " linenums error-scroll\">"); zephir_concat_self(&html, _32$$23 TSRMLS_CC); } i = firstLine; while (1) { if (!(ZEPHIR_GE_LONG(lastLine, i))) { break; } ZEPHIR_INIT_NVAR(linePosition); ZVAL_LONG(linePosition, (i - 1)); ZEPHIR_OBS_NVAR(currentLine); zephir_array_fetch(¤tLine, lines, linePosition, PH_NOISY, "phalcon/debug.zep", 522 TSRMLS_CC); if (zephir_is_true(showFileFragment)) { if (i == firstLine) { ZEPHIR_INIT_NVAR(_33$$26); ZEPHIR_INIT_NVAR(_34$$26); ZEPHIR_INIT_NVAR(_35$$26); zephir_fast_trim(_35$$26, currentLine, NULL , ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_SINIT_NVAR(_36$$26); ZVAL_STRING(&_36$$26, "#\\*\\/#", 0); zephir_preg_match(_34$$26, &_36$$26, _35$$26, _33$$26, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_34$$26)) { ZEPHIR_INIT_NVAR(_37$$27); ZEPHIR_SINIT_NVAR(_38$$27); ZVAL_STRING(&_38$$27, "* /", 0); ZEPHIR_SINIT_NVAR(_39$$27); ZVAL_STRING(&_39$$27, " ", 0); zephir_fast_str_replace(&_37$$27, &_38$$27, &_39$$27, currentLine TSRMLS_CC); ZEPHIR_CPY_WRT(currentLine, _37$$27); } } } _40$$24 = ZEPHIR_IS_STRING(currentLine, "\n"); if (!(_40$$24)) { _40$$24 = ZEPHIR_IS_STRING(currentLine, "\r\n"); } if (_40$$24) { zephir_concat_self_str(&html, SL(" \n") TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(_41$$29); ZEPHIR_SINIT_NVAR(_42$$29); ZVAL_STRING(&_42$$29, "\t", 0); ZEPHIR_SINIT_NVAR(_43$$29); ZVAL_STRING(&_43$$29, " ", 0); zephir_fast_str_replace(&_41$$29, &_42$$29, &_43$$29, currentLine TSRMLS_CC); ZEPHIR_SINIT_NVAR(_44$$29); ZVAL_LONG(&_44$$29, 2); ZEPHIR_SINIT_NVAR(_45$$29); ZVAL_STRING(&_45$$29, "UTF-8", 0); ZEPHIR_CALL_FUNCTION(&_46$$29, "htmlentities", &_47, 158, _41$$29, &_44$$29, &_45$$29); zephir_check_call_status(); zephir_concat_self(&html, _46$$29 TSRMLS_CC); } i++; } zephir_concat_self_str(&html, SL("</pre>") TSRMLS_CC); } } zephir_concat_self_str(&html, SL("</td></tr>") TSRMLS_CC); RETURN_CCTOR(html); }
/** * Replaces placeholders from pattern returning a valid PCRE regular expression */ PHP_METHOD(Phalcon_Mvc_Router_Route, compilePattern) { zval *pattern_param = NULL, *idPattern = NULL, *_0$$4, _1$$4, *_2$$5, _3$$5, *_4$$6, _5$$6, *_6$$7, _7$$7, *_8$$8, _9$$8, _10$$8, *_11$$9, _12$$9, _13$$9; zval *pattern = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &pattern_param); if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { zephir_get_strval(pattern, pattern_param); } else { ZEPHIR_INIT_VAR(pattern); ZVAL_EMPTY_STRING(pattern); } if (zephir_memnstr_str(pattern, SL(":"), "phalcon/mvc/router/route.zep", 87)) { ZEPHIR_INIT_VAR(idPattern); ZVAL_STRING(idPattern, "/([a-zA-Z0-9\\_\\-]+)", 1); if (zephir_memnstr_str(pattern, SL("/:module"), "phalcon/mvc/router/route.zep", 93)) { ZEPHIR_INIT_VAR(_0$$4); ZEPHIR_SINIT_VAR(_1$$4); ZVAL_STRING(&_1$$4, "/:module", 0); zephir_fast_str_replace(&_0$$4, &_1$$4, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _0$$4); } if (zephir_memnstr_str(pattern, SL("/:controller"), "phalcon/mvc/router/route.zep", 98)) { ZEPHIR_INIT_VAR(_2$$5); ZEPHIR_SINIT_VAR(_3$$5); ZVAL_STRING(&_3$$5, "/:controller", 0); zephir_fast_str_replace(&_2$$5, &_3$$5, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _2$$5); } if (zephir_memnstr_str(pattern, SL("/:namespace"), "phalcon/mvc/router/route.zep", 103)) { ZEPHIR_INIT_VAR(_4$$6); ZEPHIR_SINIT_VAR(_5$$6); ZVAL_STRING(&_5$$6, "/:namespace", 0); zephir_fast_str_replace(&_4$$6, &_5$$6, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _4$$6); } if (zephir_memnstr_str(pattern, SL("/:action"), "phalcon/mvc/router/route.zep", 108)) { ZEPHIR_INIT_VAR(_6$$7); ZEPHIR_SINIT_VAR(_7$$7); ZVAL_STRING(&_7$$7, "/:action", 0); zephir_fast_str_replace(&_6$$7, &_7$$7, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _6$$7); } if (zephir_memnstr_str(pattern, SL("/:params"), "phalcon/mvc/router/route.zep", 113)) { ZEPHIR_INIT_VAR(_8$$8); ZEPHIR_SINIT_VAR(_9$$8); ZVAL_STRING(&_9$$8, "/:params", 0); ZEPHIR_SINIT_VAR(_10$$8); ZVAL_STRING(&_10$$8, "(/.*)*", 0); zephir_fast_str_replace(&_8$$8, &_9$$8, &_10$$8, pattern TSRMLS_CC); zephir_get_strval(pattern, _8$$8); } if (zephir_memnstr_str(pattern, SL("/:int"), "phalcon/mvc/router/route.zep", 118)) { ZEPHIR_INIT_VAR(_11$$9); ZEPHIR_SINIT_VAR(_12$$9); ZVAL_STRING(&_12$$9, "/:int", 0); ZEPHIR_SINIT_VAR(_13$$9); ZVAL_STRING(&_13$$9, "/([0-9]+)", 0); zephir_fast_str_replace(&_11$$9, &_12$$9, &_13$$9, pattern TSRMLS_CC); zephir_get_strval(pattern, _11$$9); } } if (zephir_memnstr_str(pattern, SL("("), "phalcon/mvc/router/route.zep", 124)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } if (zephir_memnstr_str(pattern, SL("["), "phalcon/mvc/router/route.zep", 129)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } RETURN_CTOR(pattern); }
/** * Internal sanitize wrapper to filter_var */ PHP_METHOD(Phalcon_Filter, _sanitize) { zephir_fcall_cache_entry *_8 = NULL; zephir_nts_static zephir_fcall_cache_entry *_7 = NULL, *_9 = NULL, *_11 = NULL, *_12 = NULL, *_14 = NULL; zval *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *filter = NULL, *_13; zval *value, *filter_param = NULL, *filterObject, *_0, *_2 = NULL, _3 = zval_used_for_init, _4, _5, *_6 = NULL, *_10; 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)) { if (zephir_instance_of_ev(filterObject, zend_ce_closure TSRMLS_CC)) { ZEPHIR_INIT_VAR(_1); zephir_create_array(_1, 1, 0 TSRMLS_CC); zephir_array_fast_append(_1, value); ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, filterObject, _1); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_RETURN_CALL_METHOD(filterObject, "filter", NULL, value); zephir_check_call_status(); RETURN_MM(); } do { if (ZEPHIR_IS_STRING(filter, "email")) { ZEPHIR_INIT_VAR(_2); ZEPHIR_SINIT_VAR(_3); ZVAL_STRING(&_3, "'", 0); ZEPHIR_SINIT_VAR(_4); ZVAL_STRING(&_4, "", 0); zephir_fast_str_replace(&_2, &_3, &_4, value TSRMLS_CC); ZEPHIR_SINIT_VAR(_5); ZVAL_STRING(&_5, "FILTER_SANITIZE_EMAIL", 0); ZEPHIR_CALL_FUNCTION(&_6, "constant", &_7, &_5); zephir_check_call_status(); ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_8, _2, _6); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "int")) { ZEPHIR_SINIT_NVAR(_3); ZVAL_LONG(&_3, 519); ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_8, value, &_3); 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_NVAR(_3); ZVAL_LONG(&_3, zephir_get_intval(value)); ZEPHIR_RETURN_CALL_FUNCTION("abs", &_9, &_3); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "string")) { ZEPHIR_SINIT_NVAR(_3); ZVAL_LONG(&_3, 513); ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_8, value, &_3); zephir_check_call_status(); RETURN_MM(); } if (ZEPHIR_IS_STRING(filter, "float")) { ZEPHIR_INIT_NVAR(_1); zephir_create_array(_1, 1, 0 TSRMLS_CC); add_assoc_long_ex(_1, SS("flags"), 4096); ZEPHIR_SINIT_NVAR(_3); ZVAL_LONG(&_3, 520); ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_8, value, &_3, _1); 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_NVAR(_2); ZVAL_STRING(_2, "/[^A-Za-z0-9]/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_10); ZVAL_STRING(_10, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", &_11, _2, _10, value); zephir_check_temp_parameter(_2); zephir_check_temp_parameter(_10); 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", &_12, 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, 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, value); zephir_check_call_status(); RETURN_MM(); } zephir_fast_strtoupper(return_value, value); RETURN_MM(); } ZEPHIR_INIT_NVAR(_2); object_init_ex(_2, phalcon_filter_exception_ce); ZEPHIR_INIT_VAR(_13); ZEPHIR_CONCAT_SVS(_13, "Sanitize filter '", filter, "' is not supported"); ZEPHIR_CALL_METHOD(NULL, _2, "__construct", &_14, _13); zephir_check_call_status(); zephir_throw_exception_debug(_2, "phalcon/filter.zep", 214 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } while(0); ZEPHIR_MM_RESTORE(); }
/** * Shows a backtrace item */ PHP_METHOD(Phalcon_Debug, showTraceItem) { zephir_fcall_cache_entry *_16 = NULL; HashTable *_14; HashPosition _13; zephir_nts_static zephir_fcall_cache_entry *_4 = NULL, *_6 = NULL, *_8 = NULL, *_11 = NULL, *_12 = NULL, *_19 = NULL, *_24 = NULL; zval *_1, *_18 = NULL; zval *trace = NULL; zval *n_param = NULL, *trace_param = NULL, *space, *twoSpaces, *underscore, *minus, *className, *namespaceSeparator, *prepareInternalClass, *preparedFunctionName, *html = NULL, *classReflection, *prepareUriClass, *functionName, *functionReflection, *traceArgs, *arguments, *argument = NULL, *filez, *line = NULL, *showFiles, *lines = NULL, *numberLines, *showFileFragment, *beforeLine, *afterLine, *lastLine = NULL, *commentPattern, *utf8, *entCompat, *tab, *comment, linePosition = zval_used_for_init, *currentLine = NULL, _0, *_2 = NULL, *_3 = NULL, *_5 = NULL, *_7 = NULL, *_9 = NULL, *_10, **_15, *_17, _20 = zval_used_for_init, _21, *_22, *_23 = NULL; int n, firstLine, i, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &n_param, &trace_param); n = zephir_get_intval(n_param); trace = trace_param; ZEPHIR_INIT_VAR(space); ZVAL_STRING(space, " ", 1); ZEPHIR_INIT_VAR(twoSpaces); ZVAL_STRING(twoSpaces, " ", 1); ZEPHIR_INIT_VAR(underscore); ZVAL_STRING(underscore, "_", 1); ZEPHIR_INIT_VAR(minus); ZVAL_STRING(minus, "-", 1); ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, n); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "<tr><td align=\"right\" valign=\"top\" class=\"error-number\">#", &_0, "</td><td>"); ZEPHIR_CPY_WRT(html, _1); if (zephir_array_isset_string(trace, SS("class"))) { ZEPHIR_OBS_VAR(className); zephir_array_fetch_string(&className, trace, SL("class"), PH_NOISY, "phalcon/debug.zep", 355 TSRMLS_CC); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "/^Phalcon/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_3, "preg_match", &_4, _2, className); zephir_check_temp_parameter(_2); zephir_check_call_status(); if (zephir_is_true(_3)) { ZEPHIR_INIT_VAR(namespaceSeparator); ZVAL_STRING(namespaceSeparator, "\\", 1); ZEPHIR_INIT_VAR(prepareUriClass); zephir_fast_str_replace(&prepareUriClass, namespaceSeparator, underscore, className TSRMLS_CC); ZEPHIR_INIT_VAR(_5); ZEPHIR_CONCAT_SVSVS(_5, "<span class=\"error-class\"><a target=\"_new\" href=\"http://docs.phalconphp.com/en/latest/api/", prepareUriClass, ".html\">", className, "</a></span>"); zephir_concat_self(&html, _5 TSRMLS_CC); } else { ZEPHIR_INIT_VAR(classReflection); object_init_ex(classReflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, classReflection, "__construct", &_6, className); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7, classReflection, "isinternal", &_8); zephir_check_call_status(); if (zephir_is_true(_7)) { ZEPHIR_INIT_VAR(prepareInternalClass); ZEPHIR_INIT_NVAR(_2); zephir_fast_strtolower(_2, className); zephir_fast_str_replace(&prepareInternalClass, underscore, minus, _2 TSRMLS_CC); ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SVSVS(_5, "<span class=\"error-class\"><a target=\"_new\" href=\"http://php.net/manual/en/class.", prepareInternalClass, ".php\">", className, "</a></span>"); zephir_concat_self(&html, _5 TSRMLS_CC); } else { ZEPHIR_INIT_VAR(_9); ZEPHIR_CONCAT_SVS(_9, "<span class=\"error-class\">", className, "</span>"); zephir_concat_self(&html, _9 TSRMLS_CC); } } zephir_array_fetch_string(&_10, trace, SL("type"), PH_NOISY | PH_READONLY, "phalcon/debug.zep", 396 TSRMLS_CC); zephir_concat_self(&html, _10 TSRMLS_CC); } ZEPHIR_OBS_VAR(functionName); zephir_array_fetch_string(&functionName, trace, SL("function"), PH_NOISY, "phalcon/debug.zep", 402 TSRMLS_CC); if (zephir_array_isset_string(trace, SS("class"))) { ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SVS(_5, "<span class=\"error-function\">", functionName, "</span>"); zephir_concat_self(&html, _5 TSRMLS_CC); } else { if ((zephir_function_exists(functionName TSRMLS_CC) == SUCCESS)) { ZEPHIR_INIT_VAR(functionReflection); object_init_ex(functionReflection, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, functionReflection, "__construct", &_11, functionName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_3, functionReflection, "isinternal", &_12); zephir_check_call_status(); if (zephir_is_true(_3)) { ZEPHIR_INIT_VAR(preparedFunctionName); zephir_fast_str_replace(&preparedFunctionName, underscore, minus, functionName TSRMLS_CC); ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVSVS(_9, "<span class=\"error-function\"><a target=\"_new\" href=\"http://php.net/manual/en/function.", preparedFunctionName, ".php\">", functionName, "</a></span>"); zephir_concat_self(&html, _9 TSRMLS_CC); } else { ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVS(_9, "<span class=\"error-function\">", functionName, "</span>"); zephir_concat_self(&html, _9 TSRMLS_CC); } } else { ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SVS(_5, "<span class=\"error-function\">", functionName, "</span>"); zephir_concat_self(&html, _5 TSRMLS_CC); } } if (zephir_array_isset_string(trace, SS("args"))) { ZEPHIR_OBS_VAR(traceArgs); zephir_array_fetch_string(&traceArgs, trace, SL("args"), PH_NOISY, "phalcon/debug.zep", 436 TSRMLS_CC); if (zephir_fast_count_int(traceArgs TSRMLS_CC)) { ZEPHIR_INIT_VAR(arguments); array_init(arguments); zephir_is_iterable(traceArgs, &_14, &_13, 0, 0, "phalcon/debug.zep", 451); for ( ; zephir_hash_get_current_data_ex(_14, (void**) &_15, &_13) == SUCCESS ; zephir_hash_move_forward_ex(_14, &_13) ) { ZEPHIR_GET_HVALUE(argument, _15); ZEPHIR_CALL_METHOD(&_3, this_ptr, "_getvardump", &_16, argument); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SVS(_5, "<span class=\"error-parameter\">", _3, "</span>"); zephir_array_append(&arguments, _5, PH_SEPARATE, "phalcon/debug.zep", 445); } ZEPHIR_INIT_NVAR(_2); zephir_fast_join_str(_2, SL(", "), arguments TSRMLS_CC); ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVS(_9, "(", _2, ")"); zephir_concat_self(&html, _9 TSRMLS_CC); } else { zephir_concat_self_str(&html, SL("()") TSRMLS_CC); } } ZEPHIR_OBS_VAR(filez); if (zephir_array_isset_string_fetch(&filez, trace, SS("file"), 0 TSRMLS_CC)) { ZEPHIR_OBS_VAR(_17); zephir_array_fetch_string(&_17, trace, SL("line"), PH_NOISY, "phalcon/debug.zep", 462 TSRMLS_CC); zephir_get_strval(_18, _17); ZEPHIR_CPY_WRT(line, _18); ZEPHIR_INIT_LNVAR(_5); ZEPHIR_CONCAT_SVSVS(_5, "<br/><div class=\"error-file\">", filez, " (", line, ")</div>"); zephir_concat_self(&html, _5 TSRMLS_CC); ZEPHIR_OBS_VAR(showFiles); zephir_read_property_this(&showFiles, this_ptr, SL("_showFiles"), PH_NOISY_CC); if (zephir_is_true(showFiles)) { ZEPHIR_CALL_FUNCTION(&lines, "file", &_19, filez); zephir_check_call_status(); ZEPHIR_INIT_VAR(numberLines); ZVAL_LONG(numberLines, zephir_fast_count_int(lines TSRMLS_CC)); ZEPHIR_OBS_VAR(showFileFragment); zephir_read_property_this(&showFileFragment, this_ptr, SL("_showFileFragment"), PH_NOISY_CC); if (zephir_is_true(showFileFragment)) { ZEPHIR_INIT_VAR(beforeLine); ZVAL_LONG(beforeLine, (zephir_get_numberval(line) - 7)); if (ZEPHIR_LT_LONG(beforeLine, 1)) { firstLine = 1; } else { firstLine = zephir_get_numberval(beforeLine); } ZEPHIR_INIT_VAR(afterLine); ZVAL_LONG(afterLine, (zephir_get_numberval(line) + 5)); if (ZEPHIR_GT(afterLine, numberLines)) { ZEPHIR_CPY_WRT(lastLine, numberLines); } else { ZEPHIR_CPY_WRT(lastLine, afterLine); } ZEPHIR_SINIT_VAR(_20); ZVAL_LONG(&_20, firstLine); ZEPHIR_SINIT_VAR(_21); ZVAL_LONG(&_21, firstLine); ZEPHIR_INIT_VAR(_22); ZEPHIR_CONCAT_SVSVSVS(_22, "<pre class=\"prettyprint highlight:", &_20, ":", line, " linenums:", &_21, "\">"); zephir_concat_self(&html, _22 TSRMLS_CC); } else { firstLine = 1; ZEPHIR_CPY_WRT(lastLine, numberLines); ZEPHIR_SINIT_NVAR(_20); ZVAL_LONG(&_20, firstLine); ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVSVS(_9, "<pre class=\"prettyprint highlight:", &_20, ":", line, " linenums error-scroll\">"); zephir_concat_self(&html, _9 TSRMLS_CC); } ZEPHIR_INIT_VAR(commentPattern); ZVAL_STRING(commentPattern, "#\\*\\/#", 1); ZEPHIR_INIT_VAR(utf8); ZVAL_STRING(utf8, "UTF-8", 1); ZEPHIR_INIT_VAR(entCompat); ZVAL_LONG(entCompat, 2); ZEPHIR_INIT_VAR(tab); ZVAL_STRING(tab, "\t", 1); ZEPHIR_INIT_VAR(comment); ZVAL_STRING(comment, "* /", 1); i = firstLine; while (1) { if (!(ZEPHIR_GE_LONG(lastLine, i))) { break; } ZEPHIR_SINIT_NVAR(linePosition); ZVAL_LONG(&linePosition, (i - 1)); ZEPHIR_OBS_NVAR(currentLine); zephir_array_fetch(¤tLine, lines, &linePosition, PH_NOISY, "phalcon/debug.zep", 550 TSRMLS_CC); if (zephir_is_true(showFileFragment)) { if (i == firstLine) { ZEPHIR_INIT_NVAR(_2); zephir_fast_trim(_2, currentLine, NULL , ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_3, "preg_match", &_4, commentPattern, _2); zephir_check_call_status(); if (zephir_is_true(_3)) { ZEPHIR_INIT_NVAR(_23); zephir_fast_str_replace(&_23, comment, space, currentLine TSRMLS_CC); ZEPHIR_CPY_WRT(currentLine, _23); } } } if (ZEPHIR_IS_STRING(currentLine, "\n")) { zephir_concat_self_str(&html, SL(" \n") TSRMLS_CC); } else { if (ZEPHIR_IS_STRING(currentLine, "\r\n")) { zephir_concat_self_str(&html, SL(" \n") TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(_23); zephir_fast_str_replace(&_23, tab, twoSpaces, currentLine TSRMLS_CC); ZEPHIR_CALL_FUNCTION(&_7, "htmlentities", &_24, _23, entCompat, utf8); zephir_check_call_status(); zephir_concat_self(&html, _7 TSRMLS_CC); } } i++; } zephir_concat_self_str(&html, SL("</pre>") TSRMLS_CC); } } zephir_concat_self_str(&html, SL("</td></tr>") TSRMLS_CC); RETURN_CCTOR(html); }
/** * 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; int 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(this_ptr, SL("_activeRow"), row TSRMLS_CC); RETURN_CCTOR(row); } if (Z_TYPE_P(row) != IS_ARRAY) { if (0) { zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, 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 ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_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 ( ; zephir_hash_get_current_data_ex(_6$$11, (void**) &_7$$11, &_5$$11) == SUCCESS ; zephir_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(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC); RETURN_CCTOR(activeRow); }
/** * Autoloads the registered classes */ PHP_METHOD(Phalcon_Loader, autoLoad) { zephir_fcall_cache_entry *_10 = NULL, *_12 = NULL, *_13 = NULL, *_23 = NULL, *_24 = NULL, *_31 = NULL, *_32 = NULL; HashTable *_2, *_7, *_15, *_21, *_26, *_29; HashPosition _1, _6, _14, _20, _25, _28; int ZEPHIR_LAST_CALL_STATUS; zval *className_param = NULL, *eventsManager, *classes, *extensions, *filePath = NULL, *ds, *fixedDirectory = NULL, *prefixes, *directories, *namespaceSeparator, *namespaces, *nsPrefix = NULL, *directory = NULL, *fileName = NULL, *extension = NULL, *prefix = NULL, *dsClassName, *nsClassName, *_0 = NULL, **_3, *_4 = NULL, _5 = zval_used_for_init, **_8, *_9 = NULL, *_11 = NULL, **_16, *_17 = NULL, _18 = zval_used_for_init, _19 = zval_used_for_init, **_22, **_27, **_30; zval *className = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &className_param); if (unlikely(Z_TYPE_P(className_param) != IS_STRING && Z_TYPE_P(className_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'className' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(className_param) == IS_STRING)) { zephir_get_strval(className, className_param); } else { ZEPHIR_INIT_VAR(className); ZVAL_EMPTY_STRING(className); } ZEPHIR_OBS_VAR(eventsManager); zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "loader:beforeCheckClass", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _0, this_ptr, className); zephir_check_temp_parameter(_0); zephir_check_call_status(); } ZEPHIR_OBS_VAR(classes); zephir_read_property_this(&classes, this_ptr, SL("_classes"), PH_NOISY_CC); if (Z_TYPE_P(classes) == IS_ARRAY) { ZEPHIR_OBS_VAR(filePath); if (zephir_array_isset_fetch(&filePath, classes, className, 0 TSRMLS_CC)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _0, this_ptr, filePath); zephir_check_temp_parameter(_0); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } ZEPHIR_OBS_VAR(extensions); zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); ZEPHIR_INIT_VAR(ds); ZVAL_STRING(ds, "/", 1); ZEPHIR_INIT_VAR(namespaceSeparator); ZVAL_STRING(namespaceSeparator, "\\", 1); ZEPHIR_OBS_VAR(namespaces); zephir_read_property_this(&namespaces, this_ptr, SL("_namespaces"), PH_NOISY_CC); if (Z_TYPE_P(namespaces) == IS_ARRAY) { zephir_is_iterable(namespaces, &_2, &_1, 0, 0, "phalcon/loader.zep", 347); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(nsPrefix, _2, _1); ZEPHIR_GET_HVALUE(directory, _3); if (zephir_start_with(className, nsPrefix, NULL)) { ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_VV(_4, nsPrefix, namespaceSeparator); ZEPHIR_SINIT_NVAR(_5); ZVAL_LONG(&_5, zephir_fast_strlen_ev(_4)); ZEPHIR_INIT_NVAR(fileName); zephir_substr(fileName, className, zephir_get_intval(&_5), 0, ZEPHIR_SUBSTR_NO_LENGTH); ZEPHIR_INIT_NVAR(_0); zephir_fast_str_replace(&_0, namespaceSeparator, ds, fileName TSRMLS_CC); ZEPHIR_CPY_WRT(fileName, _0); if (zephir_is_true(fileName)) { ZEPHIR_INIT_NVAR(_0); zephir_fast_trim(_0, directory, ds, ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_INIT_NVAR(fixedDirectory); ZEPHIR_CONCAT_VV(fixedDirectory, _0, ds); zephir_is_iterable(extensions, &_7, &_6, 0, 0, "phalcon/loader.zep", 344); for ( ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS ; zephir_hash_move_forward_ex(_7, &_6) ) { ZEPHIR_GET_HVALUE(extension, _8); ZEPHIR_INIT_NVAR(filePath); ZEPHIR_CONCAT_VVSV(filePath, fixedDirectory, fileName, ".", extension); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_checkedPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:beforeCheckPath", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_10, 0, _9, this_ptr); zephir_check_temp_parameter(_9); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_11, "is_file", &_12, 279, filePath); zephir_check_call_status(); if (zephir_is_true(_11)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_13, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } } } } } ZEPHIR_OBS_VAR(prefixes); zephir_read_property_this(&prefixes, this_ptr, SL("_prefixes"), PH_NOISY_CC); if (Z_TYPE_P(prefixes) == IS_ARRAY) { zephir_is_iterable(prefixes, &_15, &_14, 0, 0, "phalcon/loader.zep", 402); for ( ; zephir_hash_get_current_data_ex(_15, (void**) &_16, &_14) == SUCCESS ; zephir_hash_move_forward_ex(_15, &_14) ) { ZEPHIR_GET_HMKEY(prefix, _15, _14); ZEPHIR_GET_HVALUE(directory, _16); if (zephir_start_with(className, prefix, NULL)) { ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_VV(_4, prefix, namespaceSeparator); ZEPHIR_SINIT_NVAR(_5); ZVAL_STRING(&_5, "", 0); ZEPHIR_INIT_NVAR(fileName); zephir_fast_str_replace(&fileName, _4, &_5, className TSRMLS_CC); ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_LNVAR(_17); ZEPHIR_CONCAT_VS(_17, prefix, "_"); ZEPHIR_SINIT_NVAR(_18); ZVAL_STRING(&_18, "", 0); zephir_fast_str_replace(&_0, _17, &_18, fileName TSRMLS_CC); ZEPHIR_CPY_WRT(fileName, _0); ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_19); ZVAL_STRING(&_19, "_", 0); zephir_fast_str_replace(&_0, &_19, ds, fileName TSRMLS_CC); ZEPHIR_CPY_WRT(fileName, _0); if (zephir_is_true(fileName)) { ZEPHIR_INIT_NVAR(_0); zephir_fast_trim(_0, directory, ds, ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_INIT_NVAR(fixedDirectory); ZEPHIR_CONCAT_VV(fixedDirectory, _0, ds); zephir_is_iterable(extensions, &_21, &_20, 0, 0, "phalcon/loader.zep", 399); for ( ; zephir_hash_get_current_data_ex(_21, (void**) &_22, &_20) == SUCCESS ; zephir_hash_move_forward_ex(_21, &_20) ) { ZEPHIR_GET_HVALUE(extension, _22); ZEPHIR_INIT_NVAR(filePath); ZEPHIR_CONCAT_VVSV(filePath, fixedDirectory, fileName, ".", extension); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_checkedPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:beforeCheckPath", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_23, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_11, "is_file", &_12, 279, filePath); zephir_check_call_status(); if (zephir_is_true(_11)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_24, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } } } } } ZEPHIR_SINIT_NVAR(_5); ZVAL_STRING(&_5, "_", 0); ZEPHIR_INIT_VAR(dsClassName); zephir_fast_str_replace(&dsClassName, &_5, ds, className TSRMLS_CC); ZEPHIR_SINIT_NVAR(_18); ZVAL_STRING(&_18, "\\", 0); ZEPHIR_INIT_VAR(nsClassName); zephir_fast_str_replace(&nsClassName, &_18, ds, dsClassName TSRMLS_CC); ZEPHIR_OBS_VAR(directories); zephir_read_property_this(&directories, this_ptr, SL("_directories"), PH_NOISY_CC); if (Z_TYPE_P(directories) == IS_ARRAY) { zephir_is_iterable(directories, &_26, &_25, 0, 0, "phalcon/loader.zep", 464); for ( ; zephir_hash_get_current_data_ex(_26, (void**) &_27, &_25) == SUCCESS ; zephir_hash_move_forward_ex(_26, &_25) ) { ZEPHIR_GET_HVALUE(directory, _27); ZEPHIR_INIT_NVAR(_0); zephir_fast_trim(_0, directory, ds, ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_INIT_NVAR(fixedDirectory); ZEPHIR_CONCAT_VV(fixedDirectory, _0, ds); zephir_is_iterable(extensions, &_29, &_28, 0, 0, "phalcon/loader.zep", 463); for ( ; zephir_hash_get_current_data_ex(_29, (void**) &_30, &_28) == SUCCESS ; zephir_hash_move_forward_ex(_29, &_28) ) { ZEPHIR_GET_HVALUE(extension, _30); ZEPHIR_INIT_NVAR(filePath); ZEPHIR_CONCAT_VVSV(filePath, fixedDirectory, nsClassName, ".", extension); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_checkedPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:beforeCheckPath", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_31, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_11, "is_file", &_12, 279, filePath); zephir_check_call_status(); if (zephir_is_true(_11)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_32, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "loader:afterCheckClass", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _0, this_ptr, className); zephir_check_temp_parameter(_0); zephir_check_call_status(); } RETURN_MM_BOOL(0); }
/** * Replaces placeholders from pattern returning a valid PCRE regular expression * * @param string pattern * @return string */ PHP_METHOD(Test_Router_Route, compilePattern) { zval *pattern = NULL, pattern_sub, idPattern, _0$$4, _1$$4, _2$$5, _3$$5, _4$$6, _5$$6, _6$$7, _7$$7, _8$$8, _9$$8, _10$$8, _11$$9, _12$$9, _13$$9; ZEPHIR_INIT_THIS(); ZVAL_UNDEF(&pattern_sub); ZVAL_UNDEF(&idPattern); ZVAL_UNDEF(&_0$$4); ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$5); ZVAL_UNDEF(&_3$$5); ZVAL_UNDEF(&_4$$6); ZVAL_UNDEF(&_5$$6); ZVAL_UNDEF(&_6$$7); ZVAL_UNDEF(&_7$$7); ZVAL_UNDEF(&_8$$8); ZVAL_UNDEF(&_9$$8); ZVAL_UNDEF(&_10$$8); ZVAL_UNDEF(&_11$$9); ZVAL_UNDEF(&_12$$9); ZVAL_UNDEF(&_13$$9); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &pattern); ZEPHIR_SEPARATE_PARAM(pattern); if (zephir_memnstr_str(pattern, SL(":"), "test/router/route.zep", 56)) { ZEPHIR_INIT_VAR(&idPattern); ZVAL_STRING(&idPattern, "/([a-zA-Z0-9\\_\\-]+)"); if (zephir_memnstr_str(pattern, SL("/:module"), "test/router/route.zep", 62)) { ZEPHIR_INIT_VAR(&_0$$4); ZEPHIR_INIT_VAR(&_1$$4); ZVAL_STRING(&_1$$4, "/:module"); zephir_fast_str_replace(&_0$$4, &_1$$4, &idPattern, pattern TSRMLS_CC); ZEPHIR_CPY_WRT(pattern, &_0$$4); } if (zephir_memnstr_str(pattern, SL("/:controller"), "test/router/route.zep", 67)) { ZEPHIR_INIT_VAR(&_2$$5); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "/:controller"); zephir_fast_str_replace(&_2$$5, &_3$$5, &idPattern, pattern TSRMLS_CC); ZEPHIR_CPY_WRT(pattern, &_2$$5); } if (zephir_memnstr_str(pattern, SL("/:namespace"), "test/router/route.zep", 72)) { ZEPHIR_INIT_VAR(&_4$$6); ZEPHIR_INIT_VAR(&_5$$6); ZVAL_STRING(&_5$$6, "/:namespace"); zephir_fast_str_replace(&_4$$6, &_5$$6, &idPattern, pattern TSRMLS_CC); ZEPHIR_CPY_WRT(pattern, &_4$$6); } if (zephir_memnstr_str(pattern, SL("/:action"), "test/router/route.zep", 77)) { ZEPHIR_INIT_VAR(&_6$$7); ZEPHIR_INIT_VAR(&_7$$7); ZVAL_STRING(&_7$$7, "/:action"); zephir_fast_str_replace(&_6$$7, &_7$$7, &idPattern, pattern TSRMLS_CC); ZEPHIR_CPY_WRT(pattern, &_6$$7); } if (zephir_memnstr_str(pattern, SL("/:params"), "test/router/route.zep", 82)) { ZEPHIR_INIT_VAR(&_8$$8); ZEPHIR_INIT_VAR(&_9$$8); ZVAL_STRING(&_9$$8, "/:params"); ZEPHIR_INIT_VAR(&_10$$8); ZVAL_STRING(&_10$$8, "(/.*)*"); zephir_fast_str_replace(&_8$$8, &_9$$8, &_10$$8, pattern TSRMLS_CC); ZEPHIR_CPY_WRT(pattern, &_8$$8); } if (zephir_memnstr_str(pattern, SL("/:int"), "test/router/route.zep", 87)) { ZEPHIR_INIT_VAR(&_11$$9); ZEPHIR_INIT_VAR(&_12$$9); ZVAL_STRING(&_12$$9, "/:int"); ZEPHIR_INIT_VAR(&_13$$9); ZVAL_STRING(&_13$$9, "/([0-9]+)"); zephir_fast_str_replace(&_11$$9, &_12$$9, &_13$$9, pattern TSRMLS_CC); ZEPHIR_CPY_WRT(pattern, &_11$$9); } } if (zephir_memnstr_str(pattern, SL("("), "test/router/route.zep", 93)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } if (zephir_memnstr_str(pattern, SL("["), "test/router/route.zep", 98)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } RETVAL_ZVAL(pattern, 1, 0); RETURN_MM(); }
/** * Decodes a URL-safe base64-encoded string. * * @param string data * * @return string Decoded string. */ PHP_METHOD(Xpl_Base64Url, decode) { zval *_0, *_2; int ZEPHIR_LAST_CALL_STATUS, mod4 = 0; zval *data_param = NULL, *replaced = NULL, *_1 = NULL, _3$$3, _4$$3, *_5$$3; zval *data = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &data_param); zephir_get_strval(data, data_param); ZEPHIR_INIT_VAR(_0); zephir_create_array(_0, 8, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "-", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "_", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, " ", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "\x09", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "\x0a", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "\x0b", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "\x0c", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "\x0d", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_VAR(_2); zephir_create_array(_2, 2, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "+", 1); zephir_array_fast_append(_2, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "/", 1); zephir_array_fast_append(_2, _1); ZEPHIR_INIT_VAR(replaced); zephir_fast_str_replace(&replaced, _0, _2, data TSRMLS_CC); mod4 = (long) (zephir_safe_mod_long_long(zephir_fast_strlen_ev(replaced), 4 TSRMLS_CC)); if (mod4) { ZEPHIR_SINIT_VAR(_3$$3); ZVAL_STRING(&_3$$3, "====", 0); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_LONG(&_4$$3, mod4); ZEPHIR_INIT_VAR(_5$$3); zephir_substr(_5$$3, &_3$$3, zephir_get_intval(&_4$$3), 0, ZEPHIR_SUBSTR_NO_LENGTH); zephir_concat_self(&replaced, _5$$3 TSRMLS_CC); } ZEPHIR_RETURN_CALL_FUNCTION("base64_decode", NULL, 25, replaced); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(Litesploit_Libs_Network_Telnet, loader) { int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; zval *litesploit = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, _4, _5, _6, _7, _8, _9; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &litesploit); ZEPHIR_SEPARATE_PARAM(litesploit); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "/telnet.server\\((.*)\\)/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "$telnetserver = $1;", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 8, _0, _1, litesploit); zephir_check_temp_parameter(_0); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_CPY_WRT(litesploit, _2); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/telnet.port\\((.*)\\)/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "$telnetport = $1;", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 8, _0, _1, litesploit); zephir_check_temp_parameter(_0); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_CPY_WRT(litesploit, _2); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/telnet.username\\((.*)\\)/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "$telnetusername = $1;", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 8, _0, _1, litesploit); zephir_check_temp_parameter(_0); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_CPY_WRT(litesploit, _2); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/telnet.password\\((.*)\\)/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "$telnetpassword = $1;", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 8, _0, _1, litesploit); zephir_check_temp_parameter(_0); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_CPY_WRT(litesploit, _2); ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_VAR(_4); ZVAL_STRING(&_4, "telnet.connect()", 0); ZEPHIR_SINIT_VAR(_5); ZVAL_STRING(&_5, "$telnet = new \\Telnet\\Client($telnetserver, $telnetport); $telnet->connect();", 0); zephir_fast_str_replace(&_0, &_4, &_5, litesploit TSRMLS_CC); ZEPHIR_CPY_WRT(litesploit, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/telnet.execute\\((.*)\\)/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "$telnet->execute($1)", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 8, _0, _1, litesploit); zephir_check_temp_parameter(_0); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_CPY_WRT(litesploit, _2); ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_VAR(_6); ZVAL_STRING(&_6, "telnet.username", 0); ZEPHIR_SINIT_VAR(_7); ZVAL_STRING(&_7, "$telnetusername", 0); zephir_fast_str_replace(&_0, &_6, &_7, litesploit TSRMLS_CC); ZEPHIR_CPY_WRT(litesploit, _0); ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_VAR(_8); ZVAL_STRING(&_8, "telnet.password", 0); ZEPHIR_SINIT_VAR(_9); ZVAL_STRING(&_9, "$telnetpassword", 0); zephir_fast_str_replace(&_0, &_8, &_9, litesploit TSRMLS_CC); ZEPHIR_CPY_WRT(litesploit, _0); RETVAL_ZVAL(litesploit, 1, 0); RETURN_MM(); }
/** * Replaces placeholders from pattern returning a valid PCRE regular expression */ PHP_METHOD(Phalcon_Mvc_Router_Route, compilePattern) { zval *pattern_param = NULL, *idPattern, *_0 = NULL, _1 = zval_used_for_init, _2 = zval_used_for_init; zval *pattern = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &pattern_param); if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) { zephir_get_strval(pattern, pattern_param); } else { ZEPHIR_INIT_VAR(pattern); ZVAL_EMPTY_STRING(pattern); } if (zephir_memnstr_str(pattern, SL(":"), "phalcon/mvc/router/route.zep", 87)) { ZEPHIR_INIT_VAR(idPattern); ZVAL_STRING(idPattern, "/([a-zA-Z0-9\\_\\-]+)", 1); if (zephir_memnstr_str(pattern, SL("/:module"), "phalcon/mvc/router/route.zep", 93)) { ZEPHIR_INIT_VAR(_0); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "/:module", 0); zephir_fast_str_replace(&_0, &_1, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _0); } if (zephir_memnstr_str(pattern, SL("/:controller"), "phalcon/mvc/router/route.zep", 98)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "/:controller", 0); zephir_fast_str_replace(&_0, &_1, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _0); } if (zephir_memnstr_str(pattern, SL("/:namespace"), "phalcon/mvc/router/route.zep", 103)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "/:namespace", 0); zephir_fast_str_replace(&_0, &_1, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _0); } if (zephir_memnstr_str(pattern, SL("/:action"), "phalcon/mvc/router/route.zep", 108)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "/:action", 0); zephir_fast_str_replace(&_0, &_1, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _0); } if (zephir_memnstr_str(pattern, SL("/:params"), "phalcon/mvc/router/route.zep", 113)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "/:params", 0); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "(/.*)*", 0); zephir_fast_str_replace(&_0, &_1, &_2, pattern TSRMLS_CC); zephir_get_strval(pattern, _0); } if (zephir_memnstr_str(pattern, SL("/:int"), "phalcon/mvc/router/route.zep", 118)) { ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "/:int", 0); ZEPHIR_SINIT_NVAR(_2); ZVAL_STRING(&_2, "/([0-9]+)", 0); zephir_fast_str_replace(&_0, &_1, &_2, pattern TSRMLS_CC); zephir_get_strval(pattern, _0); } } if (zephir_memnstr_str(pattern, SL("("), "phalcon/mvc/router/route.zep", 124)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } if (zephir_memnstr_str(pattern, SL("["), "phalcon/mvc/router/route.zep", 129)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } RETURN_CTOR(pattern); }