コード例 #1
0
ファイル: concat.zep.c プロジェクト: Mrhjx2/zephir
PHP_METHOD(Test_Concat, testConcatSelf1) {

	zval _1;
	zval url, _0, _2;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&url);
	ZVAL_UNDEF(&_0);
	ZVAL_UNDEF(&_2);
	ZVAL_UNDEF(&_1);

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(&url);
	ZVAL_STRING(&url, "");
	zephir_concat_self_str(&url, SL("test") TSRMLS_CC);
	ZEPHIR_INIT_VAR(&_0);
	ZEPHIR_CONCAT_SVS(&_0, "append", &url, "other");
	zephir_concat_self(&url, &_0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(&_1);
	ZEPHIR_CONCAT_SS(&_1, "append", "other");
	zephir_concat_self(&url, &_1 TSRMLS_CC);
	ZEPHIR_INIT_VAR(&_2);
	ZEPHIR_CONCAT_SSV(&_2, "append", "other", &url);
	zephir_concat_self(&url, &_2 TSRMLS_CC);
	RETURN_CCTOR(url);

}
コード例 #2
0
ファイル: concat.zep.c プロジェクト: tabalchi/zephir
PHP_METHOD(Test_Concat, testConcatSelf1) {

    zval _1;
    zval url, _0, _2;
    ZEPHIR_INIT_THIS();

    ZVAL_UNDEF(&url);
    ZVAL_UNDEF(&_0);
    ZVAL_UNDEF(&_2);
    ZVAL_UNDEF(&_1);

    ZEPHIR_MM_GROW();

    ZEPHIR_INIT_VAR(&url);
    ZVAL_STRING(&url, "");
    zephir_concat_self_str(&url, SL("test") TSRMLS_CC);
    ZEPHIR_INIT_VAR(&_0);
    ZEPHIR_CONCAT_SVS(&_0, "append", &url, "other");
    zephir_concat_self(&url, &_0 TSRMLS_CC);
    ZEPHIR_INIT_VAR(&_1);
    ZEPHIR_CONCAT_SS(&_1, "append", "other");
    zephir_concat_self(&url, &_1 TSRMLS_CC);
    ZEPHIR_INIT_VAR(&_2);
    ZEPHIR_CONCAT_SSV(&_2, "append", "other", &url);
    zephir_concat_self(&url, &_2 TSRMLS_CC);
    RETURN_CCTOR(url);

}
コード例 #3
0
ファイル: assign.c プロジェクト: RandomStuffs22/zephir
PHP_METHOD(Test_Assign, testPropertyAssignStringConcat) {

	zval *_0;


	ZEPHIR_INIT_ZVAL_NREF(_0);
	ZVAL_STRING(_0, "test", 1);
	zephir_update_property_this(this_ptr, SL("testVar"), _0 TSRMLS_CC);
	zephir_concat_self_str(&_0, " string", sizeof(" string")-1 TSRMLS_CC);
	zephir_update_property_this(this_ptr, SL("testVar"), _0 TSRMLS_CC);
	RETURN_MEMBER(this_ptr, "testVar");

}
コード例 #4
0
ファイル: concat.zep.c プロジェクト: huzhaer/zephir
PHP_METHOD(Test_Concat, testConcatSelf1) {

    zval *_1;
    zval *url = NULL, *_0, *_2;

    ZEPHIR_MM_GROW();

    ZEPHIR_INIT_VAR(url);
    ZVAL_STRING(url, "", 1);
    zephir_concat_self_str(&url, SL("test") TSRMLS_CC);
    ZEPHIR_INIT_VAR(_0);
    ZEPHIR_CONCAT_SVS(_0, "append", url, "other");
    zephir_concat_self(&url, _0 TSRMLS_CC);
    ZEPHIR_INIT_VAR(_1);
    ZEPHIR_CONCAT_SS(_1, "append", "other");
    zephir_concat_self(&url, _1 TSRMLS_CC);
    ZEPHIR_INIT_VAR(_2);
    ZEPHIR_CONCAT_SSV(_2, "append", "other", url);
    zephir_concat_self(&url, _2 TSRMLS_CC);
    RETURN_CCTOR(url);

}
コード例 #5
0
ファイル: route.zep.c プロジェクト: bschantz/cphalcon
/**
 * Extracts parameters from a string
 *
 * @param string pattern
 * @return array|boolean
 */
PHP_METHOD(Phalcon_Cli_Router_Route, extractNamedParams) {

	long _0, _5$$11, _26$$19;
	zend_bool notValid = 0, _6$$12, _7$$12, _8$$12, _9$$12, _10$$12, _11$$12, _12$$12, _13$$12, _14$$12, _15$$12, _16$$12, _17$$12, _25$$18;
	int tmp = 0, cursor = 0, cursorVar = 0, marker = 0, bracketCount, parenthesesCount, foundPattern, intermediate, numberMatches;
	char ch = 0;
	zval *pattern_param = NULL, *matches = NULL, _1$$11 = zval_used_for_init, _2$$11 = zval_used_for_init, *_3$$11 = NULL, _18$$16 = zval_used_for_init, _19$$16 = zval_used_for_init, *_20$$16 = NULL, _22$$16 = zval_used_for_init, *_23$$16 = NULL, *_27$$19 = NULL, *_28$$28, *_29$$28 = NULL, *_30$$28 = NULL;
	zval *pattern = NULL, *route = NULL, *item = NULL, *variable = NULL, *regexp = NULL, *_4$$11 = NULL, *_21$$16 = NULL, *_24$$16 = 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);
	}


	bracketCount = 0;
	parenthesesCount = 0;
	foundPattern = 0;
	intermediate = 0;
	numberMatches = 0;
	if (zephir_fast_strlen_ev(pattern) <= 0) {
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_INIT_VAR(matches);
	array_init(matches);
	ZEPHIR_INIT_VAR(route);
	ZVAL_EMPTY_STRING(route);
	for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) {
		cursor = _0; 
		ch = ZEPHIR_STRING_OFFSET(pattern, _0);
		if (parenthesesCount == 0) {
			if (ch == '{') {
				if (bracketCount == 0) {
					marker = (cursor + 1);
					intermediate = 0;
					notValid = 0;
				}
				bracketCount++;
			} else {
				if (ch == '}') {
					bracketCount--;
					if (intermediate > 0) {
						if (bracketCount == 0) {
							numberMatches++;
							ZEPHIR_INIT_NVAR(variable);
							ZVAL_EMPTY_STRING(variable);
							ZEPHIR_INIT_NVAR(regexp);
							ZVAL_EMPTY_STRING(regexp);
							ZEPHIR_SINIT_NVAR(_1$$11);
							ZVAL_LONG(&_1$$11, marker);
							ZEPHIR_SINIT_NVAR(_2$$11);
							ZVAL_LONG(&_2$$11, (cursor - marker));
							ZEPHIR_INIT_NVAR(_3$$11);
							zephir_substr(_3$$11, pattern, zephir_get_intval(&_1$$11), zephir_get_intval(&_2$$11), 0);
							zephir_get_strval(_4$$11, _3$$11);
							ZEPHIR_CPY_WRT(item, _4$$11);
							for (_5$$11 = 0; _5$$11 < Z_STRLEN_P(item); _5$$11++) {
								cursorVar = _5$$11; 
								ch = ZEPHIR_STRING_OFFSET(item, _5$$11);
								if (ch == '\0') {
									break;
								}
								_6$$12 = cursorVar == 0;
								if (_6$$12) {
									_7$$12 = ch >= 'a';
									if (_7$$12) {
										_7$$12 = ch <= 'z';
									}
									_8$$12 = _7$$12;
									if (!(_8$$12)) {
										_9$$12 = ch >= 'A';
										if (_9$$12) {
											_9$$12 = ch <= 'Z';
										}
										_8$$12 = _9$$12;
									}
									_6$$12 = !(_8$$12);
								}
								if (_6$$12) {
									notValid = 1;
									break;
								}
								_10$$12 = ch >= 'a';
								if (_10$$12) {
									_10$$12 = ch <= 'z';
								}
								_11$$12 = _10$$12;
								if (!(_11$$12)) {
									_12$$12 = ch >= 'A';
									if (_12$$12) {
										_12$$12 = ch <= 'Z';
									}
									_11$$12 = _12$$12;
								}
								_13$$12 = _11$$12;
								if (!(_13$$12)) {
									_14$$12 = ch >= '0';
									if (_14$$12) {
										_14$$12 = ch <= '9';
									}
									_13$$12 = _14$$12;
								}
								_15$$12 = _13$$12;
								if (!(_15$$12)) {
									_15$$12 = ch == '-';
								}
								_16$$12 = _15$$12;
								if (!(_16$$12)) {
									_16$$12 = ch == '_';
								}
								_17$$12 = _16$$12;
								if (!(_17$$12)) {
									_17$$12 = ch == ':';
								}
								if (_17$$12) {
									if (ch == ':') {
										ZEPHIR_SINIT_NVAR(_18$$16);
										ZVAL_LONG(&_18$$16, 0);
										ZEPHIR_SINIT_NVAR(_19$$16);
										ZVAL_LONG(&_19$$16, cursorVar);
										ZEPHIR_INIT_NVAR(_20$$16);
										zephir_substr(_20$$16, item, 0 , zephir_get_intval(&_19$$16), 0);
										zephir_get_strval(_21$$16, _20$$16);
										ZEPHIR_CPY_WRT(variable, _21$$16);
										ZEPHIR_SINIT_NVAR(_22$$16);
										ZVAL_LONG(&_22$$16, (cursorVar + 1));
										ZEPHIR_INIT_NVAR(_23$$16);
										zephir_substr(_23$$16, item, zephir_get_intval(&_22$$16), 0, ZEPHIR_SUBSTR_NO_LENGTH);
										zephir_get_strval(_24$$16, _23$$16);
										ZEPHIR_CPY_WRT(regexp, _24$$16);
										break;
									}
								} else {
									notValid = 1;
									break;
								}
							}
							if (!(notValid)) {
								tmp = numberMatches;
								_25$$18 = zephir_is_true(variable);
								if (_25$$18) {
									_25$$18 = zephir_is_true(regexp);
								}
								if (_25$$18) {
									foundPattern = 0;
									for (_26$$19 = 0; _26$$19 < Z_STRLEN_P(regexp); _26$$19++) {
										ch = ZEPHIR_STRING_OFFSET(regexp, _26$$19);
										if (ch == '\0') {
											break;
										}
										if (!(foundPattern)) {
											if (ch == '(') {
												foundPattern = 1;
											}
										} else {
											if (ch == ')') {
												foundPattern = 2;
												break;
											}
										}
									}
									if (foundPattern != 2) {
										zephir_concat_self_str(&route, "(", sizeof("(")-1 TSRMLS_CC);
										zephir_concat_self(&route, regexp TSRMLS_CC);
										zephir_concat_self_str(&route, ")", sizeof(")")-1 TSRMLS_CC);
									} else {
										zephir_concat_self(&route, regexp TSRMLS_CC);
									}
									ZEPHIR_INIT_NVAR(_27$$19);
									ZVAL_LONG(_27$$19, tmp);
									zephir_array_update_zval(&matches, variable, &_27$$19, PH_COPY | PH_SEPARATE);
								} else {
									_28$$28 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC);
									ZEPHIR_INIT_LNVAR(_29$$28);
									ZEPHIR_CONCAT_SVS(_29$$28, "([^", _28$$28, "]*)");
									zephir_concat_self(&route, _29$$28 TSRMLS_CC);
									ZEPHIR_INIT_NVAR(_30$$28);
									ZVAL_LONG(_30$$28, tmp);
									zephir_array_update_zval(&matches, item, &_30$$28, PH_COPY | PH_SEPARATE);
								}
							} else {
								zephir_concat_self_str(&route, "{", sizeof("{")-1 TSRMLS_CC);
								zephir_concat_self(&route, item TSRMLS_CC);
								zephir_concat_self_str(&route, "}", sizeof("}")-1 TSRMLS_CC);
							}
							continue;
						}
					}
				}
			}
		}
		if (bracketCount == 0) {
			if (ch == '(') {
				parenthesesCount++;
			} else {
				if (ch == ')') {
					parenthesesCount--;
					if (parenthesesCount == 0) {
						numberMatches++;
					}
				}
			}
		}
		if (bracketCount > 0) {
			intermediate++;
		} else {
			zephir_concat_self_char(&route, ch TSRMLS_CC);
		}
	}
	zephir_create_array(return_value, 2, 0 TSRMLS_CC);
	zephir_array_fast_append(return_value, route);
	zephir_array_fast_append(return_value, matches);
	RETURN_MM();

}
コード例 #6
0
ファイル: debug.zep.c プロジェクト: bschantz/cphalcon
/**
 * Handles uncaught exceptions
 */
PHP_METHOD(Phalcon_Debug, onUncaughtException) {

	HashTable *_12$$5, *_17$$5, *_24$$5, *_31$$5, *_37$$13;
	HashPosition _11$$5, _16$$5, _23$$5, _30$$5, _36$$13;
	zephir_fcall_cache_entry *_15 = NULL, *_21 = NULL, *_27 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *exception, *_REQUEST, *_SERVER, *obLevel = NULL, *className = NULL, *escapedMessage = NULL, *html = NULL, *showBackTrace = NULL, *dataVars = NULL, *n = NULL, *traceItem = NULL, *keyRequest = NULL, *value = NULL, *keyServer = NULL, *keyFile = NULL, *keyVar = NULL, *dataVar = NULL, *_0, *_2 = NULL, *_3 = NULL, *_4, *_5 = NULL, *_6, *_7 = NULL, *_8 = NULL, *_9, *_42 = NULL, *_43, *_1$$4 = NULL, *_10$$5 = NULL, **_13$$5, **_18$$5, **_25$$5, *_29$$5 = NULL, **_32$$5, *_34$$5 = NULL, *_35$$5, *_14$$7 = NULL, *_19$$9 = NULL, *_20$$10 = NULL, *_22$$10 = NULL, *_26$$11 = NULL, *_28$$11 = NULL, *_33$$12 = NULL, **_38$$13, *_39$$14 = NULL, *_40$$14, *_41$$14 = NULL;

	ZEPHIR_MM_GROW();
	zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);
	zephir_get_global(&_REQUEST, SS("_REQUEST") TSRMLS_CC);
	zephir_fetch_params(1, 1, 0, &exception);



	ZEPHIR_CALL_FUNCTION(&obLevel, "ob_get_level", NULL, 168);
	zephir_check_call_status();
	if (ZEPHIR_GT_LONG(obLevel, 0)) {
		ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 128);
		zephir_check_call_status();
	}
	_0 = zephir_fetch_static_property_ce(phalcon_debug_ce, SL("_isActive") TSRMLS_CC);
	if (zephir_is_true(_0)) {
		ZEPHIR_CALL_METHOD(&_1$$4, exception, "getmessage", NULL, 0);
		zephir_check_call_status();
		zend_print_zval(_1$$4, 0);
		RETURN_MM_NULL();
	}
	zephir_update_static_property_ce(phalcon_debug_ce, SL("_isActive"), &ZEPHIR_GLOBAL(global_true) TSRMLS_CC);
	ZEPHIR_INIT_VAR(className);
	zephir_get_class(className, exception, 0 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_2, exception, "getmessage", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&escapedMessage, this_ptr, "_escapestring", NULL, 0, _2);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(html);
	ZEPHIR_CONCAT_SVSVS(html, "<html><head><title>", className, ": ", escapedMessage, "</title>");
	ZEPHIR_CALL_METHOD(&_3, this_ptr, "getcsssources", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_4);
	ZEPHIR_CONCAT_VS(_4, _3, "</head><body>");
	zephir_concat_self(&html, _4 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_5, this_ptr, "getversion", NULL, 0);
	zephir_check_call_status();
	zephir_concat_self(&html, _5 TSRMLS_CC);
	zephir_concat_self_str(&html, SL("<div align=\"center\"><div class=\"error-main\">") TSRMLS_CC);
	ZEPHIR_INIT_VAR(_6);
	ZEPHIR_CONCAT_SVSVS(_6, "<h1>", className, ": ", escapedMessage, "</h1>");
	zephir_concat_self(&html, _6 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_7, exception, "getfile", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&_8, exception, "getline", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_9);
	ZEPHIR_CONCAT_SVSVS(_9, "<span class=\"error-file\">", _7, " (", _8, ")</span>");
	zephir_concat_self(&html, _9 TSRMLS_CC);
	zephir_concat_self_str(&html, SL("</div>") TSRMLS_CC);
	ZEPHIR_OBS_VAR(showBackTrace);
	zephir_read_property_this(&showBackTrace, this_ptr, SL("_showBackTrace"), PH_NOISY_CC);
	if (zephir_is_true(showBackTrace)) {
		ZEPHIR_OBS_VAR(dataVars);
		zephir_read_property_this(&dataVars, this_ptr, SL("_data"), PH_NOISY_CC);
		zephir_concat_self_str(&html, SL("<div class=\"error-info\"><div id=\"tabs\"><ul>") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-1\">Backtrace</a></li>") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-2\">Request</a></li>") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-3\">Server</a></li>") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-4\">Included Files</a></li>") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-5\">Memory</a></li>") TSRMLS_CC);
		if (Z_TYPE_P(dataVars) == IS_ARRAY) {
			zephir_concat_self_str(&html, SL("<li><a href=\"#error-tabs-6\">Variables</a></li>") TSRMLS_CC);
		}
		zephir_concat_self_str(&html, SL("</ul>") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<div id=\"error-tabs-1\"><table cellspacing=\"0\" align=\"center\" width=\"100%\">") TSRMLS_CC);
		ZEPHIR_CALL_METHOD(&_10$$5, exception, "gettrace", NULL, 0);
		zephir_check_call_status();
		zephir_is_iterable(_10$$5, &_12$$5, &_11$$5, 0, 0, "phalcon/debug.zep", 659);
		for (
		  ; zend_hash_get_current_data_ex(_12$$5, (void**) &_13$$5, &_11$$5) == SUCCESS
		  ; zend_hash_move_forward_ex(_12$$5, &_11$$5)
		) {
			ZEPHIR_GET_HMKEY(n, _12$$5, _11$$5);
			ZEPHIR_GET_HVALUE(traceItem, _13$$5);
			ZEPHIR_CALL_METHOD(&_14$$7, this_ptr, "showtraceitem", &_15, 169, n, traceItem);
			zephir_check_call_status();
			zephir_concat_self(&html, _14$$7 TSRMLS_CC);
		}
		zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<div id=\"error-tabs-2\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<tr><th>Key</th><th>Value</th></tr>") TSRMLS_CC);
		zephir_is_iterable(_REQUEST, &_17$$5, &_16$$5, 0, 0, "phalcon/debug.zep", 673);
		for (
		  ; zend_hash_get_current_data_ex(_17$$5, (void**) &_18$$5, &_16$$5) == SUCCESS
		  ; zend_hash_move_forward_ex(_17$$5, &_16$$5)
		) {
			ZEPHIR_GET_HMKEY(keyRequest, _17$$5, _16$$5);
			ZEPHIR_GET_HVALUE(value, _18$$5);
			if (Z_TYPE_P(value) != IS_ARRAY) {
				ZEPHIR_INIT_LNVAR(_19$$9);
				ZEPHIR_CONCAT_SVSVS(_19$$9, "<tr><td class=\"key\">", keyRequest, "</td><td>", value, "</td></tr>");
				zephir_concat_self(&html, _19$$9 TSRMLS_CC);
			} else {
				ZEPHIR_CALL_FUNCTION(&_20$$10, "print_r", &_21, 170, value, ZEPHIR_GLOBAL(global_true));
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_22$$10);
				ZEPHIR_CONCAT_SVSVS(_22$$10, "<tr><td class=\"key\">", keyRequest, "</td><td>", _20$$10, "</td></tr>");
				zephir_concat_self(&html, _22$$10 TSRMLS_CC);
			}
		}
		zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<div id=\"error-tabs-3\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<tr><th>Key</th><th>Value</th></tr>") TSRMLS_CC);
		zephir_is_iterable(_SERVER, &_24$$5, &_23$$5, 0, 0, "phalcon/debug.zep", 683);
		for (
		  ; zend_hash_get_current_data_ex(_24$$5, (void**) &_25$$5, &_23$$5) == SUCCESS
		  ; zend_hash_move_forward_ex(_24$$5, &_23$$5)
		) {
			ZEPHIR_GET_HMKEY(keyServer, _24$$5, _23$$5);
			ZEPHIR_GET_HVALUE(value, _25$$5);
			ZEPHIR_CALL_METHOD(&_26$$11, this_ptr, "_getvardump", &_27, 0, value);
			zephir_check_call_status();
			ZEPHIR_INIT_LNVAR(_28$$11);
			ZEPHIR_CONCAT_SVSVS(_28$$11, "<tr><td class=\"key\">", keyServer, "</td><td>", _26$$11, "</td></tr>");
			zephir_concat_self(&html, _28$$11 TSRMLS_CC);
		}
		zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<div id=\"error-tabs-4\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<tr><th>#</th><th>Path</th></tr>") TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_29$$5, "get_included_files", NULL, 171);
		zephir_check_call_status();
		zephir_is_iterable(_29$$5, &_31$$5, &_30$$5, 0, 0, "phalcon/debug.zep", 693);
		for (
		  ; zend_hash_get_current_data_ex(_31$$5, (void**) &_32$$5, &_30$$5) == SUCCESS
		  ; zend_hash_move_forward_ex(_31$$5, &_30$$5)
		) {
			ZEPHIR_GET_HMKEY(keyFile, _31$$5, _30$$5);
			ZEPHIR_GET_HVALUE(value, _32$$5);
			ZEPHIR_INIT_LNVAR(_33$$12);
			ZEPHIR_CONCAT_SVSVS(_33$$12, "<tr><td>", keyFile, "</th><td>", value, "</td></tr>");
			zephir_concat_self(&html, _33$$12 TSRMLS_CC);
		}
		zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC);
		zephir_concat_self_str(&html, SL("<div id=\"error-tabs-5\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_34$$5, "memory_get_usage", NULL, 172, ZEPHIR_GLOBAL(global_true));
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_35$$5);
		ZEPHIR_CONCAT_SVS(_35$$5, "<tr><th colspan=\"2\">Memory</th></tr><tr><td>Usage</td><td>", _34$$5, "</td></tr>");
		zephir_concat_self(&html, _35$$5 TSRMLS_CC);
		zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC);
		if (Z_TYPE_P(dataVars) == IS_ARRAY) {
			zephir_concat_self_str(&html, SL("<div id=\"error-tabs-6\"><table cellspacing=\"0\" align=\"center\" class=\"superglobal-detail\">") TSRMLS_CC);
			zephir_concat_self_str(&html, SL("<tr><th>Key</th><th>Value</th></tr>") TSRMLS_CC);
			zephir_is_iterable(dataVars, &_37$$13, &_36$$13, 0, 0, "phalcon/debug.zep", 711);
			for (
			  ; zend_hash_get_current_data_ex(_37$$13, (void**) &_38$$13, &_36$$13) == SUCCESS
			  ; zend_hash_move_forward_ex(_37$$13, &_36$$13)
			) {
				ZEPHIR_GET_HMKEY(keyVar, _37$$13, _36$$13);
				ZEPHIR_GET_HVALUE(dataVar, _38$$13);
				zephir_array_fetch_long(&_40$$14, dataVar, 0, PH_NOISY | PH_READONLY, "phalcon/debug.zep", 709 TSRMLS_CC);
				ZEPHIR_CALL_METHOD(&_39$$14, this_ptr, "_getvardump", &_27, 0, _40$$14);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_41$$14);
				ZEPHIR_CONCAT_SVSVS(_41$$14, "<tr><td class=\"key\">", keyVar, "</td><td>", _39$$14, "</td></tr>");
				zephir_concat_self(&html, _41$$14 TSRMLS_CC);
			}
			zephir_concat_self_str(&html, SL("</table></div>") TSRMLS_CC);
		}
		zephir_concat_self_str(&html, SL("</div>") TSRMLS_CC);
	}
	ZEPHIR_CALL_METHOD(&_42, this_ptr, "getjssources", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_43);
	ZEPHIR_CONCAT_VS(_43, _42, "</div></body></html>");
	zephir_concat_self(&html, _43 TSRMLS_CC);
	zend_print_zval(html, 0);
	zephir_update_static_property_ce(phalcon_debug_ce, SL("_isActive"), &ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
	RETURN_MM_BOOL(1);

}
コード例 #7
0
ファイル: debug.zep.c プロジェクト: bschantz/cphalcon
/**
 * 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(&currentLine, 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("&nbsp;\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);

}
コード例 #8
0
ファイル: connection.zep.c プロジェクト: noikiy/lynx
/**
 * Update row(s) of table and returns the number of updated rows
 */
PHP_METHOD(Lynx_DBAL_Connection, update) {

    zephir_nts_static zephir_fcall_cache_entry *_12 = NULL, *_15 = NULL;
    int ZEPHIR_LAST_CALL_STATUS;
    HashTable *_3;
    HashPosition _2;
    zval *data = NULL, *identifiers = NULL, *types = NULL;
    zval *table_param = NULL, *data_param = NULL, *identifiers_param = NULL, *types_param = NULL, *set, *stmt = NULL, *columnName = NULL, *_0 = NULL, *_1, **_4, *_5, *_6 = NULL, *_7 = NULL, *_8, *cnt, *_9, *_10 = NULL, *_11 = NULL, *_13, *_14;
    zval *table = NULL, *query = NULL;

    ZEPHIR_MM_GROW();
    zephir_fetch_params(1, 3, 1, &table_param, &data_param, &identifiers_param, &types_param);

    if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) {
        zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC);
        RETURN_MM_NULL();
    }

    if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
        zephir_get_strval(table, table_param);
    } else {
        ZEPHIR_INIT_VAR(table);
        ZVAL_EMPTY_STRING(table);
    }
    data = data_param;

    identifiers = identifiers_param;

    if (!types_param) {
        ZEPHIR_INIT_VAR(types);
        array_init(types);
    } else {
        types = types_param;

    }
    ZEPHIR_INIT_VAR(set);
    array_init(set);


    ZEPHIR_INIT_VAR(_1);
    zephir_array_keys(_1, data TSRMLS_CC);
    zephir_is_iterable(_1, &_3, &_2, 0, 0, "lynx/DBAL/Connection.zep", 88);
    for (
        ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
        ; zephir_hash_move_forward_ex(_3, &_2)
    ) {
        ZEPHIR_GET_HVALUE(columnName, _4);
        _5 = zephir_fetch_nproperty_this(this_ptr, SL("platform"), PH_NOISY_CC);
        ZEPHIR_CALL_METHOD(&_6, _5, "wrap", NULL, columnName);
        zephir_check_call_status();
        ZEPHIR_INIT_LNVAR(_7);
        ZEPHIR_CONCAT_VS(_7, _6, " = ?");
        zephir_array_append(&set, _7, PH_SEPARATE, "lynx/DBAL/Connection.zep", 85);
    }
    _5 = zephir_fetch_nproperty_this(this_ptr, SL("platform"), PH_NOISY_CC);
    ZEPHIR_CALL_METHOD(&_6, _5, "wrap", NULL, table);
    zephir_check_call_status();
    ZEPHIR_INIT_VAR(_8);
    zephir_fast_join_str(_8, SL(", "), set TSRMLS_CC);
    ZEPHIR_INIT_LNVAR(_7);
    ZEPHIR_CONCAT_SVSV(_7, "UPDATE ", _6, " SET ", _8);
    zephir_get_strval(query, _7);
    ZEPHIR_INIT_VAR(cnt);
    ZVAL_LONG(cnt, zephir_fast_count_int(identifiers TSRMLS_CC));
    if (ZEPHIR_GT_LONG(cnt, 0)) {
        zephir_concat_self_str(&query, " WHERE ", sizeof(" WHERE ")-1 TSRMLS_CC);
        if (ZEPHIR_IS_LONG(cnt, 1)) {
            _9 = zephir_fetch_nproperty_this(this_ptr, SL("platform"), PH_NOISY_CC);
            Z_SET_ISREF_P(identifiers);
            ZEPHIR_CALL_FUNCTION(&_11, "key", &_12, identifiers);
            Z_UNSET_ISREF_P(identifiers);
            zephir_check_call_status();
            ZEPHIR_CALL_METHOD(&_10, _9, "wrap", NULL, _11);
            zephir_check_call_status();
            ZEPHIR_INIT_VAR(_13);
            ZEPHIR_CONCAT_VS(_13, _10, " = ?");
            zephir_concat_self(&query, _13 TSRMLS_CC);
        } else {
            ZEPHIR_THROW_EXCEPTION_DEBUG_STR(zend_exception_get_default(TSRMLS_C), "It's not implemented", "lynx/DBAL/Connection.zep", 99);
            return;
        }
    }
    _5 = zephir_fetch_nproperty_this(this_ptr, SL("driver"), PH_NOISY_CC);
    ZEPHIR_CALL_METHOD(&stmt, _5, "prepare", NULL, query);
    zephir_check_call_status();
    ZEPHIR_INIT_VAR(_14);
    ZEPHIR_CALL_FUNCTION(&_6, "array_values", &_15, data);
    zephir_check_call_status();
    ZEPHIR_CALL_FUNCTION(&_10, "array_values", &_15, identifiers);
    zephir_check_call_status();
    zephir_fast_array_merge(_14, &(_6), &(_10) TSRMLS_CC);
    ZEPHIR_RETURN_CALL_METHOD(stmt, "execute", NULL, _14);
    zephir_check_call_status();
    RETURN_MM();

}
コード例 #9
0
ファイル: firephp.zep.c プロジェクト: AlexKomrakov/cphalcon
/**
 * Writes the log to the stream itself
 *
 * @link http://www.firephp.org/Wiki/Reference/Protocol
 */
PHP_METHOD(Phalcon_Logger_Adapter_Firephp, logInternal) {

	HashTable *_10;
	HashPosition _9;
	zephir_fcall_cache_entry *_4 = NULL;
	zval *context = NULL;
	int type, time, ZEPHIR_LAST_CALL_STATUS;
	zval *message_param = NULL, *type_param = NULL, *time_param = NULL, *context_param = NULL, *chunk = NULL, *format = NULL, *chString = NULL, *content = NULL, *key = NULL, *_0, *_2, *_5 = NULL, *_6, *_7, _8, **_11, *_1$$3, _3$$4 = zval_used_for_init, *_12$$5 = NULL, *_13$$5, *_14$$5;
	zval *message = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 4, 0, &message_param, &type_param, &time_param, &context_param);

	zephir_get_strval(message, message_param);
	type = zephir_get_intval(type_param);
	time = zephir_get_intval(time_param);
	zephir_get_arrval(context, context_param);


	_0 = zephir_fetch_static_property_ce(phalcon_logger_adapter_firephp_ce, SL("_index") TSRMLS_CC);
	if (Z_TYPE_P(_0) == IS_NULL) {
		ZEPHIR_INIT_ZVAL_NREF(_1$$3);
		ZVAL_LONG(_1$$3, 1);
		zephir_update_static_property_ce(phalcon_logger_adapter_firephp_ce, SL("_index"), &_1$$3 TSRMLS_CC);
	}
	_2 = zephir_fetch_static_property_ce(phalcon_logger_adapter_firephp_ce, SL("_initialized") TSRMLS_CC);
	if (!ZEPHIR_IS_TRUE_IDENTICAL(_2)) {
		ZEPHIR_SINIT_VAR(_3$$4);
		ZVAL_STRING(&_3$$4, "X-Wf-Protocol-1: http://meta.wildfirehq.org/Protocol/JsonStream/0.2", 0);
		ZEPHIR_CALL_FUNCTION(NULL, "header", &_4, 238, &_3$$4);
		zephir_check_call_status();
		ZEPHIR_SINIT_NVAR(_3$$4);
		ZVAL_STRING(&_3$$4, "X-Wf-1-Plugin-1: http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3", 0);
		ZEPHIR_CALL_FUNCTION(NULL, "header", &_4, 238, &_3$$4);
		zephir_check_call_status();
		ZEPHIR_SINIT_NVAR(_3$$4);
		ZVAL_STRING(&_3$$4, "X-Wf-Structure-1: http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1", 0);
		ZEPHIR_CALL_FUNCTION(NULL, "header", &_4, 238, &_3$$4);
		zephir_check_call_status();
		zephir_update_static_property_ce(phalcon_logger_adapter_firephp_ce, SL("_initialized"), &ZEPHIR_GLOBAL(global_true) TSRMLS_CC);
	}
	ZEPHIR_CALL_METHOD(&_5, this_ptr, "getformatter", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_6);
	ZVAL_LONG(_6, type);
	ZEPHIR_INIT_VAR(_7);
	ZVAL_LONG(_7, time);
	ZEPHIR_CALL_METHOD(&format, _5, "format", NULL, 0, message, _6, _7, context);
	zephir_check_call_status();
	ZEPHIR_SINIT_VAR(_8);
	ZVAL_LONG(&_8, 4500);
	ZEPHIR_CALL_FUNCTION(&chunk, "str_split", NULL, 71, format, &_8);
	zephir_check_call_status();
	zephir_is_iterable(chunk, &_10, &_9, 0, 0, "phalcon/logger/adapter/firephp.zep", 96);
	for (
	  ; zephir_hash_get_current_data_ex(_10, (void**) &_11, &_9) == SUCCESS
	  ; zephir_hash_move_forward_ex(_10, &_9)
	) {
		ZEPHIR_GET_HMKEY(key, _10, _9);
		ZEPHIR_GET_HVALUE(chString, _11);
		ZEPHIR_OBS_NVAR(_12$$5);
		zephir_read_static_property_ce(&_12$$5, phalcon_logger_adapter_firephp_ce, SL("_index") TSRMLS_CC);
		ZEPHIR_INIT_NVAR(content);
		ZEPHIR_CONCAT_SVSV(content, "X-Wf-1-1-1-", _12$$5, ": ", chString);
		if (zephir_array_isset_long(chunk, (zephir_get_numberval(key) + 1))) {
			zephir_concat_self_str(&content, SL("|\\") TSRMLS_CC);
		}
		ZEPHIR_CALL_FUNCTION(NULL, "header", &_4, 238, content);
		zephir_check_call_status();
		_13$$5 = zephir_fetch_static_property_ce(phalcon_logger_adapter_firephp_ce, SL("_index") TSRMLS_CC);
		ZEPHIR_INIT_ZVAL_NREF(_14$$5);
		ZVAL_LONG(_14$$5, (zephir_get_numberval(_13$$5) + 1));
		zephir_update_static_property_ce(phalcon_logger_adapter_firephp_ce, SL("_index"), &_14$$5 TSRMLS_CC);
	}
	ZEPHIR_MM_RESTORE();

}
コード例 #10
0
ファイル: storageabstract.zep.c プロジェクト: VergilTang/yb
PHP_METHOD(Yb_Upload_StorageAbstract, generateUri) {

	unsigned char _12, _13, _14, _15;
	zephir_fcall_cache_entry *_9 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *source_param = NULL, *prefix_param = NULL, *extension_param = NULL, *_0, *_2 = NULL, *_8 = NULL, *_1$$3, *_3$$4, *_4$$4, _5$$4, *_6$$5;
	zval *source = NULL, *prefix = NULL, *extension = NULL, *uri, *uuid = NULL, *_10, *_11 = NULL, *_7$$5, *_16$$6;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 3, 0, &source_param, &prefix_param, &extension_param);

	zephir_get_strval(source, source_param);
	zephir_get_strval(prefix, prefix_param);
	zephir_get_strval(extension, extension_param);


	ZEPHIR_INIT_VAR(uri);
	ZVAL_STRING(uri, "/", 1);
	_0 = zephir_fetch_nproperty_this(this_ptr, SL("uriGenerator"), PH_NOISY_CC);
	if (zephir_is_true(_0)) {
		_1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("uriGenerator"), PH_NOISY_CC);
		ZEPHIR_RETURN_CALL_METHOD(_1$$3, "generateuri", NULL, 0, source, prefix, extension);
		zephir_check_call_status();
		RETURN_MM();
	}
	if (zephir_fast_strlen_ev(prefix) > 0) {
		ZEPHIR_INIT_VAR(_3$$4);
		ZEPHIR_INIT_VAR(_4$$4);
		ZEPHIR_SINIT_VAR(_5$$4);
		ZVAL_STRING(&_5$$4, "#^(\\w+/)*\\w*$#", 0);
		zephir_preg_match(_4$$4, &_5$$4, prefix, _3$$4, 0, 0 , 0  TSRMLS_CC);
		if (unlikely(!zephir_is_true(_4$$4))) {
			ZEPHIR_INIT_VAR(_6$$5);
			object_init_ex(_6$$5, yb_upload_exception_ce);
			ZEPHIR_INIT_VAR(_7$$5);
			ZEPHIR_CONCAT_SV(_7$$5, "Invalid prefix: ", prefix);
			ZEPHIR_CALL_METHOD(NULL, _6$$5, "__construct", NULL, 2, _7$$5);
			zephir_check_call_status();
			zephir_throw_exception_debug(_6$$5, "yb/upload/storageabstract.zep", 37 TSRMLS_CC);
			ZEPHIR_MM_RESTORE();
			return;
		}
		zephir_concat_self(&uri, prefix TSRMLS_CC);
	}
	ZEPHIR_INIT_VAR(_10);
	ZEPHIR_CONCAT_VV(_10, source, extension);
	ZEPHIR_CALL_CE_STATIC(&_8, yb_std_ce, "uuid", &_9, 28, _10);
	zephir_check_call_status();
	zephir_get_strval(_11, _8);
	ZEPHIR_CPY_WRT(uuid, _11);
	_12 = ZEPHIR_STRING_OFFSET(uuid, 0);
	zephir_concat_self_char(&uri, _12 TSRMLS_CC);
	_13 = ZEPHIR_STRING_OFFSET(uuid, 1);
	zephir_concat_self_char(&uri, _13 TSRMLS_CC);
	zephir_concat_self_str(&uri, "/", sizeof("/")-1 TSRMLS_CC);
	_14 = ZEPHIR_STRING_OFFSET(uuid, 2);
	zephir_concat_self_char(&uri, _14 TSRMLS_CC);
	_15 = ZEPHIR_STRING_OFFSET(uuid, 3);
	zephir_concat_self_char(&uri, _15 TSRMLS_CC);
	zephir_concat_self_str(&uri, "/", sizeof("/")-1 TSRMLS_CC);
	zephir_concat_self(&uri, uuid TSRMLS_CC);
	if (!(!extension) && Z_STRLEN_P(extension)) {
		ZEPHIR_INIT_VAR(_16$$6);
		ZEPHIR_CONCAT_SV(_16$$6, ".", extension);
		zephir_concat_self(&uri, _16$$6 TSRMLS_CC);
	}
	RETURN_CTOR(uri);

}
コード例 #11
0
ファイル: sqlite.zep.c プロジェクト: flaver12/cphalcon
/**
 * Gets the column name in SQLite
 */
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, getColumnDefinition) {

	zephir_nts_static zephir_fcall_cache_entry *_7 = NULL;
	HashTable *_4;
	HashPosition _3;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *column, *columnSql, *type = NULL, *typeValues = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *value = NULL, *valueSql, **_5, _6 = zval_used_for_init, _8 = zval_used_for_init, *_9, *_10 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &column);



	ZEPHIR_INIT_VAR(columnSql);
	ZVAL_STRING(columnSql, "", 1);
	ZEPHIR_CALL_METHOD(&type, column, "gettype", NULL);
	zephir_check_call_status();
	if (Z_TYPE_P(type) == IS_STRING) {
		zephir_concat_self(&columnSql, type TSRMLS_CC);
		ZEPHIR_CALL_METHOD(&type, column, "gettypereference", NULL);
		zephir_check_call_status();
	}
	do {
		if (ZEPHIR_IS_LONG(type, 0)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("INT") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 1)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("DATE") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 2)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("VARCHAR") TSRMLS_CC);
			}
			ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_1);
			ZEPHIR_CONCAT_SVS(_1, "(", _0, ")");
			zephir_concat_self(&columnSql, _1 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(type, 3)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("NUMERIC") TSRMLS_CC);
			}
			ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_2, column, "getscale", NULL);
			zephir_check_call_status();
			ZEPHIR_INIT_LNVAR(_1);
			ZEPHIR_CONCAT_SVSVS(_1, "(", _0, ",", _2, ")");
			zephir_concat_self(&columnSql, _1 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(type, 4)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("TIMESTAMP") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 5)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("CHARACTER") TSRMLS_CC);
			}
			ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL);
			zephir_check_call_status();
			ZEPHIR_INIT_LNVAR(_1);
			ZEPHIR_CONCAT_SVS(_1, "(", _0, ")");
			zephir_concat_self(&columnSql, _1 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(type, 6)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("TEXT") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 7)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("FLOAT") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_EMPTY(columnSql)) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Unrecognized SQLite data type", "phalcon/db/dialect/sqlite.zep", 112);
			return;
		}
		ZEPHIR_CALL_METHOD(&typeValues, column, "gettypevalues", NULL);
		zephir_check_call_status();
		if (!(ZEPHIR_IS_EMPTY(typeValues))) {
			if (Z_TYPE_P(typeValues) == IS_ARRAY) {
				ZEPHIR_INIT_VAR(valueSql);
				ZVAL_STRING(valueSql, "", 1);
				zephir_is_iterable(typeValues, &_4, &_3, 0, 0, "phalcon/db/dialect/sqlite.zep", 123);
				for (
				  ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS
				  ; zephir_hash_move_forward_ex(_4, &_3)
				) {
					ZEPHIR_GET_HVALUE(value, _5);
					ZEPHIR_SINIT_NVAR(_6);
					ZVAL_STRING(&_6, "\"", 0);
					ZEPHIR_CALL_FUNCTION(&_0, "addcslashes", &_7, value, &_6);
					zephir_check_call_status();
					ZEPHIR_INIT_LNVAR(_1);
					ZEPHIR_CONCAT_SVS(_1, "\"", _0, "\", ");
					zephir_concat_self(&valueSql, _1 TSRMLS_CC);
				}
				ZEPHIR_SINIT_NVAR(_6);
				ZVAL_LONG(&_6, 0);
				ZEPHIR_SINIT_VAR(_8);
				ZVAL_LONG(&_8, -2);
				ZEPHIR_INIT_VAR(_9);
				zephir_substr(_9, valueSql, 0 , -2 , 0);
				ZEPHIR_INIT_VAR(_10);
				ZEPHIR_CONCAT_SVS(_10, "(", _9, ")");
				zephir_concat_self(&columnSql, _10 TSRMLS_CC);
			} else {
				ZEPHIR_SINIT_NVAR(_8);
				ZVAL_STRING(&_8, "\"", 0);
				ZEPHIR_CALL_FUNCTION(&_2, "addcslashes", &_7, typeValues, &_8);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_10);
				ZEPHIR_CONCAT_SVS(_10, "(\"", _2, "\")");
				zephir_concat_self(&columnSql, _10 TSRMLS_CC);
			}
		}
	} while(0);

	RETURN_CCTOR(columnSql);

}
コード例 #12
0
ファイル: sqlite.zep.c プロジェクト: Studentsov/cphalcon
/**
 * Generates SQL to create a table
 */
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) {

	HashTable *_1, *_18$$14, *_31$$18;
	HashPosition _0, _17$$14, _30$$18;
	zend_bool hasPrimary = 0, _7$$7, _9$$7, _20$$15, _21$$15;
	zephir_fcall_cache_entry *_5 = NULL, *_14 = NULL, *_25 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *definition = NULL;
	zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL, *columns = NULL, *table = NULL, *temporary = NULL, *options = NULL, *createLines = NULL, *columnLine = NULL, *column = NULL, *indexes = NULL, *index = NULL, *indexName = NULL, *indexType = NULL, *references = NULL, *reference = NULL, *defaultValue = NULL, *referenceSql = NULL, *onDelete = NULL, *onUpdate = NULL, *sql = NULL, **_2, *_41, *_42, *_3$$7 = NULL, *_4$$7 = NULL, *_6$$7 = NULL, *_8$$7 = NULL, *_10$$7 = NULL, *_16$$7 = NULL, *_11$$10 = NULL, _12$$12 = zval_used_for_init, *_13$$12 = NULL, *_15$$12 = NULL, **_19$$14, *_22$$15 = NULL, *_23$$16 = NULL, *_24$$16 = NULL, *_26$$16 = NULL, *_27$$17 = NULL, *_28$$17 = NULL, *_29$$17 = NULL, **_32$$18, *_33$$19 = NULL, *_34$$19 = NULL, *_35$$19 = NULL, *_36$$19 = NULL, *_37$$19 = NULL, *_38$$19 = NULL, *_39$$20 = NULL, *_40$$21 = NULL;
	zval *tableName = NULL, *schemaName = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_param);

	if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
		zephir_get_strval(tableName, tableName_param);
	} else {
		ZEPHIR_INIT_VAR(tableName);
		ZVAL_EMPTY_STRING(tableName);
	}
	if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
		zephir_get_strval(schemaName, schemaName_param);
	} else {
		ZEPHIR_INIT_VAR(schemaName);
		ZVAL_EMPTY_STRING(schemaName);
	}
	definition = definition_param;


	ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, tableName, schemaName);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(temporary);
	ZVAL_BOOL(temporary, 0);
	ZEPHIR_OBS_VAR(options);
	if (zephir_array_isset_string_fetch(&options, definition, SS("options"), 0 TSRMLS_CC)) {
		ZEPHIR_OBS_NVAR(temporary);
		zephir_array_isset_string_fetch(&temporary, options, SS("temporary"), 0 TSRMLS_CC);
	}
	ZEPHIR_OBS_VAR(columns);
	if (!(zephir_array_isset_string_fetch(&columns, definition, SS("columns"), 0 TSRMLS_CC))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'columns' is required in the definition array", "phalcon/db/dialect/sqlite.zep", 322);
		return;
	}
	ZEPHIR_INIT_VAR(sql);
	if (zephir_is_true(temporary)) {
		ZEPHIR_CONCAT_SVS(sql, "CREATE TEMPORARY TABLE ", table, " (\n\t");
	} else {
		ZEPHIR_CONCAT_SVS(sql, "CREATE TABLE ", table, " (\n\t");
	}
	hasPrimary = 0;
	ZEPHIR_INIT_VAR(createLines);
	array_init(createLines);
	zephir_is_iterable(columns, &_1, &_0, 0, 0, "phalcon/db/dialect/sqlite.zep", 380);
	for (
	  ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
	  ; zephir_hash_move_forward_ex(_1, &_0)
	) {
		ZEPHIR_GET_HVALUE(column, _2);
		ZEPHIR_CALL_METHOD(&_3$$7, column, "getname", NULL, 0);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(&_4$$7, this_ptr, "getcolumndefinition", &_5, 0, column);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(columnLine);
		ZEPHIR_CONCAT_SVSV(columnLine, "`", _3$$7, "` ", _4$$7);
		ZEPHIR_CALL_METHOD(&_6$$7, column, "isprimary", NULL, 0);
		zephir_check_call_status();
		_7$$7 = zephir_is_true(_6$$7);
		if (_7$$7) {
			_7$$7 = !hasPrimary;
		}
		if (_7$$7) {
			zephir_concat_self_str(&columnLine, SL(" PRIMARY KEY") TSRMLS_CC);
			hasPrimary = 1;
		}
		ZEPHIR_CALL_METHOD(&_8$$7, column, "isautoincrement", NULL, 0);
		zephir_check_call_status();
		_9$$7 = zephir_is_true(_8$$7);
		if (_9$$7) {
			_9$$7 = hasPrimary;
		}
		if (_9$$7) {
			zephir_concat_self_str(&columnLine, SL(" AUTOINCREMENT") TSRMLS_CC);
		}
		ZEPHIR_CALL_METHOD(&_10$$7, column, "hasdefault", NULL, 0);
		zephir_check_call_status();
		if (zephir_is_true(_10$$7)) {
			ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_11$$10);
			zephir_fast_strtoupper(_11$$10, defaultValue);
			if (zephir_memnstr_str(_11$$10, SL("CURRENT_TIMESTAMP"), "phalcon/db/dialect/sqlite.zep", 360)) {
				zephir_concat_self_str(&columnLine, SL(" DEFAULT CURRENT_TIMESTAMP") TSRMLS_CC);
			} else {
				ZEPHIR_SINIT_NVAR(_12$$12);
				ZVAL_STRING(&_12$$12, "\"", 0);
				ZEPHIR_CALL_FUNCTION(&_13$$12, "addcslashes", &_14, 153, defaultValue, &_12$$12);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_15$$12);
				ZEPHIR_CONCAT_SVS(_15$$12, " DEFAULT \"", _13$$12, "\"");
				zephir_concat_self(&columnLine, _15$$12 TSRMLS_CC);
			}
		}
		ZEPHIR_CALL_METHOD(&_16$$7, column, "isnotnull", NULL, 0);
		zephir_check_call_status();
		if (zephir_is_true(_16$$7)) {
			zephir_concat_self_str(&columnLine, SL(" NOT NULL") TSRMLS_CC);
		}
		zephir_array_append(&createLines, columnLine, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 374);
	}
	ZEPHIR_OBS_VAR(indexes);
	if (zephir_array_isset_string_fetch(&indexes, definition, SS("indexes"), 0 TSRMLS_CC)) {
		zephir_is_iterable(indexes, &_18$$14, &_17$$14, 0, 0, "phalcon/db/dialect/sqlite.zep", 396);
		for (
		  ; zephir_hash_get_current_data_ex(_18$$14, (void**) &_19$$14, &_17$$14) == SUCCESS
		  ; zephir_hash_move_forward_ex(_18$$14, &_17$$14)
		) {
			ZEPHIR_GET_HVALUE(index, _19$$14);
			ZEPHIR_CALL_METHOD(&indexName, index, "getname", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&indexType, index, "gettype", NULL, 0);
			zephir_check_call_status();
			_20$$15 = ZEPHIR_IS_STRING(indexName, "PRIMARY");
			if (_20$$15) {
				_20$$15 = !hasPrimary;
			}
			_21$$15 = !(ZEPHIR_IS_EMPTY(indexType));
			if (_21$$15) {
				ZEPHIR_INIT_NVAR(_22$$15);
				zephir_fast_strtoupper(_22$$15, indexType);
				_21$$15 = zephir_memnstr_str(_22$$15, SL("UNIQUE"), "phalcon/db/dialect/sqlite.zep", 392);
			}
			if (_20$$15) {
				ZEPHIR_CALL_METHOD(&_24$$16, index, "getcolumns", NULL, 0);
				zephir_check_call_status();
				ZEPHIR_CALL_METHOD(&_23$$16, this_ptr, "getcolumnlist", &_25, 54, _24$$16);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_26$$16);
				ZEPHIR_CONCAT_SVS(_26$$16, "PRIMARY KEY (", _23$$16, ")");
				zephir_array_append(&createLines, _26$$16, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 391);
			} else if (_21$$15) {
				ZEPHIR_CALL_METHOD(&_28$$17, index, "getcolumns", NULL, 0);
				zephir_check_call_status();
				ZEPHIR_CALL_METHOD(&_27$$17, this_ptr, "getcolumnlist", &_25, 54, _28$$17);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_29$$17);
				ZEPHIR_CONCAT_SVS(_29$$17, "UNIQUE (", _27$$17, ")");
				zephir_array_append(&createLines, _29$$17, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 393);
			}
		}
	}
	ZEPHIR_OBS_VAR(references);
	if (zephir_array_isset_string_fetch(&references, definition, SS("references"), 0 TSRMLS_CC)) {
		zephir_is_iterable(references, &_31$$18, &_30$$18, 0, 0, "phalcon/db/dialect/sqlite.zep", 418);
		for (
		  ; zephir_hash_get_current_data_ex(_31$$18, (void**) &_32$$18, &_30$$18) == SUCCESS
		  ; zephir_hash_move_forward_ex(_31$$18, &_30$$18)
		) {
			ZEPHIR_GET_HVALUE(reference, _32$$18);
			ZEPHIR_CALL_METHOD(&_33$$19, reference, "getname", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_35$$19, reference, "getcolumns", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_34$$19, this_ptr, "getcolumnlist", &_25, 54, _35$$19);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_36$$19, reference, "getreferencedtable", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_38$$19, reference, "getreferencedcolumns", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_37$$19, this_ptr, "getcolumnlist", &_25, 54, _38$$19);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(referenceSql);
			ZEPHIR_CONCAT_SVSVSSVSVS(referenceSql, "CONSTRAINT `", _33$$19, "` FOREIGN KEY (", _34$$19, ")", " REFERENCES `", _36$$19, "`(", _37$$19, ")");
			ZEPHIR_CALL_METHOD(&onDelete, reference, "getondelete", NULL, 0);
			zephir_check_call_status();
			if (!(ZEPHIR_IS_EMPTY(onDelete))) {
				ZEPHIR_INIT_LNVAR(_39$$20);
				ZEPHIR_CONCAT_SV(_39$$20, " ON DELETE ", onDelete);
				zephir_concat_self(&referenceSql, _39$$20 TSRMLS_CC);
			}
			ZEPHIR_CALL_METHOD(&onUpdate, reference, "getonupdate", NULL, 0);
			zephir_check_call_status();
			if (!(ZEPHIR_IS_EMPTY(onUpdate))) {
				ZEPHIR_INIT_LNVAR(_40$$21);
				ZEPHIR_CONCAT_SV(_40$$21, " ON UPDATE ", onUpdate);
				zephir_concat_self(&referenceSql, _40$$21 TSRMLS_CC);
			}
			zephir_array_append(&createLines, referenceSql, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 416);
		}
	}
	ZEPHIR_INIT_VAR(_41);
	zephir_fast_join_str(_41, SL(",\n\t"), createLines TSRMLS_CC);
	ZEPHIR_INIT_VAR(_42);
	ZEPHIR_CONCAT_VS(_42, _41, "\n)");
	zephir_concat_self(&sql, _42 TSRMLS_CC);
	RETURN_CCTOR(sql);

}
コード例 #13
0
ファイル: sqlite.zep.c プロジェクト: Studentsov/cphalcon
/**
 * Gets the column name in SQLite
 */
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, getColumnDefinition) {

	HashTable *_13$$41;
	HashPosition _12$$41;
	zephir_fcall_cache_entry *_17 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *column, *columnSql = NULL, *type = NULL, *typeValues = NULL, *_0$$8 = NULL, *_1$$8, *_2$$10 = NULL, *_3$$10 = NULL, *_4$$10, *_5$$16 = NULL, *_6$$16, *_7$$24 = NULL, *_8$$27 = NULL, *_9$$39, *_10$$39 = NULL, *_11$$39, *value$$41 = NULL, *valueSql$$41 = NULL, **_14$$41, _19$$41, _20$$41, *_21$$41, *_22$$41, _15$$42 = zval_used_for_init, *_16$$42 = NULL, *_18$$42 = NULL, _23$$43, *_24$$43 = NULL, *_25$$43;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &column);



	ZEPHIR_INIT_VAR(columnSql);
	ZVAL_STRING(columnSql, "", 1);
	ZEPHIR_CALL_METHOD(&type, column, "gettype", NULL, 0);
	zephir_check_call_status();
	if (Z_TYPE_P(type) == IS_STRING) {
		zephir_concat_self(&columnSql, type TSRMLS_CC);
		ZEPHIR_CALL_METHOD(&type, column, "gettypereference", NULL, 0);
		zephir_check_call_status();
	}
	do {
		if (ZEPHIR_IS_LONG(type, 0)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("INTEGER") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 1)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("DATE") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 2)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("VARCHAR") TSRMLS_CC);
			}
			ZEPHIR_CALL_METHOD(&_0$$8, column, "getsize", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_1$$8);
			ZEPHIR_CONCAT_SVS(_1$$8, "(", _0$$8, ")");
			zephir_concat_self(&columnSql, _1$$8 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(type, 3)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("NUMERIC") TSRMLS_CC);
			}
			ZEPHIR_CALL_METHOD(&_2$$10, column, "getsize", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_3$$10, column, "getscale", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_4$$10);
			ZEPHIR_CONCAT_SVSVS(_4$$10, "(", _2$$10, ",", _3$$10, ")");
			zephir_concat_self(&columnSql, _4$$10 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(type, 4)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("DATETIME") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 17)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("TIMESTAMP") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 5)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("CHARACTER") TSRMLS_CC);
			}
			ZEPHIR_CALL_METHOD(&_5$$16, column, "getsize", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_6$$16);
			ZEPHIR_CONCAT_SVS(_6$$16, "(", _5$$16, ")");
			zephir_concat_self(&columnSql, _6$$16 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(type, 6)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("TEXT") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 8)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("TINYINT") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 7)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("FLOAT") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 9)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("DOUBLE") TSRMLS_CC);
			}
			ZEPHIR_CALL_METHOD(&_7$$24, column, "isunsigned", NULL, 0);
			zephir_check_call_status();
			if (zephir_is_true(_7$$24)) {
				zephir_concat_self_str(&columnSql, SL(" UNSIGNED") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 14)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("BIGINT") TSRMLS_CC);
			}
			ZEPHIR_CALL_METHOD(&_8$$27, column, "isunsigned", NULL, 0);
			zephir_check_call_status();
			if (zephir_is_true(_8$$27)) {
				zephir_concat_self_str(&columnSql, SL(" UNSIGNED") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 10)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("TINYBLOB") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 11)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("BLOB") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 12)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("MEDIUMBLOB") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 13)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("LONGBLOB") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_EMPTY(columnSql)) {
			ZEPHIR_INIT_VAR(_9$$39);
			object_init_ex(_9$$39, phalcon_db_exception_ce);
			ZEPHIR_CALL_METHOD(&_10$$39, column, "getname", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_11$$39);
			ZEPHIR_CONCAT_SV(_11$$39, "Unrecognized SQLite data type at column ", _10$$39);
			ZEPHIR_CALL_METHOD(NULL, _9$$39, "__construct", NULL, 9, _11$$39);
			zephir_check_call_status();
			zephir_throw_exception_debug(_9$$39, "phalcon/db/dialect/sqlite.zep", 169 TSRMLS_CC);
			ZEPHIR_MM_RESTORE();
			return;
		}
		ZEPHIR_CALL_METHOD(&typeValues, column, "gettypevalues", NULL, 0);
		zephir_check_call_status();
		if (!(ZEPHIR_IS_EMPTY(typeValues))) {
			if (Z_TYPE_P(typeValues) == IS_ARRAY) {
				ZEPHIR_INIT_VAR(valueSql$$41);
				ZVAL_STRING(valueSql$$41, "", 1);
				zephir_is_iterable(typeValues, &_13$$41, &_12$$41, 0, 0, "phalcon/db/dialect/sqlite.zep", 180);
				for (
				  ; zephir_hash_get_current_data_ex(_13$$41, (void**) &_14$$41, &_12$$41) == SUCCESS
				  ; zephir_hash_move_forward_ex(_13$$41, &_12$$41)
				) {
					ZEPHIR_GET_HVALUE(value$$41, _14$$41);
					ZEPHIR_SINIT_NVAR(_15$$42);
					ZVAL_STRING(&_15$$42, "\"", 0);
					ZEPHIR_CALL_FUNCTION(&_16$$42, "addcslashes", &_17, 153, value$$41, &_15$$42);
					zephir_check_call_status();
					ZEPHIR_INIT_LNVAR(_18$$42);
					ZEPHIR_CONCAT_SVS(_18$$42, "\"", _16$$42, "\", ");
					zephir_concat_self(&valueSql$$41, _18$$42 TSRMLS_CC);
				}
				ZEPHIR_SINIT_VAR(_19$$41);
				ZVAL_LONG(&_19$$41, 0);
				ZEPHIR_SINIT_VAR(_20$$41);
				ZVAL_LONG(&_20$$41, -2);
				ZEPHIR_INIT_VAR(_21$$41);
				zephir_substr(_21$$41, valueSql$$41, 0 , -2 , 0);
				ZEPHIR_INIT_VAR(_22$$41);
				ZEPHIR_CONCAT_SVS(_22$$41, "(", _21$$41, ")");
				zephir_concat_self(&columnSql, _22$$41 TSRMLS_CC);
			} else {
				ZEPHIR_SINIT_VAR(_23$$43);
				ZVAL_STRING(&_23$$43, "\"", 0);
				ZEPHIR_CALL_FUNCTION(&_24$$43, "addcslashes", &_17, 153, typeValues, &_23$$43);
				zephir_check_call_status();
				ZEPHIR_INIT_VAR(_25$$43);
				ZEPHIR_CONCAT_SVS(_25$$43, "(\"", _24$$43, "\")");
				zephir_concat_self(&columnSql, _25$$43 TSRMLS_CC);
			}
		}
	} while(0);

	RETURN_CCTOR(columnSql);

}
コード例 #14
0
ファイル: sqlite.zep.c プロジェクト: Studentsov/cphalcon
/**
 * Generates SQL to add a column to a table
 */
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addColumn) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *tableName_param = NULL, *schemaName_param = NULL, *column, *sql = NULL, *defaultValue = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3, *_4 = NULL, *_9 = NULL, *_10 = NULL, *_5$$3, _6$$5, *_7$$5 = NULL, *_8$$5;
	zval *tableName = NULL, *schemaName = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column);

	if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
		zephir_get_strval(tableName, tableName_param);
	} else {
		ZEPHIR_INIT_VAR(tableName);
		ZVAL_EMPTY_STRING(tableName);
	}
	if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
		zephir_get_strval(schemaName, schemaName_param);
	} else {
		ZEPHIR_INIT_VAR(schemaName);
		ZVAL_EMPTY_STRING(schemaName);
	}


	ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, tableName, schemaName);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(sql);
	ZEPHIR_CONCAT_SVS(sql, "ALTER TABLE ", _0, " ADD COLUMN ");
	ZEPHIR_CALL_METHOD(&_1, column, "getname", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&_2, this_ptr, "getcolumndefinition", NULL, 0, column);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_3);
	ZEPHIR_CONCAT_SVSV(_3, "\"", _1, "\" ", _2);
	zephir_concat_self(&sql, _3 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_4, column, "hasdefault", NULL, 0);
	zephir_check_call_status();
	if (zephir_is_true(_4)) {
		ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_5$$3);
		zephir_fast_strtoupper(_5$$3, defaultValue);
		if (zephir_memnstr_str(_5$$3, SL("CURRENT_TIMESTAMP"), "phalcon/db/dialect/sqlite.zep", 203)) {
			zephir_concat_self_str(&sql, SL(" DEFAULT CURRENT_TIMESTAMP") TSRMLS_CC);
		} else {
			ZEPHIR_SINIT_VAR(_6$$5);
			ZVAL_STRING(&_6$$5, "\"", 0);
			ZEPHIR_CALL_FUNCTION(&_7$$5, "addcslashes", NULL, 153, defaultValue, &_6$$5);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_8$$5);
			ZEPHIR_CONCAT_SVS(_8$$5, " DEFAULT \"", _7$$5, "\"");
			zephir_concat_self(&sql, _8$$5 TSRMLS_CC);
		}
	}
	ZEPHIR_CALL_METHOD(&_9, column, "isnotnull", NULL, 0);
	zephir_check_call_status();
	if (zephir_is_true(_9)) {
		zephir_concat_self_str(&sql, SL(" NOT NULL") TSRMLS_CC);
	}
	ZEPHIR_CALL_METHOD(&_10, column, "isautoincrement", NULL, 0);
	zephir_check_call_status();
	if (zephir_is_true(_10)) {
		zephir_concat_self_str(&sql, SL(" PRIMARY KEY AUTOINCREMENT") TSRMLS_CC);
	}
	RETURN_CCTOR(sql);

}
コード例 #15
0
ファイル: classloader.zep.c プロジェクト: wells5609/xpl
/**
 * Returns a ClassLoader for the given Composer installation.
 *
 * @param string vendorPath
 * @param boolean prepend [Optional] Default = true
 *
 * @return \Xpl\ClassLoader
 */
PHP_METHOD(Xpl_ClassLoader, composer) {

	HashTable *_8, *_12, *_18$$10;
	HashPosition _7, _11, _17$$10;
	zephir_fcall_cache_entry *_10 = NULL, *_14 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zend_bool prepend;
	zval *vendorPath_param = NULL, *prepend_param = NULL, *composerPath = NULL, *instances = NULL, *loader = NULL, *ns = NULL, *path = NULL, *namespaces = NULL, *psr4 = NULL, *classMap = NULL, *filesPath = NULL, *files = NULL, *_0, _1, *_2, *_3, *_4 = NULL, *_5, *_6, **_9, **_13, *_15, *_16$$10 = NULL, **_19$$10;
	zval *vendorPath = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &vendorPath_param, &prepend_param);

	if (unlikely(Z_TYPE_P(vendorPath_param) != IS_STRING && Z_TYPE_P(vendorPath_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'vendorPath' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(vendorPath_param) == IS_STRING)) {
		zephir_get_strval(vendorPath, vendorPath_param);
	} else {
		ZEPHIR_INIT_VAR(vendorPath);
		ZVAL_EMPTY_STRING(vendorPath);
	}
	if (!prepend_param) {
		prepend = 1;
	} else {
		prepend = zephir_get_boolval(prepend_param);
	}


	ZEPHIR_INIT_VAR(_0);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_STRING(&_1, "/\\", 0);
	zephir_fast_trim(_0, vendorPath, &_1, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
	ZEPHIR_INIT_VAR(_2);
	ZEPHIR_CONCAT_VS(_2, _0, "/composer");
	ZEPHIR_CALL_FUNCTION(&composerPath, "realpath", NULL, 47, _2);
	zephir_check_call_status();
	if (!(zephir_is_true(composerPath))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Composer directory does not exist", "xpl/classloader.zep", 147);
		return;
	}
	zephir_concat_self_str(&composerPath, SL("/") TSRMLS_CC);
	ZEPHIR_OBS_VAR(instances);
	zephir_read_static_property_ce(&instances, xpl_classloader_ce, SL("composerInstances") TSRMLS_CC);
	if (Z_TYPE_P(instances) != IS_NULL) {
		ZEPHIR_OBS_VAR(loader);
		if (zephir_array_isset_fetch(&loader, instances, composerPath, 0 TSRMLS_CC)) {
			RETURN_CCTOR(loader);
		}
	} else {
		ZEPHIR_INIT_NVAR(instances);
		array_init(instances);
	}
	ZEPHIR_INIT_NVAR(loader);
	object_init_ex(loader, xpl_classloader_ce);
	if (zephir_has_constructor(loader TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, loader, "__construct", NULL, 0);
		zephir_check_call_status();
	}
	ZEPHIR_INIT_VAR(_3);
	ZEPHIR_CONCAT_VS(_3, composerPath, "autoload_namespaces.php");
	ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&_4);
	if (zephir_require_zval_ret(&_4, _3 TSRMLS_CC) == FAILURE) {
		RETURN_MM_NULL();
	}
	ZEPHIR_CPY_WRT(namespaces, _4);
	ZEPHIR_INIT_VAR(_5);
	ZEPHIR_CONCAT_VS(_5, composerPath, "autoload_psr4.php");
	ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&_4);
	if (zephir_require_zval_ret(&_4, _5 TSRMLS_CC) == FAILURE) {
		RETURN_MM_NULL();
	}
	ZEPHIR_CPY_WRT(psr4, _4);
	ZEPHIR_INIT_VAR(_6);
	ZEPHIR_CONCAT_VS(_6, composerPath, "autoload_classmap.php");
	ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&_4);
	if (zephir_require_zval_ret(&_4, _6 TSRMLS_CC) == FAILURE) {
		RETURN_MM_NULL();
	}
	ZEPHIR_CPY_WRT(classMap, _4);
	ZEPHIR_INIT_VAR(filesPath);
	ZEPHIR_CONCAT_VS(filesPath, composerPath, "autoload_files.php");
	zephir_is_iterable(namespaces, &_8, &_7, 0, 0, "xpl/classloader.zep", 171);
	for (
	  ; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS
	  ; zephir_hash_move_forward_ex(_8, &_7)
	) {
		ZEPHIR_GET_HMKEY(ns, _8, _7);
		ZEPHIR_GET_HVALUE(path, _9);
		ZEPHIR_CALL_METHOD(NULL, loader, "set", &_10, 48, ns, path);
		zephir_check_call_status();
	}
	zephir_is_iterable(psr4, &_12, &_11, 0, 0, "xpl/classloader.zep", 175);
	for (
	  ; zephir_hash_get_current_data_ex(_12, (void**) &_13, &_11) == SUCCESS
	  ; zephir_hash_move_forward_ex(_12, &_11)
	) {
		ZEPHIR_GET_HMKEY(ns, _12, _11);
		ZEPHIR_GET_HVALUE(path, _13);
		ZEPHIR_CALL_METHOD(NULL, loader, "setpsr4", &_14, 49, ns, path);
		zephir_check_call_status();
	}
	if (zephir_fast_count_int(classMap TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, loader, "addclassmap", NULL, 50, classMap);
		zephir_check_call_status();
	}
	ZEPHIR_INIT_VAR(_15);
	if (prepend) {
		ZVAL_BOOL(_15, 1);
	} else {
		ZVAL_BOOL(_15, 0);
	}
	ZEPHIR_CALL_METHOD(NULL, loader, "register", NULL, 51, _15);
	zephir_check_call_status();
	if ((zephir_file_exists(filesPath TSRMLS_CC) == SUCCESS)) {
		ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(&_16$$10);
		if (zephir_require_zval_ret(&_16$$10, filesPath TSRMLS_CC) == FAILURE) {
			RETURN_MM_NULL();
		}
		ZEPHIR_CPY_WRT(files, _16$$10);
		zephir_is_iterable(files, &_18$$10, &_17$$10, 0, 0, "xpl/classloader.zep", 186);
		for (
		  ; zephir_hash_get_current_data_ex(_18$$10, (void**) &_19$$10, &_17$$10) == SUCCESS
		  ; zephir_hash_move_forward_ex(_18$$10, &_17$$10)
		) {
			ZEPHIR_GET_HVALUE(path, _19$$10);
			if (zephir_require_zval(path TSRMLS_CC) == FAILURE) {
				RETURN_MM_NULL();
			}
		}
	}
	ZEPHIR_CALL_METHOD(NULL, loader, "setcomposerpath", NULL, 52, composerPath);
	zephir_check_call_status();
	zephir_array_update_zval(&instances, composerPath, &loader, PH_COPY | PH_SEPARATE);
	zephir_update_static_property_ce(xpl_classloader_ce, SL("composerInstances"), &instances TSRMLS_CC);
	RETURN_CCTOR(loader);

}
コード例 #16
0
ファイル: oracle.zep.c プロジェクト: 8V017UW2RQ70/cphalcon
/**
 * Generates the SQL for LIMIT clause
 */
PHP_METHOD(Phalcon_Db_Dialect_Oracle, limit) {

	int limit = 0, offset;
	zval *sqlQuery_param = NULL, *number, *_0$$4, *_1$$4, _2$$4, *_3$$3, *_4$$3, _5$$3, *_6$$5, _7$$5, _9$$6, _11$$7;
	zval *sqlQuery = NULL, *_8, *_10$$6, *_12$$7;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &sqlQuery_param, &number);

	if (unlikely(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(sqlQuery_param) == IS_STRING)) {
		zephir_get_strval(sqlQuery, sqlQuery_param);
	} else {
		ZEPHIR_INIT_VAR(sqlQuery);
		ZVAL_EMPTY_STRING(sqlQuery);
	}


	offset = 0;
	if (Z_TYPE_P(number) == IS_ARRAY) {
		if (zephir_array_isset_long(number, 1)) {
			ZEPHIR_INIT_VAR(_0$$4);
			zephir_array_fetch_long(&_1$$4, number, 1, PH_NOISY | PH_READONLY, "phalcon/db/dialect/oracle.zep", 51 TSRMLS_CC);
			ZEPHIR_SINIT_VAR(_2$$4);
			ZVAL_STRING(&_2$$4, "'", 0);
			zephir_fast_trim(_0$$4, _1$$4, &_2$$4, ZEPHIR_TRIM_BOTH TSRMLS_CC);
			offset = zephir_get_intval(_0$$4);
		}
		ZEPHIR_INIT_VAR(_3$$3);
		zephir_array_fetch_long(&_4$$3, number, 0, PH_NOISY | PH_READONLY, "phalcon/db/dialect/oracle.zep", 54 TSRMLS_CC);
		ZEPHIR_SINIT_VAR(_5$$3);
		ZVAL_STRING(&_5$$3, "'", 0);
		zephir_fast_trim(_3$$3, _4$$3, &_5$$3, ZEPHIR_TRIM_BOTH TSRMLS_CC);
		limit = (zephir_get_intval(_3$$3) + offset);
	} else {
		ZEPHIR_INIT_VAR(_6$$5);
		ZEPHIR_SINIT_VAR(_7$$5);
		ZVAL_STRING(&_7$$5, "'", 0);
		zephir_fast_trim(_6$$5, number, &_7$$5, ZEPHIR_TRIM_BOTH TSRMLS_CC);
		limit = zephir_get_intval(_6$$5);
	}
	ZEPHIR_INIT_VAR(_8);
	ZEPHIR_CONCAT_SVS(_8, "SELECT * FROM (SELECT Z1.*, ROWNUM PHALCON_RN FROM (", sqlQuery, ") Z1");
	ZEPHIR_CPY_WRT(sqlQuery, _8);
	if (limit != 0) {
		ZEPHIR_SINIT_VAR(_9$$6);
		ZVAL_LONG(&_9$$6, limit);
		ZEPHIR_INIT_VAR(_10$$6);
		ZEPHIR_CONCAT_SV(_10$$6, " WHERE ROWNUM <= ", &_9$$6);
		zephir_concat_self(&sqlQuery, _10$$6 TSRMLS_CC);
	}
	zephir_concat_self_str(&sqlQuery, ")", sizeof(")")-1 TSRMLS_CC);
	if (offset != 0) {
		ZEPHIR_SINIT_VAR(_11$$7);
		ZVAL_LONG(&_11$$7, offset);
		ZEPHIR_INIT_VAR(_12$$7);
		ZEPHIR_CONCAT_SV(_12$$7, " WHERE PHALCON_RN >= ", &_11$$7);
		zephir_concat_self(&sqlQuery, _12$$7 TSRMLS_CC);
	}
	RETURN_CTOR(sqlQuery);

}
コード例 #17
0
ファイル: dump.zep.c プロジェクト: SDpower/cphalcon
/**
 * Prepare an HTML string of information about a single variable.
 */
PHP_METHOD(Phalcon_Debug_Dump, output) {

	zend_bool _17$$5, _18$$5, _19$$5;
	HashTable *_8$$4, *_42$$11, *_76$$20;
	HashPosition _7$$4, _41$$11, _75$$20;
	zval *_123, *_1$$4, *_13$$5 = NULL, *_26$$8, *_68$$8, *_32$$9, *_46$$12 = NULL, *_60$$14 = NULL, *_81$$22 = NULL, *_87$$23 = NULL, *_95$$24, *_100$$25, *_104$$26, *_108$$27, *_114$$28, *_119$$29;
	zephir_fcall_cache_entry *_4 = NULL, *_6 = NULL, *_12 = NULL, *_23 = NULL, *_31 = NULL, *_53 = NULL, *_57 = NULL, *_62 = NULL;
	int tab, ZEPHIR_LAST_CALL_STATUS;
	zval *name = NULL, *_0$$3;
	zval *variable, *name_param = NULL, *tab_param = NULL, *key = NULL, *value = NULL, *output = NULL, *space = NULL, *type = NULL, *attr = NULL, *_99 = NULL, *_124 = NULL, *_125, _126, *_2$$4 = NULL, *_3$$4, _5$$4 = zval_used_for_init, **_9$$4, *_25$$4 = NULL, _10$$5 = zval_used_for_init, *_11$$5 = NULL, *_14$$5 = NULL, *_15$$5 = NULL, *_16$$5 = NULL, *_20$$7 = NULL, *_21$$7 = NULL, *_22$$7 = NULL, *_24$$7 = NULL, *_27$$8 = NULL, *_28$$8 = NULL, _29$$8 = zval_used_for_init, *_30$$8 = NULL, *_36$$8, *_67$$8 = NULL, *_69$$8 = NULL, *_70$$8, *_71$$8, *_94$$8 = NULL, *_33$$9 = NULL, *_34$$9, _35$$9, _37$$10, *_38$$10 = NULL, *_39$$10, *_40$$11 = NULL, **_43$$11, _44$$12 = zval_used_for_init, *_45$$12 = NULL, *_47$$12 = NULL, *_48$$12 = NULL, *_49$$12 = NULL, *_50$$12 = NULL, *_51$$12 = NULL, *_52$$12 = NULL, *_54$$14 = NULL, _55$$14 = zval_used_for_init, *_56$$14 = NULL, *_59$$14 = NULL, *_61$$14 = NULL, *_63$$14 = NULL, *_64$$14 = NULL, *_65$$14 = NULL, *_66$$14 = NULL, *_58$$17, _72$$19, *_73$$19 = NULL, *_74$$19, **_77$$20, _91$$20, *_92$$20 = NULL, *_93$$20, *_78$$21 = NULL, _79$$22 = zval_used_for_init, *_80$$22 = NULL, *_82$$22 = NULL, *_83$$22 = NULL, *_84$$22 = NULL, _85$$23 = zval_used_for_init, *_86$$23 = NULL, *_88$$23 = NULL, *_89$$23 = NULL, *_90$$23 = NULL, *_96$$24 = NULL, *_97$$24, _98$$24, *_101$$25 = NULL, *_102$$25, _103$$25, *_105$$26 = NULL, *_106$$26, _107$$26, *_109$$27 = NULL, *_110$$27, _111$$27 = zval_used_for_init, _112$$27, *_113$$27 = NULL, *_115$$28 = NULL, *_116$$28, *_117$$28 = NULL, _118$$28, *_120$$29 = NULL, *_121$$29, _122$$29;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 2, &variable, &name_param, &tab_param);

	if (!name_param) {
		ZEPHIR_INIT_VAR(name);
		ZVAL_EMPTY_STRING(name);
	} else {
		zephir_get_strval(name, name_param);
	}
	if (!tab_param) {
		tab = 1;
	} else {
		tab = zephir_get_intval(tab_param);
	}


	ZEPHIR_INIT_VAR(space);
	ZVAL_STRING(space, "  ", 1);
	ZEPHIR_INIT_VAR(output);
	ZVAL_STRING(output, "", 1);
	if (!(!name) && Z_STRLEN_P(name)) {
		ZEPHIR_INIT_VAR(_0$$3);
		ZEPHIR_CONCAT_VS(_0$$3, name, " ");
		ZEPHIR_CPY_WRT(output, _0$$3);
	}
	if (Z_TYPE_P(variable) == IS_ARRAY) {
		ZEPHIR_INIT_VAR(_1$$4);
		zephir_create_array(_1$$4, 2, 0 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_3$$4);
		ZVAL_STRING(_3$$4, "arr", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_2$$4, this_ptr, "getstyle", &_4, 0, _3$$4);
		zephir_check_temp_parameter(_3$$4);
		zephir_check_call_status();
		zephir_array_update_string(&_1$$4, SL(":style"), &_2$$4, PH_COPY | PH_SEPARATE);
		add_assoc_long_ex(_1$$4, SS(":count"), zephir_fast_count_int(variable TSRMLS_CC));
		ZEPHIR_SINIT_VAR(_5$$4);
		ZVAL_STRING(&_5$$4, "<b style =':style'>Array</b> (<span style =':style'>:count</span>) (\n", 0);
		ZEPHIR_CALL_FUNCTION(&_2$$4, "strtr", &_6, 26, &_5$$4, _1$$4);
		zephir_check_call_status();
		zephir_concat_self(&output, _2$$4 TSRMLS_CC);
		zephir_is_iterable(variable, &_8$$4, &_7$$4, 0, 0, "phalcon/debug/dump.zep", 156);
		for (
		  ; zephir_hash_get_current_data_ex(_8$$4, (void**) &_9$$4, &_7$$4) == SUCCESS
		  ; zephir_hash_move_forward_ex(_8$$4, &_7$$4)
		) {
			ZEPHIR_GET_HMKEY(key, _8$$4, _7$$4);
			ZEPHIR_GET_HVALUE(value, _9$$4);
			ZEPHIR_SINIT_NVAR(_10$$5);
			ZVAL_LONG(&_10$$5, tab);
			ZEPHIR_CALL_FUNCTION(&_11$$5, "str_repeat", &_12, 142, space, &_10$$5);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_13$$5);
			zephir_create_array(_13$$5, 2, 0 TSRMLS_CC);
			ZEPHIR_INIT_NVAR(_15$$5);
			ZVAL_STRING(_15$$5, "arr", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&_14$$5, this_ptr, "getstyle", &_4, 0, _15$$5);
			zephir_check_temp_parameter(_15$$5);
			zephir_check_call_status();
			zephir_array_update_string(&_13$$5, SL(":style"), &_14$$5, PH_COPY | PH_SEPARATE);
			zephir_array_update_string(&_13$$5, SL(":key"), &key, PH_COPY | PH_SEPARATE);
			ZEPHIR_SINIT_NVAR(_10$$5);
			ZVAL_STRING(&_10$$5, "[<span style=':style'>:key</span>] => ", 0);
			ZEPHIR_CALL_FUNCTION(&_14$$5, "strtr", &_6, 26, &_10$$5, _13$$5);
			zephir_check_call_status();
			ZEPHIR_INIT_LNVAR(_16$$5);
			ZEPHIR_CONCAT_VV(_16$$5, _11$$5, _14$$5);
			zephir_concat_self(&output, _16$$5 TSRMLS_CC);
			_17$$5 = tab == 1;
			if (_17$$5) {
				_17$$5 = !ZEPHIR_IS_STRING(name, "");
			}
			_18$$5 = _17$$5;
			if (_18$$5) {
				_18$$5 = !(Z_TYPE_P(key) == IS_LONG);
			}
			_19$$5 = _18$$5;
			if (_19$$5) {
				_19$$5 = ZEPHIR_IS_EQUAL(name, key);
			}
			if (_19$$5) {
				continue;
			} else {
				ZEPHIR_INIT_NVAR(_21$$7);
				ZVAL_STRING(_21$$7, "", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_INIT_NVAR(_22$$7);
				ZVAL_LONG(_22$$7, (tab + 1));
				ZEPHIR_CALL_METHOD(&_20$$7, this_ptr, "output", &_23, 175, value, _21$$7, _22$$7);
				zephir_check_temp_parameter(_21$$7);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_24$$7);
				ZEPHIR_CONCAT_VS(_24$$7, _20$$7, "\n");
				zephir_concat_self(&output, _24$$7 TSRMLS_CC);
			}
		}
		ZEPHIR_SINIT_NVAR(_5$$4);
		ZVAL_LONG(&_5$$4, (tab - 1));
		ZEPHIR_CALL_FUNCTION(&_25$$4, "str_repeat", &_12, 142, space, &_5$$4);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VVS(return_value, output, _25$$4, ")");
		RETURN_MM();
	}
	if (Z_TYPE_P(variable) == IS_OBJECT) {
		ZEPHIR_INIT_VAR(_26$$8);
		zephir_create_array(_26$$8, 2, 0 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_28$$8);
		ZVAL_STRING(_28$$8, "obj", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_27$$8, this_ptr, "getstyle", &_4, 0, _28$$8);
		zephir_check_temp_parameter(_28$$8);
		zephir_check_call_status();
		zephir_array_update_string(&_26$$8, SL(":style"), &_27$$8, PH_COPY | PH_SEPARATE);
		ZEPHIR_INIT_NVAR(_28$$8);
		zephir_get_class(_28$$8, variable, 0 TSRMLS_CC);
		zephir_array_update_string(&_26$$8, SL(":class"), &_28$$8, PH_COPY | PH_SEPARATE);
		ZEPHIR_SINIT_VAR(_29$$8);
		ZVAL_STRING(&_29$$8, "<b style=':style'>Object</b> :class", 0);
		ZEPHIR_CALL_FUNCTION(&_27$$8, "strtr", &_6, 26, &_29$$8, _26$$8);
		zephir_check_call_status();
		zephir_concat_self(&output, _27$$8 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_30$$8, "get_parent_class", &_31, 176, variable);
		zephir_check_call_status();
		if (zephir_is_true(_30$$8)) {
			ZEPHIR_INIT_VAR(_32$$9);
			zephir_create_array(_32$$9, 2, 0 TSRMLS_CC);
			ZEPHIR_INIT_VAR(_34$$9);
			ZVAL_STRING(_34$$9, "obj", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&_33$$9, this_ptr, "getstyle", &_4, 0, _34$$9);
			zephir_check_temp_parameter(_34$$9);
			zephir_check_call_status();
			zephir_array_update_string(&_32$$9, SL(":style"), &_33$$9, PH_COPY | PH_SEPARATE);
			ZEPHIR_CALL_FUNCTION(&_33$$9, "get_parent_class", &_31, 176, variable);
			zephir_check_call_status();
			zephir_array_update_string(&_32$$9, SL(":parent"), &_33$$9, PH_COPY | PH_SEPARATE);
			ZEPHIR_SINIT_VAR(_35$$9);
			ZVAL_STRING(&_35$$9, " <b style=':style'>extends</b> :parent", 0);
			ZEPHIR_CALL_FUNCTION(&_33$$9, "strtr", &_6, 26, &_35$$9, _32$$9);
			zephir_check_call_status();
			zephir_concat_self(&output, _33$$9 TSRMLS_CC);
		}
		zephir_concat_self_str(&output, SL(" (\n") TSRMLS_CC);
		_36$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_detailed"), PH_NOISY_CC);
		if (zephir_instance_of_ev(variable, phalcon_di_ce TSRMLS_CC)) {
			ZEPHIR_SINIT_VAR(_37$$10);
			ZVAL_LONG(&_37$$10, tab);
			ZEPHIR_CALL_FUNCTION(&_38$$10, "str_repeat", &_12, 142, space, &_37$$10);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_39$$10);
			ZEPHIR_CONCAT_VS(_39$$10, _38$$10, "[skipped]\n");
			zephir_concat_self(&output, _39$$10 TSRMLS_CC);
		} else if (!(zephir_is_true(_36$$8))) {
			ZEPHIR_CALL_FUNCTION(&_40$$11, "get_object_vars", NULL, 21, variable);
			zephir_check_call_status();
			zephir_is_iterable(_40$$11, &_42$$11, &_41$$11, 0, 0, "phalcon/debug/dump.zep", 177);
			for (
			  ; zephir_hash_get_current_data_ex(_42$$11, (void**) &_43$$11, &_41$$11) == SUCCESS
			  ; zephir_hash_move_forward_ex(_42$$11, &_41$$11)
			) {
				ZEPHIR_GET_HMKEY(key, _42$$11, _41$$11);
				ZEPHIR_GET_HVALUE(value, _43$$11);
				ZEPHIR_SINIT_NVAR(_44$$12);
				ZVAL_LONG(&_44$$12, tab);
				ZEPHIR_CALL_FUNCTION(&_45$$12, "str_repeat", &_12, 142, space, &_44$$12);
				zephir_check_call_status();
				ZEPHIR_INIT_NVAR(_46$$12);
				zephir_create_array(_46$$12, 3, 0 TSRMLS_CC);
				ZEPHIR_INIT_NVAR(_48$$12);
				ZVAL_STRING(_48$$12, "obj", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&_47$$12, this_ptr, "getstyle", &_4, 0, _48$$12);
				zephir_check_temp_parameter(_48$$12);
				zephir_check_call_status();
				zephir_array_update_string(&_46$$12, SL(":style"), &_47$$12, PH_COPY | PH_SEPARATE);
				zephir_array_update_string(&_46$$12, SL(":key"), &key, PH_COPY | PH_SEPARATE);
				add_assoc_stringl_ex(_46$$12, SS(":type"), SL("public"), 1);
				ZEPHIR_SINIT_NVAR(_44$$12);
				ZVAL_STRING(&_44$$12, "-><span style=':style'>:key</span> (<span style=':style'>:type</span>) = ", 0);
				ZEPHIR_CALL_FUNCTION(&_47$$12, "strtr", &_6, 26, &_44$$12, _46$$12);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_49$$12);
				ZEPHIR_CONCAT_VV(_49$$12, _45$$12, _47$$12);
				zephir_concat_self(&output, _49$$12 TSRMLS_CC);
				ZEPHIR_INIT_NVAR(_48$$12);
				ZVAL_STRING(_48$$12, "", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_INIT_NVAR(_51$$12);
				ZVAL_LONG(_51$$12, (tab + 1));
				ZEPHIR_CALL_METHOD(&_50$$12, this_ptr, "output", &_23, 175, value, _48$$12, _51$$12);
				zephir_check_temp_parameter(_48$$12);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_52$$12);
				ZEPHIR_CONCAT_VS(_52$$12, _50$$12, "\n");
				zephir_concat_self(&output, _52$$12 TSRMLS_CC);
			}
		} else {
			do {
				ZEPHIR_MAKE_REF(variable);
				ZEPHIR_CALL_FUNCTION(&attr, "each", &_53, 177, variable);
				ZEPHIR_UNREF(variable);
				zephir_check_call_status();
				if (!(zephir_is_true(attr))) {
					continue;
				}
				ZEPHIR_OBS_NVAR(key);
				zephir_array_fetch_string(&key, attr, SL("key"), PH_NOISY, "phalcon/debug/dump.zep", 187 TSRMLS_CC);
				ZEPHIR_OBS_NVAR(value);
				zephir_array_fetch_string(&value, attr, SL("value"), PH_NOISY, "phalcon/debug/dump.zep", 188 TSRMLS_CC);
				if (!(zephir_is_true(key))) {
					continue;
				}
				ZEPHIR_INIT_NVAR(_54$$14);
				ZEPHIR_SINIT_NVAR(_55$$14);
				ZVAL_LONG(&_55$$14, 0);
				ZEPHIR_CALL_FUNCTION(&_56$$14, "chr", &_57, 141, &_55$$14);
				zephir_check_call_status();
				zephir_fast_explode(_54$$14, _56$$14, key, LONG_MAX TSRMLS_CC);
				ZEPHIR_CPY_WRT(key, _54$$14);
				ZEPHIR_INIT_NVAR(type);
				ZVAL_STRING(type, "public", 1);
				if (zephir_array_isset_long(key, 1)) {
					ZEPHIR_INIT_NVAR(type);
					ZVAL_STRING(type, "private", 1);
					zephir_array_fetch_long(&_58$$17, key, 1, PH_NOISY | PH_READONLY, "phalcon/debug/dump.zep", 200 TSRMLS_CC);
					if (ZEPHIR_IS_STRING(_58$$17, "*")) {
						ZEPHIR_INIT_NVAR(type);
						ZVAL_STRING(type, "protected", 1);
					}
				}
				ZEPHIR_SINIT_NVAR(_55$$14);
				ZVAL_LONG(&_55$$14, tab);
				ZEPHIR_CALL_FUNCTION(&_59$$14, "str_repeat", &_12, 142, space, &_55$$14);
				zephir_check_call_status();
				ZEPHIR_INIT_NVAR(_60$$14);
				zephir_create_array(_60$$14, 3, 0 TSRMLS_CC);
				ZEPHIR_INIT_NVAR(_54$$14);
				ZVAL_STRING(_54$$14, "obj", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_CALL_METHOD(&_61$$14, this_ptr, "getstyle", &_4, 0, _54$$14);
				zephir_check_temp_parameter(_54$$14);
				zephir_check_call_status();
				zephir_array_update_string(&_60$$14, SL(":style"), &_61$$14, PH_COPY | PH_SEPARATE);
				ZEPHIR_MAKE_REF(key);
				ZEPHIR_CALL_FUNCTION(&_61$$14, "end", &_62, 178, key);
				ZEPHIR_UNREF(key);
				zephir_check_call_status();
				zephir_array_update_string(&_60$$14, SL(":key"), &_61$$14, PH_COPY | PH_SEPARATE);
				zephir_array_update_string(&_60$$14, SL(":type"), &type, PH_COPY | PH_SEPARATE);
				ZEPHIR_SINIT_NVAR(_55$$14);
				ZVAL_STRING(&_55$$14, "-><span style=':style'>:key</span> (<span style=':style'>:type</span>) = ", 0);
				ZEPHIR_CALL_FUNCTION(&_61$$14, "strtr", &_6, 26, &_55$$14, _60$$14);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_63$$14);
				ZEPHIR_CONCAT_VV(_63$$14, _59$$14, _61$$14);
				zephir_concat_self(&output, _63$$14 TSRMLS_CC);
				ZEPHIR_INIT_NVAR(_54$$14);
				ZVAL_STRING(_54$$14, "", ZEPHIR_TEMP_PARAM_COPY);
				ZEPHIR_INIT_NVAR(_65$$14);
				ZVAL_LONG(_65$$14, (tab + 1));
				ZEPHIR_CALL_METHOD(&_64$$14, this_ptr, "output", &_23, 175, value, _54$$14, _65$$14);
				zephir_check_temp_parameter(_54$$14);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_66$$14);
				ZEPHIR_CONCAT_VS(_66$$14, _64$$14, "\n");
				zephir_concat_self(&output, _66$$14 TSRMLS_CC);
			} while (zephir_is_true(attr));
		}
		ZEPHIR_CALL_FUNCTION(&attr, "get_class_methods", NULL, 179, variable);
		zephir_check_call_status();
		ZEPHIR_SINIT_NVAR(_29$$8);
		ZVAL_LONG(&_29$$8, tab);
		ZEPHIR_CALL_FUNCTION(&_67$$8, "str_repeat", &_12, 142, space, &_29$$8);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_68$$8);
		zephir_create_array(_68$$8, 3, 0 TSRMLS_CC);
		ZEPHIR_INIT_NVAR(_28$$8);
		ZVAL_STRING(_28$$8, "obj", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_69$$8, this_ptr, "getstyle", &_4, 0, _28$$8);
		zephir_check_temp_parameter(_28$$8);
		zephir_check_call_status();
		zephir_array_update_string(&_68$$8, SL(":style"), &_69$$8, PH_COPY | PH_SEPARATE);
		ZEPHIR_INIT_NVAR(_28$$8);
		zephir_get_class(_28$$8, variable, 0 TSRMLS_CC);
		zephir_array_update_string(&_68$$8, SL(":class"), &_28$$8, PH_COPY | PH_SEPARATE);
		add_assoc_long_ex(_68$$8, SS(":count"), zephir_fast_count_int(attr TSRMLS_CC));
		ZEPHIR_SINIT_NVAR(_29$$8);
		ZVAL_STRING(&_29$$8, ":class <b style=':style'>methods</b>: (<span style=':style'>:count</span>) (\n", 0);
		ZEPHIR_CALL_FUNCTION(&_69$$8, "strtr", &_6, 26, &_29$$8, _68$$8);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_70$$8);
		ZEPHIR_CONCAT_VV(_70$$8, _67$$8, _69$$8);
		zephir_concat_self(&output, _70$$8 TSRMLS_CC);
		ZEPHIR_INIT_NVAR(_28$$8);
		zephir_get_class(_28$$8, variable, 0 TSRMLS_CC);
		_71$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_methods"), PH_NOISY_CC);
		if (zephir_fast_in_array(_28$$8, _71$$8 TSRMLS_CC)) {
			ZEPHIR_SINIT_VAR(_72$$19);
			ZVAL_LONG(&_72$$19, tab);
			ZEPHIR_CALL_FUNCTION(&_73$$19, "str_repeat", &_12, 142, space, &_72$$19);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_74$$19);
			ZEPHIR_CONCAT_VS(_74$$19, _73$$19, "[already listed]\n");
			zephir_concat_self(&output, _74$$19 TSRMLS_CC);
		} else {
			zephir_is_iterable(attr, &_76$$20, &_75$$20, 0, 0, "phalcon/debug/dump.zep", 226);
			for (
			  ; zephir_hash_get_current_data_ex(_76$$20, (void**) &_77$$20, &_75$$20) == SUCCESS
			  ; zephir_hash_move_forward_ex(_76$$20, &_75$$20)
			) {
				ZEPHIR_GET_HVALUE(value, _77$$20);
				ZEPHIR_INIT_NVAR(_78$$21);
				zephir_get_class(_78$$21, variable, 0 TSRMLS_CC);
				zephir_update_property_array_append(this_ptr, SL("_methods"), _78$$21 TSRMLS_CC);
				if (ZEPHIR_IS_STRING(value, "__construct")) {
					ZEPHIR_SINIT_NVAR(_79$$22);
					ZVAL_LONG(&_79$$22, (tab + 1));
					ZEPHIR_CALL_FUNCTION(&_80$$22, "str_repeat", &_12, 142, space, &_79$$22);
					zephir_check_call_status();
					ZEPHIR_INIT_NVAR(_81$$22);
					zephir_create_array(_81$$22, 2, 0 TSRMLS_CC);
					ZEPHIR_INIT_NVAR(_83$$22);
					ZVAL_STRING(_83$$22, "obj", ZEPHIR_TEMP_PARAM_COPY);
					ZEPHIR_CALL_METHOD(&_82$$22, this_ptr, "getstyle", &_4, 0, _83$$22);
					zephir_check_temp_parameter(_83$$22);
					zephir_check_call_status();
					zephir_array_update_string(&_81$$22, SL(":style"), &_82$$22, PH_COPY | PH_SEPARATE);
					zephir_array_update_string(&_81$$22, SL(":method"), &value, PH_COPY | PH_SEPARATE);
					ZEPHIR_SINIT_NVAR(_79$$22);
					ZVAL_STRING(&_79$$22, "-><span style=':style'>:method</span>(); [<b style=':style'>constructor</b>]\n", 0);
					ZEPHIR_CALL_FUNCTION(&_82$$22, "strtr", &_6, 26, &_79$$22, _81$$22);
					zephir_check_call_status();
					ZEPHIR_INIT_LNVAR(_84$$22);
					ZEPHIR_CONCAT_VV(_84$$22, _80$$22, _82$$22);
					zephir_concat_self(&output, _84$$22 TSRMLS_CC);
				} else {
					ZEPHIR_SINIT_NVAR(_85$$23);
					ZVAL_LONG(&_85$$23, (tab + 1));
					ZEPHIR_CALL_FUNCTION(&_86$$23, "str_repeat", &_12, 142, space, &_85$$23);
					zephir_check_call_status();
					ZEPHIR_INIT_NVAR(_87$$23);
					zephir_create_array(_87$$23, 2, 0 TSRMLS_CC);
					ZEPHIR_INIT_NVAR(_89$$23);
					ZVAL_STRING(_89$$23, "obj", ZEPHIR_TEMP_PARAM_COPY);
					ZEPHIR_CALL_METHOD(&_88$$23, this_ptr, "getstyle", &_4, 0, _89$$23);
					zephir_check_temp_parameter(_89$$23);
					zephir_check_call_status();
					zephir_array_update_string(&_87$$23, SL(":style"), &_88$$23, PH_COPY | PH_SEPARATE);
					zephir_array_update_string(&_87$$23, SL(":method"), &value, PH_COPY | PH_SEPARATE);
					ZEPHIR_SINIT_NVAR(_85$$23);
					ZVAL_STRING(&_85$$23, "-><span style=':style'>:method</span>();\n", 0);
					ZEPHIR_CALL_FUNCTION(&_88$$23, "strtr", &_6, 26, &_85$$23, _87$$23);
					zephir_check_call_status();
					ZEPHIR_INIT_LNVAR(_90$$23);
					ZEPHIR_CONCAT_VV(_90$$23, _86$$23, _88$$23);
					zephir_concat_self(&output, _90$$23 TSRMLS_CC);
				}
			}
			ZEPHIR_SINIT_VAR(_91$$20);
			ZVAL_LONG(&_91$$20, tab);
			ZEPHIR_CALL_FUNCTION(&_92$$20, "str_repeat", &_12, 142, space, &_91$$20);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_93$$20);
			ZEPHIR_CONCAT_VS(_93$$20, _92$$20, ")\n");
			zephir_concat_self(&output, _93$$20 TSRMLS_CC);
		}
		ZEPHIR_SINIT_NVAR(_29$$8);
		ZVAL_LONG(&_29$$8, (tab - 1));
		ZEPHIR_CALL_FUNCTION(&_94$$8, "str_repeat", &_12, 142, space, &_29$$8);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VVS(return_value, output, _94$$8, ")");
		RETURN_MM();
	}
	if (Z_TYPE_P(variable) == IS_LONG) {
		ZEPHIR_INIT_VAR(_95$$24);
		zephir_create_array(_95$$24, 2, 0 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_97$$24);
		ZVAL_STRING(_97$$24, "int", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_96$$24, this_ptr, "getstyle", &_4, 0, _97$$24);
		zephir_check_temp_parameter(_97$$24);
		zephir_check_call_status();
		zephir_array_update_string(&_95$$24, SL(":style"), &_96$$24, PH_COPY | PH_SEPARATE);
		zephir_array_update_string(&_95$$24, SL(":var"), &variable, PH_COPY | PH_SEPARATE);
		ZEPHIR_SINIT_VAR(_98$$24);
		ZVAL_STRING(&_98$$24, "<b style=':style'>Integer</b> (<span style=':style'>:var</span>)", 0);
		ZEPHIR_CALL_FUNCTION(&_96$$24, "strtr", &_6, 26, &_98$$24, _95$$24);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VV(return_value, output, _96$$24);
		RETURN_MM();
	}
	ZEPHIR_CALL_FUNCTION(&_99, "is_float", NULL, 180, variable);
	zephir_check_call_status();
	if (zephir_is_true(_99)) {
		ZEPHIR_INIT_VAR(_100$$25);
		zephir_create_array(_100$$25, 2, 0 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_102$$25);
		ZVAL_STRING(_102$$25, "float", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_101$$25, this_ptr, "getstyle", &_4, 0, _102$$25);
		zephir_check_temp_parameter(_102$$25);
		zephir_check_call_status();
		zephir_array_update_string(&_100$$25, SL(":style"), &_101$$25, PH_COPY | PH_SEPARATE);
		zephir_array_update_string(&_100$$25, SL(":var"), &variable, PH_COPY | PH_SEPARATE);
		ZEPHIR_SINIT_VAR(_103$$25);
		ZVAL_STRING(&_103$$25, "<b style=':style'>Float</b> (<span style=':style'>:var</span>)", 0);
		ZEPHIR_CALL_FUNCTION(&_101$$25, "strtr", &_6, 26, &_103$$25, _100$$25);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VV(return_value, output, _101$$25);
		RETURN_MM();
	}
	if (zephir_is_numeric(variable)) {
		ZEPHIR_INIT_VAR(_104$$26);
		zephir_create_array(_104$$26, 3, 0 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_106$$26);
		ZVAL_STRING(_106$$26, "num", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_105$$26, this_ptr, "getstyle", &_4, 0, _106$$26);
		zephir_check_temp_parameter(_106$$26);
		zephir_check_call_status();
		zephir_array_update_string(&_104$$26, SL(":style"), &_105$$26, PH_COPY | PH_SEPARATE);
		add_assoc_long_ex(_104$$26, SS(":length"), zephir_fast_strlen_ev(variable));
		zephir_array_update_string(&_104$$26, SL(":var"), &variable, PH_COPY | PH_SEPARATE);
		ZEPHIR_SINIT_VAR(_107$$26);
		ZVAL_STRING(&_107$$26, "<b style=':style'>Numeric string</b> (<span style=':style'>:length</span>) \"<span style=':style'>:var</span>\"", 0);
		ZEPHIR_CALL_FUNCTION(&_105$$26, "strtr", &_6, 26, &_107$$26, _104$$26);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VV(return_value, output, _105$$26);
		RETURN_MM();
	}
	if (Z_TYPE_P(variable) == IS_STRING) {
		ZEPHIR_INIT_VAR(_108$$27);
		zephir_create_array(_108$$27, 3, 0 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_110$$27);
		ZVAL_STRING(_110$$27, "str", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_109$$27, this_ptr, "getstyle", &_4, 0, _110$$27);
		zephir_check_temp_parameter(_110$$27);
		zephir_check_call_status();
		zephir_array_update_string(&_108$$27, SL(":style"), &_109$$27, PH_COPY | PH_SEPARATE);
		add_assoc_long_ex(_108$$27, SS(":length"), zephir_fast_strlen_ev(variable));
		ZEPHIR_SINIT_VAR(_111$$27);
		ZVAL_LONG(&_111$$27, 4);
		ZEPHIR_SINIT_VAR(_112$$27);
		ZVAL_STRING(&_112$$27, "utf-8", 0);
		ZEPHIR_CALL_FUNCTION(&_109$$27, "htmlentities", NULL, 161, variable, &_111$$27, &_112$$27);
		zephir_check_call_status();
		ZEPHIR_CALL_FUNCTION(&_113$$27, "nl2br", NULL, 181, _109$$27);
		zephir_check_call_status();
		zephir_array_update_string(&_108$$27, SL(":var"), &_113$$27, PH_COPY | PH_SEPARATE);
		ZEPHIR_SINIT_NVAR(_111$$27);
		ZVAL_STRING(&_111$$27, "<b style=':style'>String</b> (<span style=':style'>:length</span>) \"<span style=':style'>:var</span>\"", 0);
		ZEPHIR_CALL_FUNCTION(&_113$$27, "strtr", &_6, 26, &_111$$27, _108$$27);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VV(return_value, output, _113$$27);
		RETURN_MM();
	}
	if (Z_TYPE_P(variable) == IS_BOOL) {
		ZEPHIR_INIT_VAR(_114$$28);
		zephir_create_array(_114$$28, 2, 0 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_116$$28);
		ZVAL_STRING(_116$$28, "bool", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_115$$28, this_ptr, "getstyle", &_4, 0, _116$$28);
		zephir_check_temp_parameter(_116$$28);
		zephir_check_call_status();
		zephir_array_update_string(&_114$$28, SL(":style"), &_115$$28, PH_COPY | PH_SEPARATE);
		ZEPHIR_INIT_VAR(_117$$28);
		if (zephir_is_true(variable)) {
			ZEPHIR_INIT_NVAR(_117$$28);
			ZVAL_STRING(_117$$28, "TRUE", 1);
		} else {
			ZEPHIR_INIT_NVAR(_117$$28);
			ZVAL_STRING(_117$$28, "FALSE", 1);
		}
		zephir_array_update_string(&_114$$28, SL(":var"), &_117$$28, PH_COPY | PH_SEPARATE);
		ZEPHIR_SINIT_VAR(_118$$28);
		ZVAL_STRING(&_118$$28, "<b style=':style'>Boolean</b> (<span style=':style'>:var</span>)", 0);
		ZEPHIR_CALL_FUNCTION(&_115$$28, "strtr", &_6, 26, &_118$$28, _114$$28);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VV(return_value, output, _115$$28);
		RETURN_MM();
	}
	if (Z_TYPE_P(variable) == IS_NULL) {
		ZEPHIR_INIT_VAR(_119$$29);
		zephir_create_array(_119$$29, 1, 0 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_121$$29);
		ZVAL_STRING(_121$$29, "null", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_120$$29, this_ptr, "getstyle", &_4, 0, _121$$29);
		zephir_check_temp_parameter(_121$$29);
		zephir_check_call_status();
		zephir_array_update_string(&_119$$29, SL(":style"), &_120$$29, PH_COPY | PH_SEPARATE);
		ZEPHIR_SINIT_VAR(_122$$29);
		ZVAL_STRING(&_122$$29, "<b style=':style'>NULL</b>", 0);
		ZEPHIR_CALL_FUNCTION(&_120$$29, "strtr", &_6, 26, &_122$$29, _119$$29);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VV(return_value, output, _120$$29);
		RETURN_MM();
	}
	ZEPHIR_INIT_VAR(_123);
	zephir_create_array(_123, 2, 0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(_125);
	ZVAL_STRING(_125, "other", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_124, this_ptr, "getstyle", &_4, 0, _125);
	zephir_check_temp_parameter(_125);
	zephir_check_call_status();
	zephir_array_update_string(&_123, SL(":style"), &_124, PH_COPY | PH_SEPARATE);
	zephir_array_update_string(&_123, SL(":var"), &variable, PH_COPY | PH_SEPARATE);
	ZEPHIR_SINIT_VAR(_126);
	ZVAL_STRING(&_126, "(<span style=':style'>:var</span>)", 0);
	ZEPHIR_CALL_FUNCTION(&_124, "strtr", &_6, 26, &_126, _123);
	zephir_check_call_status();
	ZEPHIR_CONCAT_VV(return_value, output, _124);
	RETURN_MM();

}
コード例 #18
0
ファイル: route.zep.c プロジェクト: AlloVince/cphalcon
/**
 * Extracts parameters from a string
 */
PHP_METHOD(Phalcon_Mvc_Router_Route, extractNamedParams) {

	long _0, _5, _25;
	zend_bool notValid, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
	int tmp, cursor, cursorVar, marker, bracketCount = 0, parenthesesCount = 0, foundPattern = 0, intermediate = 0, numberMatches = 0;
	char ch;
	zval *pattern_param = NULL, *matches, _1 = zval_used_for_init, _2 = zval_used_for_init, *_3 = NULL, _18 = zval_used_for_init, _19 = zval_used_for_init, *_20 = NULL, _22 = zval_used_for_init, *_23 = NULL;
	zval *pattern = NULL, *route, *item = NULL, *variable = NULL, *regexp = NULL, *_4 = NULL, *_21 = NULL, *_24 = NULL, *_26 = 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_fast_strlen_ev(pattern) <= 0) {
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_INIT_VAR(matches);
	array_init(matches);
	ZEPHIR_INIT_VAR(route);
	ZVAL_EMPTY_STRING(route);
	for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) {
		cursor = _0; 
		ch = ZEPHIR_STRING_OFFSET(pattern, _0);
		if (parenthesesCount == 0) {
			if (ch == '{') {
				if (bracketCount == 0) {
					marker = (cursor + 1);
					intermediate = 0;
					notValid = 0;
				}
				bracketCount++;
			} else {
				if (ch == '}') {
					bracketCount--;
					if (intermediate > 0) {
						if (bracketCount == 0) {
							numberMatches++;
							ZEPHIR_INIT_NVAR(variable);
							ZVAL_EMPTY_STRING(variable);
							ZEPHIR_INIT_NVAR(regexp);
							ZVAL_EMPTY_STRING(regexp);
							ZEPHIR_SINIT_NVAR(_1);
							ZVAL_LONG(&_1, marker);
							ZEPHIR_SINIT_NVAR(_2);
							ZVAL_LONG(&_2, (cursor - marker));
							ZEPHIR_INIT_NVAR(_3);
							zephir_substr(_3, pattern, zephir_get_intval(&_1), zephir_get_intval(&_2), 0);
							zephir_get_strval(_4, _3);
							ZEPHIR_CPY_WRT(item, _4);
							for (_5 = 0; _5 < Z_STRLEN_P(item); _5++) {
								cursorVar = _5; 
								ch = ZEPHIR_STRING_OFFSET(item, _5);
								if (ch == '\0') {
									break;
								}
								_6 = cursorVar == 0;
								if (_6) {
									_7 = ch >= 'a';
									if (_7) {
										_7 = ch <= 'z';
									}
									_8 = _7;
									if (!(_8)) {
										_9 = ch >= 'A';
										if (_9) {
											_9 = ch <= 'Z';
										}
										_8 = _9;
									}
									_6 = !(_8);
								}
								if (_6) {
									notValid = 1;
									break;
								}
								_10 = ch >= 'a';
								if (_10) {
									_10 = ch <= 'z';
								}
								_11 = _10;
								if (!(_11)) {
									_12 = ch >= 'A';
									if (_12) {
										_12 = ch <= 'Z';
									}
									_11 = _12;
								}
								_13 = _11;
								if (!(_13)) {
									_14 = ch >= '0';
									if (_14) {
										_14 = ch <= '9';
									}
									_13 = _14;
								}
								_15 = _13;
								if (!(_15)) {
									_15 = ch == '-';
								}
								_16 = _15;
								if (!(_16)) {
									_16 = ch == '_';
								}
								_17 = _16;
								if (!(_17)) {
									_17 = ch == ':';
								}
								if (_17) {
									if (ch == ':') {
										ZEPHIR_SINIT_NVAR(_18);
										ZVAL_LONG(&_18, 0);
										ZEPHIR_SINIT_NVAR(_19);
										ZVAL_LONG(&_19, cursorVar);
										ZEPHIR_INIT_NVAR(_20);
										zephir_substr(_20, item, 0 , zephir_get_intval(&_19), 0);
										zephir_get_strval(_21, _20);
										ZEPHIR_CPY_WRT(variable, _21);
										ZEPHIR_SINIT_NVAR(_22);
										ZVAL_LONG(&_22, (cursorVar + 1));
										ZEPHIR_INIT_NVAR(_23);
										zephir_substr(_23, item, zephir_get_intval(&_22), 0, ZEPHIR_SUBSTR_NO_LENGTH);
										zephir_get_strval(_24, _23);
										ZEPHIR_CPY_WRT(regexp, _24);
										break;
									}
								} else {
									notValid = 1;
									break;
								}
							}
							if (!(notValid)) {
								tmp = numberMatches;
								_6 = zephir_is_true(variable);
								if (_6) {
									_6 = zephir_is_true(regexp);
								}
								if (_6) {
									foundPattern = 0;
									for (_25 = 0; _25 < Z_STRLEN_P(regexp); _25++) {
										ch = ZEPHIR_STRING_OFFSET(regexp, _25);
										if (ch == '\0') {
											break;
										}
										if (!(foundPattern)) {
											if (ch == '(') {
												foundPattern = 1;
											}
										} else {
											if (ch == ')') {
												foundPattern = 2;
												break;
											}
										}
									}
									if (foundPattern != 2) {
										ZEPHIR_INIT_LNVAR(_26);
										ZEPHIR_CONCAT_SVS(_26, "(", regexp, ")");
										zephir_concat_self(&route, _26 TSRMLS_CC);
									} else {
										zephir_concat_self(&route, regexp TSRMLS_CC);
									}
									ZEPHIR_INIT_NVAR(_20);
									ZVAL_LONG(_20, tmp);
									zephir_array_update_zval(&matches, variable, &_20, PH_COPY | PH_SEPARATE);
								} else {
									zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)")-1 TSRMLS_CC);
									ZEPHIR_INIT_NVAR(_23);
									ZVAL_LONG(_23, tmp);
									zephir_array_update_zval(&matches, item, &_23, PH_COPY | PH_SEPARATE);
								}
							} else {
								ZEPHIR_INIT_LNVAR(_26);
								ZEPHIR_CONCAT_SVS(_26, "{", item, "}");
								zephir_concat_self(&route, _26 TSRMLS_CC);
							}
							continue;
						}
					}
				}
			}
		}
		if (bracketCount == 0) {
			if (ch == '(') {
				parenthesesCount++;
			} else {
				if (ch == ')') {
					parenthesesCount--;
					if (parenthesesCount == 0) {
						numberMatches++;
					}
				}
			}
		}
		if (bracketCount > 0) {
			intermediate++;
		} else {
			zephir_concat_self_char(&route, ch TSRMLS_CC);
		}
	}
	zephir_create_array(return_value, 2, 0 TSRMLS_CC);
	zephir_array_fast_append(return_value, route);
	zephir_array_fast_append(return_value, matches);
	RETURN_MM();

}
コード例 #19
0
ファイル: route.zep.c プロジェクト: Storyous/zephir
/**
 * Extracts parameters from a string
 *
 * @param string pattern
 */
PHP_METHOD(Test_Router_Route, extractNamedParams) {

	zephir_nts_static zephir_fcall_cache_entry *_4 = NULL;
	long _0, _6, _23;
	zend_bool notValid = 0, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18;
	int tmp, cursor, cursorVar, marker, bracketCount = 0, parenthesesCount = 0, foundPattern = 0, intermediate = 0, numberMatches = 0, ZEPHIR_LAST_CALL_STATUS;
	char ch;
	zval *pattern_param = NULL, *matches, _1 = zval_used_for_init, _2 = zval_used_for_init, *_3 = NULL, *_19 = NULL, *_21 = NULL, *_24 = NULL;
	zval *pattern = NULL, *route, *item = NULL, *variable = NULL, *regexp = NULL, *_5 = NULL, *_20 = NULL, *_22 = NULL, *_25 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &pattern_param);

	zephir_get_strval(pattern, pattern_param);


	if (zephir_fast_strlen_ev(pattern) <= 0) {
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_INIT_VAR(matches);
	array_init(matches);
	ZEPHIR_INIT_VAR(route);
	ZVAL_EMPTY_STRING(route);
	for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) {
		cursor = _0; 
		ch = ZEPHIR_STRING_OFFSET(pattern, _0);
		if (parenthesesCount == 0) {
			if (ch == '{') {
				if (bracketCount == 0) {
					marker = (cursor + 1);
					intermediate = 0;
					notValid = 0;
				}
				bracketCount++;
			} else {
				if (ch == '}') {
					bracketCount--;
					if (intermediate > 0) {
						if (bracketCount == 0) {
							numberMatches++;
							ZEPHIR_INIT_NVAR(variable);
							ZVAL_EMPTY_STRING(variable);
							ZEPHIR_INIT_NVAR(regexp);
							ZVAL_EMPTY_STRING(regexp);
							ZEPHIR_SINIT_NVAR(_1);
							ZVAL_LONG(&_1, marker);
							ZEPHIR_SINIT_NVAR(_2);
							ZVAL_LONG(&_2, (cursor - marker));
							ZEPHIR_CALL_FUNCTION(&_3, "substr", &_4, pattern, &_1, &_2);
							zephir_check_call_status();
							zephir_get_strval(_5, _3);
							ZEPHIR_CPY_WRT(item, _5);
							for (_6 = 0; _6 < Z_STRLEN_P(item); _6++) {
								cursorVar = _6; 
								ch = ZEPHIR_STRING_OFFSET(item, _6);
								if (ch == '\0') {
									break;
								}
								_7 = cursorVar == 0;
								if (_7) {
									_8 = ch >= 'a';
									if (_8) {
										_8 = ch <= 'z';
									}
									_9 = _8;
									if (!(_9)) {
										_10 = ch >= 'A';
										if (_10) {
											_10 = ch <= 'Z';
										}
										_9 = _10;
									}
									_7 = !_9;
								}
								if (_7) {
									notValid = 1;
									break;
								}
								_11 = ch >= 'a';
								if (_11) {
									_11 = ch <= 'z';
								}
								_12 = _11;
								if (!(_12)) {
									_13 = ch >= 'A';
									if (_13) {
										_13 = ch <= 'Z';
									}
									_12 = _13;
								}
								_14 = _12;
								if (!(_14)) {
									_15 = ch >= '0';
									if (_15) {
										_15 = ch <= '9';
									}
									_14 = _15;
								}
								_16 = _14;
								if (!(_16)) {
									_16 = ch == '-';
								}
								_17 = _16;
								if (!(_17)) {
									_17 = ch == '_';
								}
								_18 = _17;
								if (!(_18)) {
									_18 = ch == ':';
								}
								if (_18) {
									if (ch == ':') {
										ZEPHIR_SINIT_NVAR(_1);
										ZVAL_LONG(&_1, 0);
										ZEPHIR_SINIT_NVAR(_2);
										ZVAL_LONG(&_2, cursorVar);
										ZEPHIR_CALL_FUNCTION(&_19, "substr", &_4, item, &_1, &_2);
										zephir_check_call_status();
										zephir_get_strval(_20, _19);
										ZEPHIR_CPY_WRT(variable, _20);
										ZEPHIR_SINIT_NVAR(_1);
										ZVAL_LONG(&_1, (cursorVar + 1));
										ZEPHIR_CALL_FUNCTION(&_21, "substr", &_4, item, &_1);
										zephir_check_call_status();
										zephir_get_strval(_22, _21);
										ZEPHIR_CPY_WRT(regexp, _22);
										break;
									}
								} else {
									notValid = 1;
									break;
								}
							}
							if (!(notValid)) {
								tmp = numberMatches;
								_7 = zephir_is_true(variable);
								if (_7) {
									_7 = zephir_is_true(regexp);
								}
								if (_7) {
									foundPattern = 0;
									for (_23 = 0; _23 < Z_STRLEN_P(regexp); _23++) {
										ch = ZEPHIR_STRING_OFFSET(regexp, _23);
										if (ch == '\0') {
											break;
										}
										if (!(foundPattern)) {
											if (ch == '(') {
												foundPattern = 1;
											}
										} else {
											if (ch == ')') {
												foundPattern = 2;
												break;
											}
										}
									}
									if (foundPattern != 2) {
										zephir_concat_self_str(&route, "(", sizeof("(")-1 TSRMLS_CC);
										zephir_concat_self(&route, regexp TSRMLS_CC);
										zephir_concat_self_str(&route, ")", sizeof(")")-1 TSRMLS_CC);
									} else {
										zephir_concat_self(&route, regexp TSRMLS_CC);
									}
									ZEPHIR_INIT_NVAR(_24);
									ZVAL_LONG(_24, tmp);
									zephir_array_update_zval(&matches, variable, &_24, PH_COPY | PH_SEPARATE);
								} else {
									zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)")-1 TSRMLS_CC);
									ZEPHIR_INIT_NVAR(_24);
									ZVAL_LONG(_24, tmp);
									zephir_array_update_zval(&matches, item, &_24, PH_COPY | PH_SEPARATE);
								}
							} else {
								ZEPHIR_INIT_LNVAR(_25);
								ZEPHIR_CONCAT_SVS(_25, "{", item, "}");
								zephir_concat_self(&route, _25 TSRMLS_CC);
							}
							continue;
						}
					}
				}
			}
		}
		if (bracketCount == 0) {
			if (ch == '(') {
				parenthesesCount++;
			} else {
				if (ch == ')') {
					parenthesesCount--;
					if (parenthesesCount == 0) {
						numberMatches++;
					}
				}
			}
		}
		if (bracketCount > 0) {
			intermediate++;
		} else {
			zephir_concat_self_char(&route, ch TSRMLS_CC);
		}
	}
	array_init_size(return_value, 3);
	zephir_array_fast_append(return_value, route);
	zephir_array_fast_append(return_value, matches);
	RETURN_MM();

}
コード例 #20
0
ファイル: sqlite.zep.c プロジェクト: flaver12/cphalcon
/**
 * Generates SQL to add a column to a table
 */
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addColumn) {

	zephir_nts_static zephir_fcall_cache_entry *_6 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *tableName_param = NULL, *schemaName_param = NULL, *column, *sql = NULL, *defaultValue = NULL, *_1 = NULL, *_2 = NULL, *_3, _4, *_5 = NULL, *_7;
	zval *tableName = NULL, *schemaName = NULL, *_0 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column);

	if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}

	if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
		zephir_get_strval(tableName, tableName_param);
	} else {
		ZEPHIR_INIT_VAR(tableName);
		ZVAL_EMPTY_STRING(tableName);
	}
	if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}

	if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
		zephir_get_strval(schemaName, schemaName_param);
	} else {
		ZEPHIR_INIT_VAR(schemaName);
		ZVAL_EMPTY_STRING(schemaName);
	}


	ZEPHIR_INIT_VAR(sql);
	if (schemaName && Z_STRLEN_P(schemaName)) {
		ZEPHIR_INIT_VAR(_0);
		ZEPHIR_CONCAT_SVSVS(_0, "ALTER TABLE \"", schemaName, "\".\"", tableName, "\" ADD COLUMN ");
		ZEPHIR_CPY_WRT(sql, _0);
	} else {
		ZEPHIR_INIT_LNVAR(_0);
		ZEPHIR_CONCAT_SVS(_0, "ALTER TABLE \"", tableName, "\" ADD COLUMN ");
		ZEPHIR_CPY_WRT(sql, _0);
	}
	ZEPHIR_CALL_METHOD(&_1, column, "getname", NULL);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&_2, this_ptr, "getcolumndefinition", NULL, column);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_3);
	ZEPHIR_CONCAT_SVSV(_3, "\"", _1, "\" ", _2);
	zephir_concat_self(&sql, _3 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL);
	zephir_check_call_status();
	if (!(ZEPHIR_IS_EMPTY(defaultValue))) {
		ZEPHIR_SINIT_VAR(_4);
		ZVAL_STRING(&_4, "\"", 0);
		ZEPHIR_CALL_FUNCTION(&_5, "addcslashes", &_6, defaultValue, &_4);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_7);
		ZEPHIR_CONCAT_SVS(_7, " DEFAULT \"", _5, "\"");
		zephir_concat_self(&sql, _7 TSRMLS_CC);
	}
	ZEPHIR_CALL_METHOD(&_5, column, "isnotnull", NULL);
	zephir_check_call_status();
	if (zephir_is_true(_5)) {
		zephir_concat_self_str(&sql, SL(" NOT NULL") TSRMLS_CC);
	}
	ZEPHIR_CALL_METHOD(&_5, column, "isautoincrement", NULL);
	zephir_check_call_status();
	if (zephir_is_true(_5)) {
		zephir_concat_self_str(&sql, SL(" PRIMARY KEY AUTOINCREMENT") TSRMLS_CC);
	}
	RETURN_CCTOR(sql);

}
コード例 #21
0
ファイル: redirect.zep.c プロジェクト: hylent/yb
PHP_METHOD(Yb_View_Redirect, run) {

    zend_bool redirectDataAsQueries = 0, _7;
    zval *redirectUrl = NULL, *_4 = NULL, *_11;
    int ZEPHIR_LAST_CALL_STATUS;
    zephir_fcall_cache_entry *_1 = NULL;
    zval *data_param = NULL, *options_param = NULL, *_0 = NULL, *_2 = NULL, *_3 = NULL, *_5 = NULL, *_6 = NULL, _8$$4, *_9$$4, *_10$$4 = NULL;
    zval *data = NULL, *options = NULL;

    ZEPHIR_MM_GROW();
    zephir_fetch_params(1, 2, 0, &data_param, &options_param);

    zephir_get_arrval(data, data_param);
    zephir_get_arrval(options, options_param);


    ZEPHIR_INIT_VAR(_2);
    ZVAL_STRING(_2, "redirectUrl", ZEPHIR_TEMP_PARAM_COPY);
    ZEPHIR_INIT_VAR(_3);
    ZVAL_STRING(_3, "", ZEPHIR_TEMP_PARAM_COPY);
    ZEPHIR_CALL_CE_STATIC(&_0, yb_std_ce, "valueat", &_1, 5, options, _2, _3);
    zephir_check_temp_parameter(_2);
    zephir_check_temp_parameter(_3);
    zephir_check_call_status();
    zephir_get_strval(_4, _0);
    ZEPHIR_CPY_WRT(redirectUrl, _4);
    if (unlikely(zephir_fast_strlen_ev(redirectUrl) < 1)) {
        ZEPHIR_THROW_EXCEPTION_DEBUG_STR(yb_view_exception_ce, "Missing option: redirectUrl", "yb/view/redirect.zep", 14);
        return;
    }
    ZEPHIR_INIT_NVAR(_2);
    ZVAL_STRING(_2, "redirectDataAsQueries", ZEPHIR_TEMP_PARAM_COPY);
    ZEPHIR_INIT_NVAR(_3);
    ZVAL_BOOL(_3, 0);
    ZEPHIR_CALL_CE_STATIC(&_6, yb_std_ce, "valueat", &_1, 5, options, _2, _3);
    zephir_check_temp_parameter(_2);
    zephir_check_call_status();
    redirectDataAsQueries = zephir_get_boolval(_6);
    _7 = redirectDataAsQueries;
    if (_7) {
        _7 = zephir_fast_count_int(data TSRMLS_CC) > 0;
    }
    if (_7) {
        ZEPHIR_SINIT_VAR(_8$$4);
        ZVAL_STRING(&_8$$4, "?", 0);
        ZEPHIR_INIT_VAR(_9$$4);
        zephir_fast_strpos(_9$$4, redirectUrl, &_8$$4, 0 );
        if (ZEPHIR_IS_FALSE_IDENTICAL(_9$$4)) {
            zephir_concat_self_str(&redirectUrl, "?", sizeof("?")-1 TSRMLS_CC);
        } else {
            zephir_concat_self_str(&redirectUrl, "&", sizeof("&")-1 TSRMLS_CC);
        }
        ZEPHIR_CALL_FUNCTION(&_10$$4, "http_build_query", NULL, 99, data);
        zephir_check_call_status();
        zephir_concat_self(&redirectUrl, _10$$4 TSRMLS_CC);
    }
    ZEPHIR_INIT_VAR(_11);
    ZEPHIR_CONCAT_SV(_11, "Location: ", redirectUrl);
    ZEPHIR_CALL_FUNCTION(NULL, "header", NULL, 93, _11);
    zephir_check_call_status();
    ZEPHIR_MM_RESTORE();

}
コード例 #22
0
ファイル: oracle.zep.c プロジェクト: AlloVince/cphalcon
/**
 * Gets the column name in Oracle
 */
PHP_METHOD(Phalcon_Db_Dialect_Oracle, getColumnDefinition) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *column, *columnSql = NULL, *size = NULL, *scale = NULL, *type = NULL, *_0, *_1 = NULL, *_2;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &column);



	ZEPHIR_CALL_METHOD(&type, column, "gettype", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&size, column, "getsize", NULL, 0);
	zephir_check_call_status();
	do {
		if (ZEPHIR_IS_LONG(type, 0)) {
			ZEPHIR_INIT_VAR(columnSql);
			ZVAL_STRING(columnSql, "INTEGER", 1);
			break;
		}
		if (ZEPHIR_IS_LONG(type, 1)) {
			ZEPHIR_INIT_NVAR(columnSql);
			ZVAL_STRING(columnSql, "DATE", 1);
			break;
		}
		if (ZEPHIR_IS_LONG(type, 2)) {
			ZEPHIR_INIT_NVAR(columnSql);
			ZEPHIR_CONCAT_SVS(columnSql, "VARCHAR2(", size, ")");
			break;
		}
		if (ZEPHIR_IS_LONG(type, 3)) {
			ZEPHIR_CALL_METHOD(&scale, column, "getscale", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(columnSql);
			ZEPHIR_CONCAT_SVSVS(columnSql, "NUMBER(", size, ",", scale, ")");
			break;
		}
		if (ZEPHIR_IS_LONG(type, 4)) {
			ZEPHIR_INIT_NVAR(columnSql);
			ZVAL_STRING(columnSql, "TIMESTAMP", 1);
			break;
		}
		if (ZEPHIR_IS_LONG(type, 17)) {
			if (ZEPHIR_IS_EMPTY(columnSql)) {
				zephir_concat_self_str(&columnSql, SL("TIMESTAMP") TSRMLS_CC);
			}
			break;
		}
		if (ZEPHIR_IS_LONG(type, 5)) {
			ZEPHIR_INIT_NVAR(columnSql);
			ZEPHIR_CONCAT_SVS(columnSql, "CHAR(", size, ")");
			break;
		}
		if (ZEPHIR_IS_LONG(type, 6)) {
			ZEPHIR_INIT_NVAR(columnSql);
			ZVAL_STRING(columnSql, "TEXT", 1);
			break;
		}
		if (ZEPHIR_IS_LONG(type, 7)) {
			ZEPHIR_CALL_METHOD(&scale, column, "getscale", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(columnSql);
			ZEPHIR_CONCAT_SVSVS(columnSql, "FLOAT(", size, ",", scale, ")");
			break;
		}
		if (ZEPHIR_IS_LONG(type, 8)) {
			ZEPHIR_INIT_NVAR(columnSql);
			ZVAL_STRING(columnSql, "TINYINT(1)", 1);
			break;
		}
		ZEPHIR_INIT_VAR(_0);
		object_init_ex(_0, phalcon_db_exception_ce);
		ZEPHIR_CALL_METHOD(&_1, column, "getname", NULL, 0);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_2);
		ZEPHIR_CONCAT_SV(_2, "Unrecognized Oracle data type at column ", _1);
		ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 9, _2);
		zephir_check_call_status();
		zephir_throw_exception_debug(_0, "phalcon/db/dialect/oracle.zep", 125 TSRMLS_CC);
		ZEPHIR_MM_RESTORE();
		return;
	} while(0);

	RETURN_CCTOR(columnSql);

}
コード例 #23
0
ファイル: debug.zep.c プロジェクト: flaver12/cphalcon
/**
 * 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(&currentLine, 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("&nbsp;\n") TSRMLS_CC);
				} else {
					if (ZEPHIR_IS_STRING(currentLine, "\r\n")) {
						zephir_concat_self_str(&html, SL("&nbsp;\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);

}
コード例 #24
0
PHP_METHOD(Xs_FieldMeta, toConfig) {

	zend_bool _6, _9, _10, _13, _14, _16;
	zval *s;
	zval index, *_0, *_1, *_2, *_3, *_4, *_5, *_7, *_8 = NULL, *_11, *_12, *_15;

	ZEPHIR_MM_GROW();
	ZEPHIR_INIT_VAR(s);
	ZVAL_STRING(s, "", 1);

	_0 = zephir_fetch_nproperty_this(this_ptr, SL("name"), PH_NOISY_CC);
	ZEPHIR_INIT_VAR(_1);
	ZEPHIR_CONCAT_SVS(_1, "[", _0, "]\n");
	zephir_concat_self(&s, _1 TSRMLS_CC);
	_2 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
	do {
		if (ZEPHIR_IS_LONG(_2, 1)) {
			zephir_concat_self_str(&s, "type = numeric\n", sizeof("type = numeric\n")-1 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(_2, 10)) {
			zephir_concat_self_str(&s, "type = id\n", sizeof("type = id\n")-1 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(_2, 11)) {
			zephir_concat_self_str(&s, "type = title\n", sizeof("type = title\n")-1 TSRMLS_CC);
			break;
		}
		if (ZEPHIR_IS_LONG(_2, 12)) {
			zephir_concat_self_str(&s, "type = body\n", sizeof("type = body\n")-1 TSRMLS_CC);
			break;
		}
	} while(0);

	_3 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
	if (!ZEPHIR_IS_LONG_IDENTICAL(_3, 12)) {
		_4 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
		ZEPHIR_SINIT_VAR(index);
		ZVAL_LONG(&index, ((int) (zephir_get_numberval(_4)) & 0x03));
		if (zephir_is_true(&index)) {
			do {
				if (ZEPHIR_IS_LONG(&index, 0x03)) {
					_5 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
					if (!ZEPHIR_IS_LONG_IDENTICAL(_5, 11)) {
						zephir_concat_self_str(&s, "index = both\n", sizeof("index = both\n")-1 TSRMLS_CC);
					}
					break;
				}
				if (ZEPHIR_IS_LONG(&index, 0x02)) {
					zephir_concat_self_str(&s, "index = mixed\n", sizeof("index = mixed\n")-1 TSRMLS_CC);
					break;
				}
				_5 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
				if (!ZEPHIR_IS_LONG_IDENTICAL(_5, 10)) {
					zephir_concat_self_str(&s, "index = self\n", sizeof("index = self\n")-1 TSRMLS_CC);
				}
				break;
			} while(0);

		}
	}
	_4 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
	_6 = !ZEPHIR_IS_LONG_IDENTICAL(_4, 10);
	if (_6) {
		_5 = zephir_fetch_nproperty_this(this_ptr, SL("tokenizer"), PH_NOISY_CC);
		_6 = !ZEPHIR_IS_LONG_IDENTICAL(_5, 0);
	}
	if (_6) {
		_7 = zephir_fetch_nproperty_this(this_ptr, SL("tokenizer"), PH_NOISY_CC);
		ZEPHIR_INIT_VAR(_8);
		ZEPHIR_CONCAT_SVS(_8, "tokenizer = ", _7, "\n");
		zephir_concat_self(&s, _8 TSRMLS_CC);
	}
	_4 = zephir_fetch_nproperty_this(this_ptr, SL("cutlen"), PH_NOISY_CC);
	_9 = ZEPHIR_GT_LONG(_4, 0);
	if (_9) {
		_7 = zephir_fetch_nproperty_this(this_ptr, SL("cutlen"), PH_NOISY_CC);
		_10 = ZEPHIR_IS_LONG_IDENTICAL(_7, 300);
		if (_10) {
			_11 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
			_10 = ZEPHIR_IS_LONG_IDENTICAL(_11, 12);
		}
		_9 = !(_10);
	}
	if (_9) {
		_12 = zephir_fetch_nproperty_this(this_ptr, SL("cutlen"), PH_NOISY_CC);
		ZEPHIR_INIT_LNVAR(_8);
		ZEPHIR_CONCAT_SVS(_8, "cutlen = ", _12, "\n");
		zephir_concat_self(&s, _8 TSRMLS_CC);
	}
	_4 = zephir_fetch_nproperty_this(this_ptr, SL("weight"), PH_NOISY_CC);
	_13 = !ZEPHIR_IS_LONG_IDENTICAL(_4, 1);
	if (_13) {
		_7 = zephir_fetch_nproperty_this(this_ptr, SL("weight"), PH_NOISY_CC);
		_14 = ZEPHIR_IS_LONG_IDENTICAL(_7, 5);
		if (_14) {
			_12 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
			_14 = ZEPHIR_IS_LONG_IDENTICAL(_12, 11);
		}
		_13 = !(_14);
	}
	if (_13) {
		_15 = zephir_fetch_nproperty_this(this_ptr, SL("weight"), PH_NOISY_CC);
		ZEPHIR_INIT_LNVAR(_8);
		ZEPHIR_CONCAT_SVS(_8, "weight = ", _15, "\n");
		zephir_concat_self(&s, _8 TSRMLS_CC);
	}
	_4 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
	if (((int) (zephir_get_numberval(_4)) & 0x10)) {
		_7 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
		_16 = !ZEPHIR_IS_LONG_IDENTICAL(_7, 12);
		if (_16) {
			_12 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
			_16 = !ZEPHIR_IS_LONG_IDENTICAL(_12, 11);
		}
		if (_16) {
			zephir_concat_self_str(&s, "phrase = yes\n", sizeof("phrase = yes\n")-1 TSRMLS_CC);
		}
	} else {
		_4 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
		_16 = ZEPHIR_IS_LONG_IDENTICAL(_4, 12);
		if (!(_16)) {
			_7 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
			_16 = ZEPHIR_IS_LONG_IDENTICAL(_7, 11);
		}
		if (_16) {
			zephir_concat_self_str(&s, "phrase = no\n", sizeof("phrase = no\n")-1 TSRMLS_CC);
		}
	}
	_4 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
	if (((int) (zephir_get_numberval(_4)) & 0x80)) {
		zephir_concat_self_str(&s, "non_bool = yes\n", sizeof("non_bool = yes\n")-1 TSRMLS_CC);
	}
	RETURN_CTOR(s);

}
コード例 #25
0
ファイル: ldapexception.zep.c プロジェクト: noikiy/zend
/**
 * @param Ldap   $ldap Zend\Ldap\Ldap object
 * @param string $str  Informative exception message
 * @param int    $code LDAP error code
 */
PHP_METHOD(Zend_Ldap_Exception_LdapException, __construct) {

	zephir_nts_static zephir_fcall_cache_entry *_3 = NULL;
	int code, ZEPHIR_LAST_CALL_STATUS;
	zval *str = NULL;
	zval *ldap = NULL, *str_param = NULL, *code_param = NULL, *errors, *message = NULL, *oldCode, *_0 = NULL, *_1 = NULL, _2, *_4;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 0, 3, &ldap, &str_param, &code_param);

	if (!ldap) {
		ldap = ZEPHIR_GLOBAL(global_null);
	}
	if (!str_param) {
		ZEPHIR_INIT_VAR(str);
		ZVAL_EMPTY_STRING(str);
	} else {
		zephir_get_strval(str, str_param);
	}
	if (!code_param) {
		code = 0;
	} else {
		code = zephir_get_intval(code_param);
	}
	ZEPHIR_INIT_VAR(errors);
	array_init(errors);
	ZEPHIR_INIT_VAR(message);
	ZVAL_STRING(message, "", 1);


	if (Z_TYPE_P(ldap) != IS_NULL) {
		ZEPHIR_INIT_VAR(oldCode);
		ZVAL_LONG(oldCode, code);
		ZEPHIR_INIT_VAR(_1);
		ZVAL_LONG(_1, code);
		ZEPHIR_CALL_METHOD(&_0, ldap, "getlasterror", NULL, _1, errors);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(message);
		ZEPHIR_CONCAT_VS(message, _0, ": ");
		if (code == 0) {
			ZEPHIR_INIT_NVAR(message);
			ZVAL_STRING(message, "", 1);
			code = zephir_get_numberval(oldCode);
		}
	}
	if (ZEPHIR_IS_EMPTY(message)) {
		if (code > 0) {
			ZEPHIR_SINIT_VAR(_2);
			ZVAL_LONG(&_2, code);
			ZEPHIR_CALL_FUNCTION(&_0, "dechex", &_3, &_2);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_4);
			ZEPHIR_CONCAT_SVS(_4, "0x", _0, ": ");
			zephir_concat_self(&message, _4 TSRMLS_CC);
		}
	}
	if (!(ZEPHIR_IS_EMPTY(str))) {
		zephir_concat_self(&message, str TSRMLS_CC);
	} else {
		zephir_concat_self_str(&message, SL("no exception message") TSRMLS_CC);
	}
	ZEPHIR_INIT_NVAR(_1);
	ZVAL_LONG(_1, code);
	ZEPHIR_CALL_PARENT(NULL, zend_ldap_exception_ldapexception_ce, this_ptr, "__construct", NULL, message, _1);
	zephir_check_call_status();
	ZEPHIR_MM_RESTORE();

}
コード例 #26
0
ファイル: route.c プロジェクト: hellcore/zephir
/**
 * Extracts parameters from a string
 *
 * @param string pattern
 */
PHP_METHOD(Test_Router_Route, extractNamedParams) {

	zend_bool notValid;
	int tmp, cursor, cursorVar, marker, bracketCount = 0, parenthesesCount = 0, foundPattern = 0, intermediate = 0, numberMatches = 0, _0, _5, _10;
	char ch;
	zval *pattern_param = NULL, *matches, _1 = zval_used_for_init, _2 = zval_used_for_init, *_3 = NULL, *_6 = NULL, *_8 = NULL;
	zval *pattern = NULL, *route, *item = NULL, *variable = NULL, *regexp = NULL, *_4 = NULL, *_7 = NULL, *_9 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &pattern_param);

		zephir_get_strval(pattern, pattern_param);


	if ((zephir_fast_strlen_ev(pattern) <= 0)) {
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_INIT_VAR(matches);
	array_init(matches);
	ZEPHIR_INIT_VAR(route);
	ZVAL_EMPTY_STRING(route);
	for (_0 = 0; _0 < Z_STRLEN_P(pattern); _0++) {
		cursor = _0; 
		ch = Z_STRVAL_P(pattern)[_0]; 
		if ((parenthesesCount == 0)) {
			if ((ch == '{')) {
				if ((bracketCount == 0)) {
					marker = (cursor + 1);
					intermediate = 0;
					notValid = 0;
				}
				bracketCount++;
			} else {
				if ((ch == '}')) {
					bracketCount--;
					if ((intermediate > 0)) {
						if ((bracketCount == 0)) {
							numberMatches++;
							ZEPHIR_INIT_NVAR(variable);
							ZVAL_EMPTY_STRING(variable);
							ZEPHIR_INIT_NVAR(regexp);
							ZVAL_EMPTY_STRING(regexp);
							ZEPHIR_SINIT_NVAR(_1);
							ZVAL_LONG(&_1, marker);
							ZEPHIR_SINIT_NVAR(_2);
							ZVAL_LONG(&_2, (cursor - marker));
							ZEPHIR_INIT_NVAR(_3);
							zephir_call_func_p3(_3, "substr", pattern, &_1, &_2);
							zephir_get_strval(_4, _3);
							ZEPHIR_CPY_WRT(item, _4);
							for (_5 = 0; _5 < Z_STRLEN_P(item); _5++) {
								cursorVar = _5; 
								ch = Z_STRVAL_P(item)[_5]; 
								if ((ch == '\0')) {
									break;
								}
								if (((cursorVar == 0) && !(((((ch >= 'a') && (ch <= 'z'))) || (((ch >= 'A') && (ch <= 'Z'))))))) {
									notValid = 1;
									break;
								}
								if (((((((((ch >= 'a') && (ch <= 'z'))) || (((ch >= 'A') && (ch <= 'Z')))) || (((ch >= '0') && (ch <= '9')))) || (ch == '-')) || (ch == '_')) || (ch == ':'))) {
									if ((ch == ':')) {
										ZEPHIR_SINIT_NVAR(_1);
										ZVAL_LONG(&_1, 0);
										ZEPHIR_SINIT_NVAR(_2);
										ZVAL_LONG(&_2, cursorVar);
										ZEPHIR_INIT_NVAR(_6);
										zephir_call_func_p3(_6, "substr", item, &_1, &_2);
										zephir_get_strval(_7, _6);
										ZEPHIR_CPY_WRT(variable, _7);
										ZEPHIR_SINIT_NVAR(_1);
										ZVAL_LONG(&_1, (cursorVar + 1));
										ZEPHIR_INIT_NVAR(_8);
										zephir_call_func_p2(_8, "substr", item, &_1);
										zephir_get_strval(_9, _8);
										ZEPHIR_CPY_WRT(regexp, _9);
										break;
									}
								} else {
									notValid = 1;
									break;
								}
							}
							if (!(notValid)) {
								tmp = numberMatches;
								if ((variable && Z_STRLEN_P(variable)) && (regexp && Z_STRLEN_P(regexp))) {
									foundPattern = 0;
									for (_10 = 0; _10 < Z_STRLEN_P(regexp); _10++) {
										ch = Z_STRVAL_P(regexp)[_10]; 
										if ((ch == '\0')) {
											break;
										}
										if (!(foundPattern)) {
											if ((ch == '(')) {
												foundPattern = 1;
											}
										} else {
											if ((ch == ')')) {
												foundPattern = 2;
												break;
											}
										}
									}
									if ((foundPattern != 2)) {
										zephir_concat_self_str(&route, "(", sizeof("(")-1 TSRMLS_CC);
										zephir_concat_self(&route, regexp TSRMLS_CC);
										zephir_concat_self_str(&route, ")", sizeof(")")-1 TSRMLS_CC);
									} else {
										zephir_concat_self(&route, regexp TSRMLS_CC);
									}
									ZEPHIR_INIT_NVAR(_6);
									ZVAL_LONG(_6, tmp);
									zephir_array_update_zval(&matches, variable, &_6, PH_COPY | PH_SEPARATE);
								} else {
									zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)")-1 TSRMLS_CC);
									ZEPHIR_INIT_NVAR(_8);
									ZVAL_LONG(_8, tmp);
									zephir_array_update_zval(&matches, item, &_8, PH_COPY | PH_SEPARATE);
								}
							} else {
								zephir_concat_self_str(&route, "{", sizeof("{")-1 TSRMLS_CC);
								zephir_concat_self(&route, item TSRMLS_CC);
								zephir_concat_self_str(&route, "}", sizeof("}")-1 TSRMLS_CC);
							}
							continue;
						}
					}
				}
			}
		}
		if ((bracketCount == 0)) {
			if ((ch == '(')) {
				parenthesesCount++;
			} else {
				if ((ch == ')')) {
					parenthesesCount--;
					if ((parenthesesCount == 0)) {
						numberMatches++;
					}
				}
			}
		}
		if ((bracketCount > 0)) {
			intermediate++;
		} else {
			zephir_concat_self_char(&route, ch TSRMLS_CC);
		}
	}
	array_init(return_value);
	zephir_array_fast_append(return_value, route);
	zephir_array_fast_append(return_value, matches);
	RETURN_MM();

}
コード例 #27
0
ファイル: firephp.zep.c プロジェクト: ntesic/cphalcon
/**
 * Writes the log to the stream itself
 */
PHP_METHOD(Phalcon_Logger_Adapter_Firephp, logInternal) {

	HashTable *_8;
	HashPosition _7;
	zephir_fcall_cache_entry *_2 = NULL;
	zval *context = NULL;
	int type, time, ZEPHIR_LAST_CALL_STATUS;
	zval *message_param = NULL, *type_param = NULL, *time_param = NULL, *context_param = NULL, *chunk = NULL, *format = NULL, *chString = NULL, *content = NULL, *key = NULL, *index = NULL, *_0, *_3 = NULL, *_4, *_5, _6, **_9, _1$$3 = zval_used_for_init;
	zval *message = NULL, *_10$$4 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 4, 0, &message_param, &type_param, &time_param, &context_param);

	zephir_get_strval(message, message_param);
	type = zephir_get_intval(type_param);
	time = zephir_get_intval(time_param);
	zephir_get_arrval(context, context_param);


	_0 = zephir_fetch_nproperty_this(this_ptr, SL("_initialized"), PH_NOISY_CC);
	if (!(zephir_is_true(_0))) {
		ZEPHIR_SINIT_VAR(_1$$3);
		ZVAL_STRING(&_1$$3, "X-Wf-Protocol-1: http://meta.wildfirehq.org/Protocol/JsonStream/0.2", 0);
		ZEPHIR_CALL_FUNCTION(NULL, "header", &_2, 248, &_1$$3);
		zephir_check_call_status();
		ZEPHIR_SINIT_NVAR(_1$$3);
		ZVAL_STRING(&_1$$3, "X-Wf-1-Plugin-1: http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3", 0);
		ZEPHIR_CALL_FUNCTION(NULL, "header", &_2, 248, &_1$$3);
		zephir_check_call_status();
		ZEPHIR_SINIT_NVAR(_1$$3);
		ZVAL_STRING(&_1$$3, "X-Wf-Structure-1: http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1", 0);
		ZEPHIR_CALL_FUNCTION(NULL, "header", &_2, 248, &_1$$3);
		zephir_check_call_status();
		if (1) {
			zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC);
		} else {
			zephir_update_property_this(this_ptr, SL("_initialized"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
		}
	}
	ZEPHIR_CALL_METHOD(&_3, this_ptr, "getformatter", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_4);
	ZVAL_LONG(_4, type);
	ZEPHIR_INIT_VAR(_5);
	ZVAL_LONG(_5, time);
	ZEPHIR_CALL_METHOD(&format, _3, "format", NULL, 0, message, _4, _5, context);
	zephir_check_call_status();
	ZEPHIR_SINIT_VAR(_6);
	ZVAL_LONG(&_6, 4500);
	ZEPHIR_CALL_FUNCTION(&chunk, "str_split", NULL, 74, format, &_6);
	zephir_check_call_status();
	ZEPHIR_OBS_VAR(index);
	zephir_read_property_this(&index, this_ptr, SL("_index"), PH_NOISY_CC);
	zephir_is_iterable(chunk, &_8, &_7, 0, 0, "phalcon/logger/adapter/firephp.zep", 92);
	for (
	  ; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS
	  ; zephir_hash_move_forward_ex(_8, &_7)
	) {
		ZEPHIR_GET_HMKEY(key, _8, _7);
		ZEPHIR_GET_HVALUE(chString, _9);
		zephir_get_strval(_10$$4, index);
		ZEPHIR_INIT_NVAR(content);
		ZEPHIR_CONCAT_SVSV(content, "X-Wf-1-1-1-", _10$$4, ": ", chString);
		if (zephir_array_isset_long(chunk, (zephir_get_numberval(key) + 1))) {
			zephir_concat_self_str(&content, SL("|\\") TSRMLS_CC);
		}
		ZEPHIR_CALL_FUNCTION(NULL, "header", &_2, 248, content);
		zephir_check_call_status();
		ZEPHIR_SEPARATE(index);
		zephir_increment(index);
	}
	zephir_update_property_this(this_ptr, SL("_index"), index TSRMLS_CC);
	ZEPHIR_MM_RESTORE();

}
コード例 #28
0
ファイル: route.zep.c プロジェクト: crocodile2u/zephir
/**
 * Extracts parameters from a string
 *
 * @param string pattern
 */
PHP_METHOD(Test_Router_Route, extractNamedParams) {

	long _0, _5$$11, _26$$19;
	zend_bool notValid, _6$$12, _7$$12, _8$$12, _9$$12, _10$$12, _11$$12, _12$$12, _13$$12, _14$$12, _15$$12, _16$$12, _17$$12, _25$$18;
	int tmp = 0, cursor = 0, cursorVar = 0, marker = 0, bracketCount, parenthesesCount, foundPattern, intermediate, numberMatches;
	char ch = 0;
	zval *pattern_param = NULL, matches, _1$$11, _2$$11, _3$$11, _18$$16, _19$$16, _20$$16, _22$$16, _23$$16, _27$$19, _28$$28;
	zval pattern, route, item, variable, regexp, _4$$11, _21$$16, _24$$16, _29$$29;
	ZEPHIR_INIT_THIS();

	ZVAL_UNDEF(&pattern);
	ZVAL_UNDEF(&route);
	ZVAL_UNDEF(&item);
	ZVAL_UNDEF(&variable);
	ZVAL_UNDEF(&regexp);
	ZVAL_UNDEF(&_4$$11);
	ZVAL_UNDEF(&_21$$16);
	ZVAL_UNDEF(&_24$$16);
	ZVAL_UNDEF(&_29$$29);
	ZVAL_UNDEF(&matches);
	ZVAL_UNDEF(&_1$$11);
	ZVAL_UNDEF(&_2$$11);
	ZVAL_UNDEF(&_3$$11);
	ZVAL_UNDEF(&_18$$16);
	ZVAL_UNDEF(&_19$$16);
	ZVAL_UNDEF(&_20$$16);
	ZVAL_UNDEF(&_22$$16);
	ZVAL_UNDEF(&_23$$16);
	ZVAL_UNDEF(&_27$$19);
	ZVAL_UNDEF(&_28$$28);

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &pattern_param);

	zephir_get_strval(&pattern, pattern_param);


	notValid = 0;
	bracketCount = 0;
	parenthesesCount = 0;
	foundPattern = 0;
	intermediate = 0;
	numberMatches = 0;
	if (zephir_fast_strlen_ev(&pattern) <= 0) {
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_INIT_VAR(&matches);
	array_init(&matches);
	ZEPHIR_INIT_VAR(&route);
	ZVAL_STRING(&route, "");
	for (_0 = 0; _0 < Z_STRLEN_P(&pattern); _0++) {
		cursor = _0; 
		ch = ZEPHIR_STRING_OFFSET(&pattern, _0);
		if (parenthesesCount == 0) {
			if (ch == '{') {
				if (bracketCount == 0) {
					marker = (cursor + 1);
					intermediate = 0;
					notValid = 0;
				}
				bracketCount++;
			} else {
				if (ch == '}') {
					bracketCount--;
					if (intermediate > 0) {
						if (bracketCount == 0) {
							numberMatches++;
							ZEPHIR_INIT_NVAR(&variable);
							ZVAL_STRING(&variable, "");
							ZEPHIR_INIT_NVAR(&regexp);
							ZVAL_STRING(&regexp, "");
							ZVAL_LONG(&_1$$11, marker);
							ZVAL_LONG(&_2$$11, (cursor - marker));
							ZEPHIR_INIT_NVAR(&_3$$11);
							zephir_substr(&_3$$11, &pattern, zephir_get_intval(&_1$$11), zephir_get_intval(&_2$$11), 0);
							zephir_get_strval(&_4$$11, &_3$$11);
							ZEPHIR_CPY_WRT(&item, &_4$$11);
							for (_5$$11 = 0; _5$$11 < Z_STRLEN_P(&item); _5$$11++) {
								cursorVar = _5$$11; 
								ch = ZEPHIR_STRING_OFFSET(&item, _5$$11);
								if (ch == '\0') {
									break;
								}
								_6$$12 = cursorVar == 0;
								if (_6$$12) {
									_7$$12 = ch >= 'a';
									if (_7$$12) {
										_7$$12 = ch <= 'z';
									}
									_8$$12 = _7$$12;
									if (!(_8$$12)) {
										_9$$12 = ch >= 'A';
										if (_9$$12) {
											_9$$12 = ch <= 'Z';
										}
										_8$$12 = _9$$12;
									}
									_6$$12 = !(_8$$12);
								}
								if (_6$$12) {
									notValid = 1;
									break;
								}
								_10$$12 = ch >= 'a';
								if (_10$$12) {
									_10$$12 = ch <= 'z';
								}
								_11$$12 = _10$$12;
								if (!(_11$$12)) {
									_12$$12 = ch >= 'A';
									if (_12$$12) {
										_12$$12 = ch <= 'Z';
									}
									_11$$12 = _12$$12;
								}
								_13$$12 = _11$$12;
								if (!(_13$$12)) {
									_14$$12 = ch >= '0';
									if (_14$$12) {
										_14$$12 = ch <= '9';
									}
									_13$$12 = _14$$12;
								}
								_15$$12 = _13$$12;
								if (!(_15$$12)) {
									_15$$12 = ch == '-';
								}
								_16$$12 = _15$$12;
								if (!(_16$$12)) {
									_16$$12 = ch == '_';
								}
								_17$$12 = _16$$12;
								if (!(_17$$12)) {
									_17$$12 = ch == ':';
								}
								if (_17$$12) {
									if (ch == ':') {
										ZVAL_LONG(&_18$$16, 0);
										ZVAL_LONG(&_19$$16, cursorVar);
										ZEPHIR_INIT_NVAR(&_20$$16);
										zephir_substr(&_20$$16, &item, 0 , zephir_get_intval(&_19$$16), 0);
										zephir_get_strval(&_21$$16, &_20$$16);
										ZEPHIR_CPY_WRT(&variable, &_21$$16);
										ZVAL_LONG(&_22$$16, (cursorVar + 1));
										ZEPHIR_INIT_NVAR(&_23$$16);
										zephir_substr(&_23$$16, &item, zephir_get_intval(&_22$$16), 0, ZEPHIR_SUBSTR_NO_LENGTH);
										zephir_get_strval(&_24$$16, &_23$$16);
										ZEPHIR_CPY_WRT(&regexp, &_24$$16);
										break;
									}
								} else {
									notValid = 1;
									break;
								}
							}
							if (!(notValid)) {
								tmp = numberMatches;
								_25$$18 = zephir_is_true(&variable);
								if (_25$$18) {
									_25$$18 = zephir_is_true(&regexp);
								}
								if (_25$$18) {
									foundPattern = 0;
									for (_26$$19 = 0; _26$$19 < Z_STRLEN_P(&regexp); _26$$19++) {
										ch = ZEPHIR_STRING_OFFSET(&regexp, _26$$19);
										if (ch == '\0') {
											break;
										}
										if (!(foundPattern)) {
											if (ch == '(') {
												foundPattern = 1;
											}
										} else {
											if (ch == ')') {
												foundPattern = 2;
												break;
											}
										}
									}
									if (foundPattern != 2) {
										zephir_concat_self_str(&route, "(", sizeof("(")-1 TSRMLS_CC);
										zephir_concat_self(&route, &regexp TSRMLS_CC);
										zephir_concat_self_str(&route, ")", sizeof(")")-1 TSRMLS_CC);
									} else {
										zephir_concat_self(&route, &regexp TSRMLS_CC);
									}
									ZEPHIR_INIT_NVAR(&_27$$19);
									ZVAL_LONG(&_27$$19, tmp);
									zephir_array_update_zval(&matches, &variable, &_27$$19, PH_COPY | PH_SEPARATE);
								} else {
									zephir_concat_self_str(&route, "([^/]*)", sizeof("([^/]*)")-1 TSRMLS_CC);
									ZEPHIR_INIT_NVAR(&_28$$28);
									ZVAL_LONG(&_28$$28, tmp);
									zephir_array_update_zval(&matches, &item, &_28$$28, PH_COPY | PH_SEPARATE);
								}
							} else {
								ZEPHIR_INIT_LNVAR(_29$$29);
								ZEPHIR_CONCAT_SVS(&_29$$29, "{", &item, "}");
								zephir_concat_self(&route, &_29$$29 TSRMLS_CC);
							}
							continue;
						}
					}
				}
			}
		}
		if (bracketCount == 0) {
			if (ch == '(') {
				parenthesesCount++;
			} else {
				if (ch == ')') {
					parenthesesCount--;
					if (parenthesesCount == 0) {
						numberMatches++;
					}
				}
			}
		}
		if (bracketCount > 0) {
			intermediate++;
		} else {
			zephir_concat_self_char(&route, ch TSRMLS_CC);
		}
	}
	zephir_create_array(return_value, 2, 0 TSRMLS_CC);
	zephir_array_fast_append(return_value, &route);
	zephir_array_fast_append(return_value, &matches);
	RETURN_MM();

}
コード例 #29
0
/**
 * Gets the signature
 *
 * @param OAuth\UriInterface uri
 * @param array params
 * @param string method
 *
 * @return string
 */
PHP_METHOD(OAuth_V1_Signature, getSignature) {

	HashTable *_4;
	HashPosition _3;
	zend_class_entry *_1;
	zval *method = NULL;
	zval *uri, *params, *method_param = NULL, *signature, *signatureData, *signatureString, *signatureStringEncoded, *query, *queryStringData = NULL, *queryStringKey = NULL, *queryStringValue = NULL, *queryStringKeyEncoded = NULL, *queryStringValueEncoded = NULL, *scheme, *authority, *path, *hasExplicitTrailingHostSlash, *baseUri, *baseUriEncoded, *dataString, *dataHash, *_0 = NULL, *_2, **_5;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 1, &uri, &params, &method_param);

	if (!method_param) {
		ZEPHIR_INIT_VAR(method);
		ZVAL_STRING(method, "POST", 1);
	} else {
		zephir_get_strval(method, method_param);
	}


	ZEPHIR_INIT_VAR(query);
	zephir_call_method(query, uri, "getquery");
	ZEPHIR_INIT_VAR(queryStringData);
	array_init(queryStringData);
	ZEPHIR_INIT_VAR(signatureData);
	array_init(signatureData);
	if ((Z_TYPE_P(params) != IS_ARRAY)) {
		ZEPHIR_INIT_VAR(_0);
		_1 = zend_fetch_class(SL("InvalidArgumentException"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
		object_init_ex(_0, _1);
		ZEPHIR_INIT_VAR(_2);
		ZVAL_STRING(_2, "The params must be an Array", 1);
		zephir_call_method_p1_noret(_0, "__construct", _2);
		zephir_throw_exception(_0 TSRMLS_CC);
		ZEPHIR_MM_RESTORE();
		return;
	}
	ZEPHIR_INIT_NVAR(_0);
	zephir_fast_array_merge(_0, &(queryStringData), &(params) TSRMLS_CC);
	ZEPHIR_CPY_WRT(queryStringData, _0);
	Z_SET_ISREF_P(queryStringData);
	zephir_call_func_p2_noret("parse_str", query, queryStringData);
	Z_UNSET_ISREF_P(queryStringData);
	zephir_is_iterable(queryStringData, &_4, &_3, 0, 0);
	for (
		; zend_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS
		; zend_hash_move_forward_ex(_4, &_3)
	) {
		ZEPHIR_GET_HMKEY(queryStringKey, _4, _3);
		ZEPHIR_GET_HVALUE(queryStringValue, _5);
		ZEPHIR_INIT_NVAR(queryStringKeyEncoded);
		zephir_call_func_p1(queryStringKeyEncoded, "rawurlencode", queryStringKey);
		ZEPHIR_INIT_NVAR(queryStringValueEncoded);
		zephir_call_func_p1(queryStringValueEncoded, "rawurlencode", queryStringValue);
		zephir_array_update_zval(&signatureData, queryStringKeyEncoded, &queryStringValueEncoded, PH_COPY | PH_SEPARATE);
	}
	Z_SET_ISREF_P(signatureData);
	zephir_call_func_p1_noret("ksort", signatureData);
	Z_UNSET_ISREF_P(signatureData);
	ZEPHIR_INIT_VAR(scheme);
	zephir_call_method(scheme, uri, "getscheme");
	ZEPHIR_INIT_VAR(authority);
	zephir_call_method(authority, uri, "getrawauthority");
	ZEPHIR_INIT_VAR(path);
	zephir_call_method(path, uri, "getpath");
	ZEPHIR_INIT_VAR(hasExplicitTrailingHostSlash);
	zephir_call_method(hasExplicitTrailingHostSlash, uri, "hasexplicittrailinghostslash");
	ZEPHIR_INIT_VAR(baseUri);
	ZEPHIR_CONCAT_VSV(baseUri, scheme, "://", authority);
	if (ZEPHIR_IS_STRING(path, "/")) {
		if (zephir_is_true(hasExplicitTrailingHostSlash)) {
			zephir_concat_self_str(&baseUri, SL("/") TSRMLS_CC);
		}
	} else {
		zephir_concat_self(&baseUri, path TSRMLS_CC);
	}
	ZEPHIR_INIT_VAR(baseUriEncoded);
	zephir_call_func_p1(baseUriEncoded, "rawurlencode", baseUri);
	ZEPHIR_INIT_VAR(signatureString);
	zephir_call_method_p1(signatureString, this_ptr, "buildsignaturestring", signatureData);
	ZEPHIR_INIT_VAR(signatureStringEncoded);
	zephir_call_func_p1(signatureStringEncoded, "rawurlencode", signatureString);
	ZEPHIR_INIT_VAR(dataString);
	zephir_fast_strtoupper(dataString, method);
	ZEPHIR_INIT_BNVAR(dataString);
	ZEPHIR_CONCAT_VSVSV(dataString, dataString, "&", baseUriEncoded, "&", signatureStringEncoded);
	ZEPHIR_INIT_VAR(dataHash);
	zephir_call_method_p1(dataHash, this_ptr, "hash", dataString);
	ZEPHIR_INIT_VAR(signature);
	zephir_call_func_p1(signature, "base64_encode", dataHash);
	RETURN_CCTOR(signature);

}