Ejemplo n.º 1
0
PHP_METHOD(ADOdb_Connection, debug) {

    zval *msg_param = NULL, *_0, *_1, _2;
    zval *msg = NULL;

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

    if (!msg_param) {
        ZEPHIR_INIT_VAR(msg);
        ZVAL_STRING(msg, "", 1);
    } else {
        zephir_get_strval(msg, msg_param);
    }


    _0 = zephir_fetch_nproperty_this(this_ptr, SL("debug"), PH_NOISY_CC);
    if (ZEPHIR_IS_TRUE(_0)) {
        ZEPHIR_INIT_VAR(_1);
        zephir_call_func(_1, "memory_get_usage");
        ZEPHIR_SINIT_VAR(_2);
        ZVAL_STRING(&_2, "% 10d: %s\n", 0);
        zephir_call_func_p3_noret("printf", &_2, _1, msg);
    }
    ZEPHIR_MM_RESTORE();

}
Ejemplo n.º 2
0
PHP_METHOD(Test_Exists, testInterfaceExists) {

	zend_bool autoload;
	zval *interfaceName, *autoload_param = NULL;

	zephir_fetch_params(0, 1, 1, &interfaceName, &autoload_param);

	if (!autoload_param) {
		autoload = 1;
	} else {
		autoload = zephir_get_boolval(autoload_param);
	}


	RETURN_BOOL(zephir_interface_exists(interfaceName, ZEPHIR_IS_TRUE((autoload ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false)))  TSRMLS_CC));

}
Ejemplo n.º 3
0
/**
 * Starts the session
 */
PHP_METHOD(Yaf_Session, start) {

    int ZEPHIR_LAST_CALL_STATUS;
    zval *session = NULL, *_0, *_SESSION;

    ZEPHIR_MM_GROW();

    ZEPHIR_CALL_SELF(&session, "getinstance", NULL);
    zephir_check_call_status();
    ZEPHIR_OBS_VAR(_0);
    zephir_read_property(&_0, session, SL("started"), PH_NOISY_CC);
    if (ZEPHIR_IS_TRUE(_0)) {
        RETURN_MM_BOOL(1);
    } else {
        ZEPHIR_CALL_FUNCTION(NULL, "session_start", NULL);
        zephir_check_call_status();
        zephir_update_property_zval(session, SL("started"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
        zephir_get_global(&_SESSION, SS("_SESSION") TSRMLS_CC);
        zephir_update_property_zval(session, SL("session"), _SESSION TSRMLS_CC);
    }
    ZEPHIR_MM_RESTORE();

}
Ejemplo n.º 4
0
PHP_METHOD(PhalconPlus_RPC_Server_AbstractServer, callByParams) {

	zend_class_entry *_10, *_17;
	zephir_nts_static zephir_fcall_cache_entry *_5 = NULL, *_7 = NULL, *_13 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *_3 = NULL, *_18, *_19;
	zend_bool _2;
	zval *service_param = NULL, *method_param = NULL, *request = NULL, *rawData, *serviceClass = NULL, *_0 = NULL, *_1, *tmp = NULL, *param, *paramClass = NULL, *_4 = NULL, *_6 = NULL, *_8 = NULL, *_9 = NULL, *_11 = NULL, *_12 = NULL, *_14, *_15, *serviceObj, *response = NULL, *e = NULL, *_16 = NULL, *_20;
	zval *service = NULL, *method = NULL, *_21;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 4, 0, &service_param, &method_param, &request, &rawData);

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

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

	if (likely(Z_TYPE_P(method_param) == IS_STRING)) {
		zephir_get_strval(method, method_param);
	} else {
		ZEPHIR_INIT_VAR(method);
		ZVAL_EMPTY_STRING(method);
	}
	ZEPHIR_INIT_VAR(serviceClass);
	ZVAL_STRING(serviceClass, "", 1);
	ZEPHIR_INIT_VAR(tmp);
	array_init(tmp);


	ZEPHIR_INIT_VAR(_1);
	zephir_ucfirst(_1, service);
	ZEPHIR_INIT_NVAR(serviceClass);
	ZEPHIR_CONCAT_VS(serviceClass, _1, "Service");
	_2 = Z_TYPE_P(request) == IS_OBJECT;
	if (_2) {
		_2 = zephir_instance_of_ev(request, phalconplus_base_protobuffer_ce TSRMLS_CC);
	}
	if (_2) {
		zephir_update_property_this(this_ptr, SL("phpOnly"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
	} else if (Z_TYPE_P(request) == IS_ARRAY) {
		ZEPHIR_CPY_WRT(tmp, request);
		ZEPHIR_INIT_VAR(param);
		object_init_ex(param, zephir_get_internal_ce(SS("reflectionparameter") TSRMLS_CC));
		ZEPHIR_INIT_VAR(_3);
		zephir_create_array(_3, 2, 0 TSRMLS_CC);
		zephir_array_fast_append(_3, serviceClass);
		zephir_array_fast_append(_3, method);
		ZEPHIR_INIT_VAR(_4);
		ZVAL_LONG(_4, 0);
		ZEPHIR_CALL_METHOD(NULL, param, "__construct", &_5, _3, _4);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(&_6, param, "getclass", &_7);
		zephir_check_call_status();
		if (zephir_is_true(_6)) {
			ZEPHIR_CALL_METHOD(&_8, param, "getclass", &_7);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&paramClass, _8, "getname", NULL);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(request);
			zephir_fetch_safe_class(_9, paramClass);
			_10 = zend_fetch_class(Z_STRVAL_P(_9), Z_STRLEN_P(_9), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
			object_init_ex(request, _10);
			if (zephir_has_constructor(request TSRMLS_CC)) {
				ZEPHIR_CALL_METHOD(NULL, request, "__construct", NULL);
				zephir_check_call_status();
			}
			ZEPHIR_CALL_METHOD(NULL, request, "softclone", NULL, tmp);
			zephir_check_call_status();
		} else {
			ZEPHIR_INIT_NVAR(_4);
			object_init_ex(_4, zend_exception_get_default(TSRMLS_C));
			ZEPHIR_INIT_VAR(_11);
			zephir_json_encode(_11, &(_11), request, 0  TSRMLS_CC);
			ZEPHIR_INIT_VAR(_12);
			ZEPHIR_CONCAT_SVSVSV(_12, "Service class:method definition is invalid. Detail: ", service, " : ", method, ". Request: ", _11);
			ZEPHIR_CALL_METHOD(NULL, _4, "__construct", &_13, _12);
			zephir_check_call_status();
			zephir_throw_exception_debug(_4, "phalconplus/RPC/Server/AbstractServer.zep", 36 TSRMLS_CC);
			ZEPHIR_MM_RESTORE();
			return;
		}
	} else {
		ZEPHIR_INIT_NVAR(_4);
		object_init_ex(_4, zend_exception_get_default(TSRMLS_C));
		ZEPHIR_INIT_NVAR(_11);
		zephir_json_encode(_11, &(_11), request, 0  TSRMLS_CC);
		ZEPHIR_INIT_LNVAR(_12);
		ZEPHIR_CONCAT_SV(_12, "Your input is not allowed. Request: ", _11);
		ZEPHIR_CALL_METHOD(NULL, _4, "__construct", &_13, _12);
		zephir_check_call_status();
		zephir_throw_exception_debug(_4, "phalconplus/RPC/Server/AbstractServer.zep", 39 TSRMLS_CC);
		ZEPHIR_MM_RESTORE();
		return;
	}
	_14 = zephir_fetch_nproperty_this(this_ptr, SL("di"), PH_NOISY_CC);
	ZEPHIR_INIT_NVAR(_4);
	ZVAL_STRING(_4, "requestCheck", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_6, _14, "has", NULL, _4);
	zephir_check_temp_parameter(_4);
	zephir_check_call_status();
	if (zephir_is_true(_6)) {
		_15 = zephir_fetch_nproperty_this(this_ptr, SL("di"), PH_NOISY_CC);
		ZEPHIR_INIT_NVAR(_3);
		zephir_create_array(_3, 3, 0 TSRMLS_CC);
		zephir_array_fast_append(_3, serviceClass);
		zephir_array_fast_append(_3, method);
		zephir_array_fast_append(_3, rawData);
		ZEPHIR_INIT_NVAR(_4);
		ZVAL_STRING(_4, "requestCheck", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _15, "get", NULL, _4, _3);
		zephir_check_temp_parameter(_4);
		zephir_check_call_status();
	} else {
		ZEPHIR_CALL_METHOD(NULL, this_ptr, "requestcheck", NULL, serviceClass, method, request);
		zephir_check_call_status();
	}
	ZEPHIR_INIT_VAR(serviceObj);
	zephir_fetch_safe_class(_16, serviceClass);
	_17 = zend_fetch_class(Z_STRVAL_P(_16), Z_STRLEN_P(_16), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
	object_init_ex(serviceObj, _17);
	if (zephir_has_constructor(serviceObj TSRMLS_CC)) {
		_15 = zephir_fetch_nproperty_this(this_ptr, SL("di"), PH_NOISY_CC);
		ZEPHIR_CALL_METHOD(NULL, serviceObj, "__construct", NULL, _15);
		zephir_check_call_status();
	}
	ZEPHIR_INIT_NVAR(_3);
	zephir_create_array(_3, 2, 0 TSRMLS_CC);
	zephir_array_fast_append(_3, serviceObj);
	zephir_array_fast_append(_3, method);
	if (zephir_is_callable(_3 TSRMLS_CC)) {

		/* try_start_1: */

			ZEPHIR_INIT_NVAR(_4);
			ZEPHIR_INIT_VAR(_18);
			zephir_create_array(_18, 2, 0 TSRMLS_CC);
			zephir_array_fast_append(_18, serviceObj);
			zephir_array_fast_append(_18, method);
			ZEPHIR_INIT_VAR(_19);
			zephir_create_array(_19, 1, 0 TSRMLS_CC);
			zephir_array_fast_append(_19, request);
			ZEPHIR_CALL_USER_FUNC_ARRAY(_4, _18, _19);
			zephir_check_call_status_or_jump(try_end_1);
			ZEPHIR_CPY_WRT(response, _4);

		try_end_1:

		if (EG(exception)) {
			ZEPHIR_CPY_WRT(e, EG(exception));
			if (zephir_instance_of_ev(e, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) {
				zend_clear_exception(TSRMLS_C);
				zephir_throw_exception_debug(e, "phalconplus/RPC/Server/AbstractServer.zep", 55 TSRMLS_CC);
				ZEPHIR_MM_RESTORE();
				return;
			}
		}
		ZEPHIR_INIT_NVAR(_4);
		_20 = zephir_fetch_nproperty_this(this_ptr, SL("phpOnly"), PH_NOISY_CC);
		if (ZEPHIR_IS_TRUE(_20)) {
			ZEPHIR_CPY_WRT(_4, response);
		} else {
			ZEPHIR_CALL_METHOD(&_4, response, "toarray", NULL);
			zephir_check_call_status();
		}
		RETURN_CCTOR(_4);
	} else {
		object_init_ex(_4, zend_exception_get_default(TSRMLS_C));
		ZEPHIR_INIT_VAR(_21);
		ZEPHIR_CONCAT_SVSV(_21, "Service:method not found. Detail: ", service, " : ", method);
		ZEPHIR_CALL_METHOD(NULL, _4, "__construct", &_13, _21);
		zephir_check_call_status();
		zephir_throw_exception_debug(_4, "phalconplus/RPC/Server/AbstractServer.zep", 59 TSRMLS_CC);
		ZEPHIR_MM_RESTORE();
		return;
	}

}