PHP_METHOD(PhalconPlus_Enum_AbstractEnum, validValues) { int ZEPHIR_LAST_CALL_STATUS; zval *assoc_param = NULL, *reflection = NULL, *consts = NULL, *_0; zend_bool assoc; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &assoc_param); if (!assoc_param) { assoc = 0; } else { assoc = zephir_get_boolval(assoc_param); } ZEPHIR_INIT_VAR(reflection); object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_INIT_VAR(_0); zephir_get_called_class(_0 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 4, _0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&consts, reflection, "getconstants", NULL, 17); zephir_check_call_status(); zephir_array_unset_string(&consts, SS("__default"), PH_SEPARATE); if (assoc == 1) { RETURN_CCTOR(consts); } else { ZEPHIR_RETURN_CALL_FUNCTION("array_values", NULL, 18, consts); zephir_check_call_status(); RETURN_MM(); } }
/** * Executes a prepared statement binding. This function uses integer indexes starting from zero * * <code> * $statement = $db->prepare('SELECT * FROM robots WHERE name = :name'); * $result = $connection->executePrepared($statement, array('name' => 'Voltron')); * </code> * * @param \PDOStatement statement * @param array bindParams * @param array bindTypes * @return \PDOStatement */ PHP_METHOD(Pdm_Db_Adapter_AbstractPdo, executePrepared) { int ZEPHIR_LAST_CALL_STATUS; zval *statement, *bindParams = NULL, *bindTypes = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &statement, &bindParams, &bindTypes); if (!bindParams) { ZEPHIR_INIT_VAR(bindParams); array_init(bindParams); } else { ZEPHIR_SEPARATE_PARAM(bindParams); } if (!bindTypes) { ZEPHIR_INIT_VAR(bindTypes); array_init(bindTypes); } if (!(zephir_instance_of_ev(statement, zephir_get_internal_ce(SS("pdostatement") TSRMLS_CC) TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'statement' must be an instance of 'PDOStatement'", "", 0); return; } if (Z_TYPE_P(bindParams) != IS_ARRAY) { ZEPHIR_INIT_NVAR(bindParams); array_init(bindParams); } ZEPHIR_CALL_METHOD(NULL, statement, "execute", NULL, bindParams); zephir_check_call_status(); RETURN_CCTOR(statement); }
/** * Throws an exception when a notice or warning is raised */ PHP_METHOD(Phalcon_Debug, onUncaughtLowSeverity) { int ZEPHIR_LAST_CALL_STATUS; zval *severity, *message, *file, *line, *context, *_0 = NULL, _1, *_2$$3, *_3$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 5, 0, &severity, &message, &file, &line, &context); ZEPHIR_CALL_FUNCTION(&_0, "error_reporting", NULL, 166); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1); zephir_bitwise_and_function(&_1, _0, severity TSRMLS_CC); if (zephir_is_true(&_1)) { ZEPHIR_INIT_VAR(_2$$3); object_init_ex(_2$$3, zephir_get_internal_ce(SS("errorexception") TSRMLS_CC)); ZEPHIR_INIT_VAR(_3$$3); ZVAL_LONG(_3$$3, 0); ZEPHIR_CALL_METHOD(NULL, _2$$3, "__construct", NULL, 167, message, _3$$3, severity, file, line); zephir_check_call_status(); zephir_throw_exception_debug(_2$$3, "phalcon/debug.zep", 565 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Xpl_Collection_ObjectSet, addAll) { HashTable *_3$$4; HashPosition _2$$4; zephir_fcall_cache_entry *_1 = NULL, *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *data, *value$$4 = NULL, *_0$$4 = NULL, **_4$$4; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &data); if (zephir_instance_of_ev(data, zephir_get_internal_ce(SS("splobjectstorage") TSRMLS_CC) TSRMLS_CC)) { ZEPHIR_CALL_PARENT(NULL, xpl_collection_objectset_ce, this_ptr, "addall", NULL, 0, data); zephir_check_call_status(); } else { ZEPHIR_CALL_CE_STATIC(&_0$$4, xpl_type_ce, "iterate", &_1, 15, data); zephir_check_call_status(); zephir_is_iterable(_0$$4, &_3$$4, &_2$$4, 0, 0, "xpl/collection/objectset.zep", 51); for ( ; zephir_hash_get_current_data_ex(_3$$4, (void**) &_4$$4, &_2$$4) == SUCCESS ; zephir_hash_move_forward_ex(_3$$4, &_2$$4) ) { ZEPHIR_GET_HVALUE(value$$4, _4$$4); ZEPHIR_CALL_METHOD(NULL, this_ptr, "add", &_5, 0, value$$4); zephir_check_call_status(); } } ZEPHIR_MM_RESTORE(); }
PHP_METHOD(PhalconPlus_Enum_AbstractEnum, __construct) { zephir_fcall_cache_entry *_9 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *val = NULL, *reflection = NULL, *defaultVal = NULL, *_0, *_1 = NULL, *_2, *_3$$3, *_4$$3 = NULL, *_5$$4, *_6$$4, _7$$4, *_8$$4 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &val); if (!val) { ZEPHIR_INIT_VAR(val); ZVAL_STRING(val, "__PhalconPlus_AbstractEnum_DefaultValue__", 1); } ZEPHIR_INIT_VAR(reflection); object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_INIT_VAR(_0); zephir_get_called_class(_0 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 4, _0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "__default", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_1, reflection, "hasconstant", NULL, 11, _2); zephir_check_temp_parameter(_2); zephir_check_call_status(); if (zephir_is_true(_1)) { ZEPHIR_INIT_VAR(_3$$3); ZVAL_STRING(_3$$3, "__default", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&defaultVal, reflection, "getconstant", NULL, 12, _3$$3); zephir_check_temp_parameter(_3$$3); zephir_check_call_status(); ZEPHIR_CALL_STATIC(&_4$$3, "isvalid", NULL, 0, defaultVal); zephir_check_call_status(); if (!(zephir_is_true(_4$$3))) { ZEPHIR_INIT_VAR(_5$$4); object_init_ex(_5$$4, spl_ce_OutOfRangeException); ZEPHIR_INIT_VAR(_6$$4); zephir_get_class(_6$$4, this_ptr, 0 TSRMLS_CC); ZEPHIR_SINIT_VAR(_7$$4); ZVAL_STRING(&_7$$4, "Invalid __default enumeration %s for Enum %s", 0); ZEPHIR_CALL_FUNCTION(&_8$$4, "sprintf", NULL, 13, &_7$$4, defaultVal, _6$$4); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, _5$$4, "__construct", NULL, 14, _8$$4); zephir_check_call_status(); zephir_throw_exception_debug(_5$$4, "phalconplus/Enum/AbstractEnum.zep", 15 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } if (ZEPHIR_IS_STRING(val, "__PhalconPlus_AbstractEnum_DefaultValue__")) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_9, 0, defaultVal); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_9, 0, val); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); }
/** * Returns the constants for a given class or the current class. * * @param string classname [Optional] * @return array */ PHP_METHOD(Xpl_Enum, getConstants) { int ZEPHIR_LAST_CALL_STATUS; zval *classname = NULL, *reflection = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &classname); if (!classname) { ZEPHIR_CPY_WRT(classname, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(classname); } if (Z_TYPE_P(classname) == IS_NULL) { ZEPHIR_INIT_NVAR(classname); zephir_get_called_class(classname TSRMLS_CC); } ZEPHIR_INIT_VAR(reflection); object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 63, classname); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(reflection, "getconstants", NULL, 100); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(Owl_Cache_Driver_Redis, getInstance) { int ZEPHIR_LAST_CALL_STATUS; zval *_0, *_1, *_2, *_3 = NULL, *_4, *_5; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("instance"), PH_NOISY_CC); if (Z_TYPE_P(_0) == IS_NULL) { ZEPHIR_INIT_VAR(_1); object_init_ex(_1, zephir_get_internal_ce(SS("redis") TSRMLS_CC)); if (zephir_has_constructor(_1 TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 0); zephir_check_call_status(); } zephir_update_property_this(this_ptr, SL("instance"), _1 TSRMLS_CC); _2 = zephir_fetch_nproperty_this(this_ptr, SL("instance"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3); ZVAL_STRING(_3, "localhost", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _2, "connect", NULL, 0, _3); zephir_check_temp_parameter(_3); zephir_check_call_status(); _4 = zephir_fetch_nproperty_this(this_ptr, SL("instance"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 1); ZEPHIR_INIT_VAR(_5); ZVAL_LONG(_5, 1); ZEPHIR_CALL_METHOD(NULL, _4, "setoption", NULL, 0, _3, _5); zephir_check_call_status(); RETURN_MM_MEMBER(this_ptr, "instance"); } RETURN_MM_MEMBER(this_ptr, "instance"); }
/** * Create internal connection to memcached */ PHP_METHOD(Phalcon_Cache_Backend_Libmemcached, _connect) { zval *options = NULL, *memcache = NULL, *client = NULL, *servers = NULL, *persistentId = NULL, *_0 = NULL, *_1$$4 = NULL, *_2$$4 = NULL; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(options); zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_OBS_VAR(persistentId); if (!(zephir_array_isset_string_fetch(&persistentId, options, SS("persistent_id"), 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(persistentId); ZVAL_STRING(persistentId, "phalcon_cache", 1); } ZEPHIR_INIT_VAR(memcache); object_init_ex(memcache, zephir_get_internal_ce(SS("memcached") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, memcache, "__construct", NULL, 0, persistentId); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, memcache, "getserverlist", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(_0)) { ZEPHIR_OBS_VAR(servers); if (!(zephir_array_isset_string_fetch(&servers, options, SS("servers"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Servers must be an array", "phalcon/cache/backend/libmemcached.zep", 113); return; } if (Z_TYPE_P(servers) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Servers must be an array", "phalcon/cache/backend/libmemcached.zep", 117); return; } ZEPHIR_OBS_VAR(client); if (!(zephir_array_isset_string_fetch(&client, options, SS("client"), 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(client); array_init(client); } if (Z_TYPE_P(client) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Client options must be instance of array", "phalcon/cache/backend/libmemcached.zep", 125); return; } ZEPHIR_CALL_METHOD(&_1$$4, memcache, "setoptions", NULL, 0, client); zephir_check_call_status(); if (!(zephir_is_true(_1$$4))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot set to Memcached options", "phalcon/cache/backend/libmemcached.zep", 129); return; } ZEPHIR_CALL_METHOD(&_2$$4, memcache, "addservers", NULL, 0, servers); zephir_check_call_status(); if (!(zephir_is_true(_2$$4))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot connect to Memcached server", "phalcon/cache/backend/libmemcached.zep", 133); return; } } zephir_update_property_this(this_ptr, SL("_memcache"), memcache TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Create internal connection to redis */ PHP_METHOD(Phalcon_Cache_Backend_Redis, _connect) { zend_bool _0, _1; int ZEPHIR_LAST_CALL_STATUS; zval *options, *redis, *persistent, *success = NULL, *host, *port, *auth; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(options); zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_INIT_VAR(redis); object_init_ex(redis, zephir_get_internal_ce(SS("redis") TSRMLS_CC)); if (zephir_has_constructor(redis TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL); zephir_check_call_status(); } ZEPHIR_OBS_VAR(host); _0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC)); if (!(_0)) { ZEPHIR_OBS_VAR(port); _0 = !(zephir_array_isset_string_fetch(&port, options, SS("port"), 0 TSRMLS_CC)); } _1 = _0; if (!(_1)) { ZEPHIR_OBS_VAR(persistent); _1 = !(zephir_array_isset_string_fetch(&persistent, options, SS("persistent"), 0 TSRMLS_CC)); } if (_1) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/redis.zep", 104); return; } if (zephir_is_true(persistent)) { ZEPHIR_CALL_METHOD(&success, redis, "pconnect", NULL, host, port); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(&success, redis, "connect", NULL, host, port); zephir_check_call_status(); } if (!(zephir_is_true(success))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot connect to Redisd server", "phalcon/cache/backend/redis.zep", 114); return; } ZEPHIR_OBS_VAR(auth); if (zephir_array_isset_string_fetch(&auth, options, SS("auth"), 0 TSRMLS_CC)) { ZEPHIR_CALL_METHOD(&success, redis, "auth", NULL, auth); zephir_check_call_status(); if (!(zephir_is_true(success))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Redisd server is authentication failed", "phalcon/cache/backend/redis.zep", 121); return; } } zephir_update_property_this(this_ptr, SL("_redis"), redis TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Validates a value against the class constants. * * If value is a valid constant name, returns the corresponding value. * * If value is null and a default is set, returns the default value. * * @param mixed value * * @return mixed * * @throws \RuntimeException if value is null and no default exists, or if given an invalid value. */ PHP_METHOD(Xpl_Enum, filterValidateValue) { int ZEPHIR_LAST_CALL_STATUS; zval *value = NULL, *reflection = NULL, *constants = NULL, *_0, *_2 = NULL, *_1$$6; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &value); if (!value) { ZEPHIR_CPY_WRT(value, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(value); } ZEPHIR_INIT_VAR(reflection); object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_INIT_VAR(_0); zephir_get_class(_0, this_ptr, 0 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 63, _0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&constants, reflection, "getconstants", NULL, 100); zephir_check_call_status(); if (Z_TYPE_P(value) == IS_NULL) { ZEPHIR_OBS_NVAR(value); if (zephir_array_isset_string_fetch(&value, constants, SS("_default"), 0 TSRMLS_CC)) { RETVAL_ZVAL(value, 1, 0); RETURN_MM(); } ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_RuntimeException, "Missing value: no default exists", "xpl/enum.zep", 177); return; } if (Z_TYPE_P(value) == IS_STRING) { if (zephir_array_isset(constants, value)) { zephir_array_fetch(&_1$$6, constants, value, PH_NOISY | PH_READONLY, "xpl/enum.zep", 183 TSRMLS_CC); ZEPHIR_CPY_WRT(value, _1$$6); } if ((zephir_method_exists(this_ptr, value TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_METHOD_ZVAL(this_ptr, value, NULL, 0); zephir_check_call_status(); RETURN_MM(); } } ZEPHIR_CALL_FUNCTION(&_2, "in_array", NULL, 2, value, constants, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); if (!(zephir_is_true(_2))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_RuntimeException, "Invalid enum value", "xpl/enum.zep", 193); return; } RETVAL_ZVAL(value, 1, 0); RETURN_MM(); }
/** * {@inheritDoc} */ PHP_METHOD(Owl_Std_Collection_ArrayCollection, getIterator) { int ZEPHIR_LAST_CALL_STATUS; zval *_0; ZEPHIR_MM_GROW(); object_init_ex(return_value, zephir_get_internal_ce(SS("arrayiterator") TSRMLS_CC)); _0 = zephir_fetch_nproperty_this(this_ptr, SL("elements"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 38, _0); zephir_check_call_status(); RETURN_MM(); }
/** * Implements \IteratorAggregate * * @return \Iterator */ PHP_METHOD(Xpl_Collection_Stack, getIterator) { zval *_0 = NULL; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); object_init_ex(return_value, zephir_get_internal_ce(SS("arrayiterator") TSRMLS_CC)); ZEPHIR_CALL_FUNCTION(&_0, "iterator_to_array", NULL, 14, this_ptr); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 77, _0); zephir_check_call_status(); RETURN_MM(); }
/** * Create internal connection to memcached */ PHP_METHOD(Phalcon_Cache_Backend_Memcache, _connect) { zend_bool _0, _1; zval *options = NULL, *memcache = NULL, *persistent = NULL, *success = NULL, *host = NULL, *port = NULL; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(options); zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_INIT_VAR(memcache); object_init_ex(memcache, zephir_get_internal_ce(SS("memcache") TSRMLS_CC)); if (zephir_has_constructor(memcache TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, memcache, "__construct", NULL, 0); zephir_check_call_status(); } ZEPHIR_OBS_VAR(host); _0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC)); if (!(_0)) { ZEPHIR_OBS_VAR(port); _0 = !(zephir_array_isset_string_fetch(&port, options, SS("port"), 0 TSRMLS_CC)); } _1 = _0; if (!(_1)) { ZEPHIR_OBS_VAR(persistent); _1 = !(zephir_array_isset_string_fetch(&persistent, options, SS("persistent"), 0 TSRMLS_CC)); } if (_1) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/memcache.zep", 105); return; } if (zephir_is_true(persistent)) { ZEPHIR_CALL_METHOD(&success, memcache, "pconnect", NULL, 0, host, port); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(&success, memcache, "connect", NULL, 0, host, port); zephir_check_call_status(); } if (!(zephir_is_true(success))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot connect to Memcached server", "phalcon/cache/backend/memcache.zep", 115); return; } zephir_update_property_this(this_ptr, SL("_memcache"), memcache TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
PHP_METHOD(PhalconPlus_RPC_Server_AbstractServer, requestCheck) { zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *service_param = NULL, *method_param = NULL, *request, *serviceReflection, *methodReflection = NULL; zval *service = NULL, *method = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &service_param, &method_param, &request); 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(serviceReflection); object_init_ex(serviceReflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, serviceReflection, "__construct", &_0, service); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&methodReflection, serviceReflection, "getmethod", &_1, method); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Returns the bag iterator */ PHP_METHOD(Phalcon_Session_Bag, getIterator) { zval *_0, *_1; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_initialized"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_0)) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0); zephir_check_call_status(); } object_init_ex(return_value, zephir_get_internal_ce(SS("arrayiterator") TSRMLS_CC)); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 437, _1); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(PhalconPlus_Db_UnitOfWork, __construct) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *dbServiceName, *_0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &dbServiceName); ZEPHIR_INIT_VAR(_0); object_init_ex(_0, zephir_get_internal_ce(SS("splobjectstorage") TSRMLS_CC)); if (zephir_has_constructor(_0 TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 0); zephir_check_call_status(); } zephir_update_property_this(getThis(), SL("objects"), _0 TSRMLS_CC); zephir_update_property_this(getThis(), SL("dbServiceName"), dbServiceName TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Yb_Std, throwError) { int ZEPHIR_LAST_CALL_STATUS; zval *context = NULL; zval *s = NULL, *f = NULL, *l = NULL; zval *n_param = NULL, *s_param = NULL, *f_param = NULL, *l_param = NULL, *context_param = NULL, *_0, _1, *_2 = NULL, *_3; long n; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 4, 1, &n_param, &s_param, &f_param, &l_param, &context_param); n = zephir_get_intval(n_param); zephir_get_strval(s, s_param); zephir_get_strval(f, f_param); zephir_get_strval(l, l_param); if (!context_param) { ZEPHIR_INIT_VAR(context); array_init(context); } else { zephir_get_arrval(context, context_param); } ZEPHIR_INIT_VAR(_0); object_init_ex(_0, zephir_get_internal_ce(SS("errorexception") TSRMLS_CC)); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "%s (%s:%d)", 0); ZEPHIR_CALL_FUNCTION(&_2, "sprintf", NULL, 1, &_1, s, f, l); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, n); ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 80, _2, _3); zephir_check_call_status(); zephir_throw_exception_debug(_0, "yb/std.zep", 417 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; }
/** * Returns the bag iterator */ PHP_METHOD(Phalcon_Session_Bag, getIterator) { zval _0, _1; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); zephir_read_property(&_0, this_ptr, SL("_initialized"), PH_NOISY_CC | PH_READONLY); if (ZEPHIR_IS_FALSE_IDENTICAL(&_0)) { ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0); zephir_check_call_status(); } object_init_ex(return_value, zephir_get_internal_ce(SL("arrayiterator"))); zephir_read_property(&_1, this_ptr, SL("_data"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 424, &_1); zephir_check_call_status(); RETURN_MM(); }
/** * Create internal connection to memcached */ PHP_METHOD(Phalcon_Cache_Backend_Libmemcached, _connect) { zval options, memcache, client, servers, persistentId, _0, _1$$4, _2$$4; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); ZVAL_UNDEF(&options); ZVAL_UNDEF(&memcache); ZVAL_UNDEF(&client); ZVAL_UNDEF(&servers); ZVAL_UNDEF(&persistentId); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1$$4); ZVAL_UNDEF(&_2$$4); ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(&options); zephir_read_property(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_OBS_VAR(&persistentId); if (!(zephir_array_isset_string_fetch(&persistentId, &options, SL("persistent_id"), 0))) { ZEPHIR_INIT_NVAR(&persistentId); ZVAL_STRING(&persistentId, "phalcon_cache"); } ZEPHIR_INIT_VAR(&memcache); object_init_ex(&memcache, zephir_get_internal_ce(SL("memcached"))); ZEPHIR_CALL_METHOD(NULL, &memcache, "__construct", NULL, 0, &persistentId); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, &memcache, "getserverlist", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(&_0)) { ZEPHIR_OBS_VAR(&servers); if (!(zephir_array_isset_string_fetch(&servers, &options, SL("servers"), 0))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Servers must be an array", "phalcon/cache/backend/libmemcached.zep", 110); return; } if (Z_TYPE_P(&servers) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Servers must be an array", "phalcon/cache/backend/libmemcached.zep", 114); return; } ZEPHIR_OBS_VAR(&client); if (!(zephir_array_isset_string_fetch(&client, &options, SL("client"), 0))) { ZEPHIR_INIT_NVAR(&client); array_init(&client); } if (Z_TYPE_P(&client) != IS_ARRAY) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Client options must be instance of array", "phalcon/cache/backend/libmemcached.zep", 122); return; } ZEPHIR_CALL_METHOD(&_1$$4, &memcache, "setoptions", NULL, 0, &client); zephir_check_call_status(); if (!(zephir_is_true(&_1$$4))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot set to Memcached options", "phalcon/cache/backend/libmemcached.zep", 126); return; } ZEPHIR_CALL_METHOD(&_2$$4, &memcache, "addservers", NULL, 0, &servers); zephir_check_call_status(); if (!(zephir_is_true(&_2$$4))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot connect to Memcached server", "phalcon/cache/backend/libmemcached.zep", 130); return; } } zephir_update_property_zval(this_ptr, SL("_memcache"), &memcache); ZEPHIR_MM_RESTORE(); }
/** * Sends SQL statements to the database server returning the success state. * Use this method only when the SQL statement sent to the server is returning rows * * <code> * //Querying data * $resultset = $connection->query("SELECT * FROM robots WHERE type = 'mechanical'"); * $resultset = $connection->query("SELECT * FROM robots WHERE type = ?", ["mechanical"]); * </code> * * @param string sqlStatement * @param array bindParams * @param array bindTypes * @return Pdm\Db\ResultInterface|\PDO|bool * <\Pdm\Db\ResultInterface> | <\PDOStatement> | boolean */ PHP_METHOD(Pdm_Db_Adapter_AbstractPdo, query) { int ZEPHIR_LAST_CALL_STATUS; zend_bool _0; zval *sqlStatement_param = NULL, *bindParams = NULL, *bindTypes = NULL, *statement = NULL, *result, *affectedRows = NULL, *_1, *_2 = NULL; zval *sqlStatement = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &sqlStatement_param, &bindParams, &bindTypes); if (unlikely(Z_TYPE_P(sqlStatement_param) != IS_STRING && Z_TYPE_P(sqlStatement_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlStatement' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (unlikely(Z_TYPE_P(sqlStatement_param) == IS_STRING)) { sqlStatement = sqlStatement_param; } else { ZEPHIR_INIT_VAR(sqlStatement); ZVAL_EMPTY_STRING(sqlStatement); } if (!bindParams) { ZEPHIR_INIT_VAR(bindParams); array_init(bindParams); } if (!bindTypes) { ZEPHIR_INIT_VAR(bindTypes); array_init(bindTypes); } _0 = Z_TYPE_P(bindParams) == IS_ARRAY; if (_0) { _0 = zephir_fast_count_int(bindParams TSRMLS_CC) > 0; } if (_0) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("pdo"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&statement, _1, "prepare", NULL, sqlStatement); zephir_check_call_status(); if (Z_TYPE_P(statement) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&_2, this_ptr, "executeprepared", NULL, statement, bindParams, bindTypes); zephir_check_call_status(); ZEPHIR_CPY_WRT(statement, _2); } } else { _1 = zephir_fetch_nproperty_this(this_ptr, SL("pdo"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&statement, _1, "query", NULL, sqlStatement); zephir_check_call_status(); } if (Z_TYPE_P(statement) == IS_OBJECT) { if (zephir_instance_of_ev(statement, zephir_get_internal_ce(SS("pdostatement") TSRMLS_CC) TSRMLS_CC)) { ZEPHIR_CALL_METHOD(&affectedRows, statement, "rowcount", NULL); zephir_check_call_status(); if (Z_TYPE_P(affectedRows) == IS_LONG) { zephir_update_property_this(this_ptr, SL("affectedRows"), affectedRows TSRMLS_CC); } ZEPHIR_INIT_VAR(result); object_init_ex(result, pdm_db_result_pdo_ce); ZEPHIR_CALL_METHOD(NULL, result, "__construct", NULL, this_ptr, statement, sqlStatement, bindParams, bindTypes); zephir_check_call_status(); RETURN_CCTOR(result); } } RETURN_CCTOR(statement); }
/** * Create internal connection to redis */ PHP_METHOD(Phalcon_Cache_Backend_Redis, _connect) { zend_bool _0, _1, _2, _5, _7; zval *options = NULL, *redis = NULL, *persistent = NULL, *success = NULL, *host = NULL, *port = NULL, *auth = NULL, *index = NULL, *timeout = NULL, *_6, *_3$$6, *_4$$6; zend_long ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(options); zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_INIT_VAR(redis); object_init_ex(redis, zephir_get_internal_ce(SS("redis") TSRMLS_CC)); if (zephir_has_constructor(redis TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL, 0); zephir_check_call_status(); } ZEPHIR_OBS_VAR(host); _0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC)); if (!(_0)) { ZEPHIR_OBS_VAR(port); _0 = !(zephir_array_isset_string_fetch(&port, options, SS("port"), 0 TSRMLS_CC)); } _1 = _0; if (!(_1)) { ZEPHIR_OBS_VAR(persistent); _1 = !(zephir_array_isset_string_fetch(&persistent, options, SS("persistent"), 0 TSRMLS_CC)); } _2 = _1; if (!(_2)) { ZEPHIR_OBS_VAR(timeout); _2 = !(zephir_array_isset_string_fetch(&timeout, options, SS("timeout"), 0 TSRMLS_CC)); } if (_2) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/redis.zep", 120); return; } if (zephir_is_true(persistent)) { ZEPHIR_CALL_METHOD(&success, redis, "pconnect", NULL, 0, host, port, timeout); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(&success, redis, "connect", NULL, 0, host, port, timeout); zephir_check_call_status(); } if (!(zephir_is_true(success))) { ZEPHIR_INIT_VAR(_3$$6); object_init_ex(_3$$6, phalcon_cache_exception_ce); ZEPHIR_INIT_VAR(_4$$6); ZEPHIR_CONCAT_SVSV(_4$$6, "Could not connect to the Redisd server ", host, ":", port); ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 9, _4$$6); zephir_check_call_status(); zephir_throw_exception_debug(_3$$6, "phalcon/cache/backend/redis.zep", 130 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_OBS_VAR(auth); _5 = zephir_array_isset_string_fetch(&auth, options, SS("auth"), 0 TSRMLS_CC); if (_5) { zephir_array_fetch_string(&_6, options, SL("auth"), PH_NOISY | PH_READONLY, "phalcon/cache/backend/redis.zep", 133 TSRMLS_CC); _5 = !(ZEPHIR_IS_EMPTY(_6)); } if (_5) { ZEPHIR_CALL_METHOD(&success, redis, "auth", NULL, 0, auth); zephir_check_call_status(); if (!(zephir_is_true(success))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Failed to authenticate with the Redisd server", "phalcon/cache/backend/redis.zep", 137); return; } } ZEPHIR_OBS_VAR(index); _7 = zephir_array_isset_string_fetch(&index, options, SS("index"), 0 TSRMLS_CC); if (_7) { _7 = ZEPHIR_GT_LONG(index, 0); } if (_7) { ZEPHIR_CALL_METHOD(&success, redis, "select", NULL, 0, index); zephir_check_call_status(); if (!(zephir_is_true(success))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Redis server selected database failed", "phalcon/cache/backend/redis.zep", 145); return; } } zephir_update_property_this(getThis(), SL("_redis"), redis TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Yb_Std, newInstanceOf) { zend_class_entry *_1$$3, *_4$$5, *_7$$6, *_11$$7, *_16$$8, *_22$$9; long c = 0; int ZEPHIR_LAST_CALL_STATUS; zval *args = NULL; zval *className_param = NULL, *args_param = NULL, *a = NULL, *_28, *_0$$3 = NULL, *_2$$4, *_3$$5 = NULL, *_5$$5, *_6$$6 = NULL, *_8$$6, *_9$$6, *_10$$7 = NULL, *_12$$7, *_13$$7, *_14$$7, *_15$$8 = NULL, *_17$$8, *_18$$8, *_19$$8, *_20$$8, *_21$$9 = NULL, *_23$$9, *_24$$9, *_25$$9, *_26$$9, *_27$$9; zval *className = NULL, *_29; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &className_param, &args_param); zephir_get_strval(className, className_param); if (!args_param) { ZEPHIR_INIT_VAR(args); array_init(args); } else { zephir_get_arrval(args, args_param); } c = zephir_fast_count_int(args TSRMLS_CC); if (c < 1) { zephir_fetch_safe_class(_0$$3, className); _1$$3 = zend_fetch_class(Z_STRVAL_P(_0$$3), Z_STRLEN_P(_0$$3), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(return_value, _1$$3); if (zephir_has_constructor(return_value TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0); zephir_check_call_status(); } RETURN_MM(); } if (c > 5) { ZEPHIR_INIT_VAR(_2$$4); object_init_ex(_2$$4, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, _2$$4, "__construct", NULL, 16, className); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(_2$$4, "newinstanceargs", NULL, 18, args); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_CALL_FUNCTION(&a, "array_values", NULL, 22, args); zephir_check_call_status(); do { if (c == 1) { zephir_fetch_safe_class(_3$$5, className); _4$$5 = zend_fetch_class(Z_STRVAL_P(_3$$5), Z_STRLEN_P(_3$$5), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(return_value, _4$$5); if (zephir_has_constructor(return_value TSRMLS_CC)) { zephir_array_fetch_long(&_5$$5, a, 0, PH_NOISY | PH_READONLY, "yb/std.zep", 396 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0, _5$$5); zephir_check_call_status(); } RETURN_MM(); } if (c == 2) { zephir_fetch_safe_class(_6$$6, className); _7$$6 = zend_fetch_class(Z_STRVAL_P(_6$$6), Z_STRLEN_P(_6$$6), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(return_value, _7$$6); if (zephir_has_constructor(return_value TSRMLS_CC)) { zephir_array_fetch_long(&_8$$6, a, 0, PH_NOISY | PH_READONLY, "yb/std.zep", 398 TSRMLS_CC); zephir_array_fetch_long(&_9$$6, a, 1, PH_NOISY | PH_READONLY, "yb/std.zep", 398 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0, _8$$6, _9$$6); zephir_check_call_status(); } RETURN_MM(); } if (c == 3) { zephir_fetch_safe_class(_10$$7, className); _11$$7 = zend_fetch_class(Z_STRVAL_P(_10$$7), Z_STRLEN_P(_10$$7), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(return_value, _11$$7); if (zephir_has_constructor(return_value TSRMLS_CC)) { zephir_array_fetch_long(&_12$$7, a, 0, PH_NOISY | PH_READONLY, "yb/std.zep", 400 TSRMLS_CC); zephir_array_fetch_long(&_13$$7, a, 1, PH_NOISY | PH_READONLY, "yb/std.zep", 400 TSRMLS_CC); zephir_array_fetch_long(&_14$$7, a, 2, PH_NOISY | PH_READONLY, "yb/std.zep", 400 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0, _12$$7, _13$$7, _14$$7); zephir_check_call_status(); } RETURN_MM(); } if (c == 4) { zephir_fetch_safe_class(_15$$8, className); _16$$8 = zend_fetch_class(Z_STRVAL_P(_15$$8), Z_STRLEN_P(_15$$8), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(return_value, _16$$8); if (zephir_has_constructor(return_value TSRMLS_CC)) { zephir_array_fetch_long(&_17$$8, a, 0, PH_NOISY | PH_READONLY, "yb/std.zep", 402 TSRMLS_CC); zephir_array_fetch_long(&_18$$8, a, 1, PH_NOISY | PH_READONLY, "yb/std.zep", 402 TSRMLS_CC); zephir_array_fetch_long(&_19$$8, a, 2, PH_NOISY | PH_READONLY, "yb/std.zep", 402 TSRMLS_CC); zephir_array_fetch_long(&_20$$8, a, 3, PH_NOISY | PH_READONLY, "yb/std.zep", 402 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0, _17$$8, _18$$8, _19$$8, _20$$8); zephir_check_call_status(); } RETURN_MM(); } if (c == 5) { zephir_fetch_safe_class(_21$$9, className); _22$$9 = zend_fetch_class(Z_STRVAL_P(_21$$9), Z_STRLEN_P(_21$$9), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(return_value, _22$$9); if (zephir_has_constructor(return_value TSRMLS_CC)) { zephir_array_fetch_long(&_23$$9, a, 0, PH_NOISY | PH_READONLY, "yb/std.zep", 404 TSRMLS_CC); zephir_array_fetch_long(&_24$$9, a, 1, PH_NOISY | PH_READONLY, "yb/std.zep", 404 TSRMLS_CC); zephir_array_fetch_long(&_25$$9, a, 2, PH_NOISY | PH_READONLY, "yb/std.zep", 404 TSRMLS_CC); zephir_array_fetch_long(&_26$$9, a, 3, PH_NOISY | PH_READONLY, "yb/std.zep", 404 TSRMLS_CC); zephir_array_fetch_long(&_27$$9, a, 4, PH_NOISY | PH_READONLY, "yb/std.zep", 404 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0, _23$$9, _24$$9, _25$$9, _26$$9, _27$$9); zephir_check_call_status(); } RETURN_MM(); } } while(0); ZEPHIR_INIT_VAR(_28); object_init_ex(_28, yb_exception_ce); ZEPHIR_INIT_VAR(_29); ZEPHIR_CONCAT_SV(_29, "Fail to fetch a new instance of class: ", className); ZEPHIR_CALL_METHOD(NULL, _28, "__construct", NULL, 2, _29); zephir_check_call_status(); zephir_throw_exception_debug(_28, "yb/std.zep", 407 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; }
/** * Resolves the service based on its configuration */ PHP_METHOD(Phalcon_Di, get) { zval *_1$$3, *_5$$19; int ZEPHIR_LAST_CALL_STATUS; zval *name_param = NULL, *parameters = NULL, *service = NULL, *instance = NULL, *reflection = NULL, *eventsManager = NULL, *_0, *_2$$3, *_3$$6, *_6$$19; zval *name = NULL, *_4$$6; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &name_param, ¶meters); if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(name_param) == IS_STRING)) { zephir_get_strval(name, name_param); } else { ZEPHIR_INIT_VAR(name); ZVAL_EMPTY_STRING(name); } if (!parameters) { parameters = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC); ZEPHIR_CPY_WRT(eventsManager, _0); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_1$$3); zephir_create_array(_1$$3, 2, 0 TSRMLS_CC); zephir_array_update_string(&_1$$3, SL("name"), &name, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_1$$3, SL("parameters"), ¶meters, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_2$$3); ZVAL_STRING(_2$$3, "di:beforeServiceResolve", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _2$$3, this_ptr, _1$$3); zephir_check_temp_parameter(_2$$3); zephir_check_call_status(); } ZEPHIR_OBS_VAR(service); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_services"), PH_NOISY_CC); if (zephir_array_isset_fetch(&service, _0, name, 0 TSRMLS_CC)) { ZEPHIR_CALL_METHOD(&instance, service, "resolve", NULL, 0, parameters, this_ptr); zephir_check_call_status(); } else { if (!(zephir_class_exists(name, 1 TSRMLS_CC))) { ZEPHIR_INIT_VAR(_3$$6); object_init_ex(_3$$6, phalcon_di_exception_ce); ZEPHIR_INIT_VAR(_4$$6); ZEPHIR_CONCAT_SVS(_4$$6, "Service '", name, "' wasn't found in the dependency injection container"); ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 9, _4$$6); zephir_check_call_status(); zephir_throw_exception_debug(_3$$6, "phalcon/di.zep", 229 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(parameters) == IS_ARRAY) { if (zephir_fast_count_int(parameters TSRMLS_CC)) { if (zephir_is_php_version(50600)) { ZEPHIR_INIT_VAR(reflection); object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 66, name); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&instance, reflection, "newinstanceargs", NULL, 67, parameters); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(instance); ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(instance, name, parameters TSRMLS_CC); zephir_check_call_status(); } } else { if (zephir_is_php_version(50600)) { ZEPHIR_INIT_NVAR(reflection); object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 66, name); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&instance, reflection, "newinstance", NULL, 68); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(instance); ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(instance, name TSRMLS_CC); zephir_check_call_status(); } } } else { if (zephir_is_php_version(50600)) { ZEPHIR_INIT_NVAR(reflection); object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 66, name); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&instance, reflection, "newinstance", NULL, 68); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(instance); ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(instance, name TSRMLS_CC); zephir_check_call_status(); } } } if (Z_TYPE_P(instance) == IS_OBJECT) { if (zephir_instance_of_ev(instance, phalcon_di_injectionawareinterface_ce TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, instance, "setdi", NULL, 0, this_ptr); zephir_check_call_status(); } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_5$$19); zephir_create_array(_5$$19, 3, 0 TSRMLS_CC); zephir_array_update_string(&_5$$19, SL("name"), &name, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_5$$19, SL("parameters"), ¶meters, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_5$$19, SL("instance"), &instance, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_6$$19); ZVAL_STRING(_6$$19, "di:afterServiceResolve", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _6$$19, this_ptr, _5$$19); zephir_check_temp_parameter(_6$$19); zephir_check_call_status(); } RETURN_CCTOR(instance); }
/** * Sets the expiration time for this cache item. * * @param int|\DateInterval time * The period of time from the present after which the item MUST be considered * expired. An integer parameter is understood to be the time in seconds until * expiration. If null is passed explicitly, a default value MAY be used. * If none is set, the value should be stored permanently or for as long as the * implementation allows. * * @return \Xpl\Cache\Item * The called object. */ PHP_METHOD(Xpl_Cache_Item, expiresAfter) { zend_class_entry *_6$$7; int ZEPHIR_LAST_CALL_STATUS; zval *time, *_0$$3, *_1$$3, *_2$$3, *_3$$5, *_4$$5, *_5$$7 = NULL, *_7$$7, *_8$$7 = NULL, *_9$$7 = NULL, *_10$$7 = NULL, *_11$$8, *_12$$8 = NULL, _13$$8, *_14$$8 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &time); if (Z_TYPE_P(time) == IS_NULL) { ZEPHIR_INIT_VAR(_0$$3); zephir_time(_0$$3); _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("defaultTtl"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_2$$3); zephir_add_function(_2$$3, _0$$3, _1$$3); zephir_update_property_this(this_ptr, SL("expires"), _2$$3 TSRMLS_CC); } else { if (Z_TYPE_P(time) == IS_LONG) { ZEPHIR_INIT_VAR(_3$$5); zephir_time(_3$$5); ZEPHIR_INIT_VAR(_4$$5); zephir_add_function(_4$$5, _3$$5, time); zephir_update_property_this(this_ptr, SL("expires"), _4$$5 TSRMLS_CC); } else { if (zephir_instance_of_ev(time, zephir_get_internal_ce(SS("dateinterval") TSRMLS_CC) TSRMLS_CC)) { _6$$7 = zend_fetch_class(SL("DateTime"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); ZEPHIR_INIT_VAR(_7$$7); zephir_time(_7$$7); ZEPHIR_INIT_VAR(_8$$7); ZVAL_STRING(_8$$7, "U", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_CE_STATIC(&_5$$7, _6$$7, "createfromformat", NULL, 0, _8$$7, _7$$7); zephir_check_temp_parameter(_8$$7); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_9$$7, _5$$7, "add", NULL, 0, time); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_8$$7); ZVAL_STRING(_8$$7, "U", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_10$$7, _9$$7, "format", NULL, 0, _8$$7); zephir_check_temp_parameter(_8$$7); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("expires"), _10$$7 TSRMLS_CC); } else { ZEPHIR_INIT_VAR(_11$$8); object_init_ex(_11$$8, xpl_cache_invalidargumentexception_ce); ZEPHIR_INIT_VAR(_12$$8); if (Z_TYPE_P(time) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_12$$8); zephir_get_class(_12$$8, time, 0 TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(_12$$8); zephir_gettype(_12$$8, time TSRMLS_CC); } ZEPHIR_SINIT_VAR(_13$$8); ZVAL_STRING(&_13$$8, "Expiration date must be integer, DateInterval or null, given: \"%s\".", 0); ZEPHIR_CALL_FUNCTION(&_14$$8, "sprintf", NULL, 41, &_13$$8, _12$$8); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, _11$$8, "__construct", NULL, 42, _14$$8); zephir_check_call_status(); zephir_throw_exception_debug(_11$$8, "xpl/cache/item.zep", 181 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } RETURN_THIS(); }
PHP_METHOD(PhalconPlus_Db_Mysql, getConnection) { zephir_nts_static zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; zephir_fcall_cache_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS, _5; zval *connection = NULL, *tryTimes = NULL, *e = NULL, *_0, *_2 = NULL, *_3 = NULL, _6 = zval_used_for_init; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(connection); ZVAL_NULL(connection); ZEPHIR_INIT_VAR(tryTimes); ZVAL_LONG(tryTimes, 5); while (1) { if (!(!(Z_TYPE_P(connection) == IS_OBJECT))) { break; } /* try_start_1: */ ZEPHIR_INIT_NVAR(connection); object_init_ex(connection, zephir_get_internal_ce(SS("phalcon\\db\\adapter\\pdo\\mysql") TSRMLS_CC)); _0 = zephir_fetch_nproperty_this(this_ptr, SL("descriptor"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, connection, "__construct", &_1, _0); zephir_check_call_status_or_jump(try_end_1); try_end_1: if (EG(exception)) { ZEPHIR_CPY_WRT(e, EG(exception)); if (zephir_is_instance_of(e, SL("PhalconPlus\\Db\\Exception") TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_INIT_NVAR(_2); _0 = zephir_fetch_nproperty_this(this_ptr, SL("descriptor"), PH_NOISY_CC); zephir_json_encode(_2, &(_2), _0, 0 TSRMLS_CC); ZEPHIR_INIT_LNVAR(_3); ZEPHIR_CONCAT_SV(_3, "PHP Fatal error: PhalconPlus::Db::MySQL::connect() failed to connect to MySQL. Detail: ", _2); ZEPHIR_CALL_FUNCTION(NULL, "error_log", &_4, _3); zephir_check_call_status(); _5 = (zephir_get_numberval(tryTimes) - 1); ZEPHIR_INIT_NVAR(tryTimes); ZVAL_LONG(tryTimes, _5); if (ZEPHIR_GT_LONG(tryTimes, 0)) { ZEPHIR_SINIT_NVAR(_6); ZVAL_LONG(&_6, 100000); ZEPHIR_CALL_FUNCTION(NULL, "usleep", &_7, &_6); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_6); ZVAL_STRING(&_6, "PHP Notice: PhalconPlus::Db::MySQL::connnect() retry to connect to MySQL for the time ... ", 0); ZEPHIR_CALL_FUNCTION(NULL, "error_log", &_4, &_6); zephir_check_call_status(); } else { ZEPHIR_SINIT_NVAR(_6); ZVAL_STRING(&_6, "PHP Fatal error: PhalconPlus::Db::MySQL::connect() finally failed to connect to MySQL", 0); ZEPHIR_CALL_FUNCTION(NULL, "error_log", &_4, &_6); zephir_check_call_status(); zephir_throw_exception_debug(e, "phalconplus/Db/Mysql.zep", 52 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } } RETURN_CCTOR(connection); }
/** * Create internal connection to redis */ PHP_METHOD(Phalcon_Cache_Backend_Redis, _connect) { zend_bool _0, _1; int ZEPHIR_LAST_CALL_STATUS; zval *options, *redis, *persistent, *success = NULL, *host, *port, *auth, *index, *_2, *_3; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(options); zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_INIT_VAR(redis); object_init_ex(redis, zephir_get_internal_ce(SS("redis") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL, 0); zephir_check_call_status(); ZEPHIR_OBS_VAR(host); _0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC)); if (!(_0)) { ZEPHIR_OBS_VAR(port); _0 = !(zephir_array_isset_string_fetch(&port, options, SS("port"), 0 TSRMLS_CC)); } _1 = _0; if (!(_1)) { ZEPHIR_OBS_VAR(persistent); _1 = !(zephir_array_isset_string_fetch(&persistent, options, SS("persistent"), 0 TSRMLS_CC)); } if (_1) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/redis.zep", 108); return; } if (zephir_is_true(persistent)) { ZEPHIR_CALL_METHOD(&success, redis, "pconnect", NULL, 0, host, port); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(&success, redis, "connect", NULL, 0, host, port); zephir_check_call_status(); } if (!(zephir_is_true(success))) { ZEPHIR_INIT_VAR(_2); object_init_ex(_2, phalcon_cache_exception_ce); ZEPHIR_INIT_VAR(_3); ZEPHIR_CONCAT_SVSV(_3, "Could not connect to the Redisd server ", host, ":", port); ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, 9, _3); zephir_check_call_status(); zephir_throw_exception_debug(_2, "phalcon/cache/backend/redis.zep", 118 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_OBS_VAR(auth); if (zephir_array_isset_string_fetch(&auth, options, SS("auth"), 0 TSRMLS_CC)) { ZEPHIR_CALL_METHOD(&success, redis, "auth", NULL, 0, auth); zephir_check_call_status(); if (!(zephir_is_true(success))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Failed to authenticate with the Redisd server", "phalcon/cache/backend/redis.zep", 125); return; } } ZEPHIR_OBS_VAR(index); if (zephir_array_isset_string_fetch(&index, options, SS("index"), 0 TSRMLS_CC)) { ZEPHIR_CALL_METHOD(&success, redis, "select", NULL, 0, index); zephir_check_call_status(); if (!(zephir_is_true(success))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Redisd server selected database failed", "phalcon/cache/backend/redis.zep", 133); return; } } zephir_update_property_this(this_ptr, SL("_redis"), redis TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Get modified params for handler using reflection */ PHP_METHOD(Phalcon_Mvc_Model_Binder, getParamsFromReflection) { zend_class_entry *_8$$10, *_9$$14, *_13$$16, *_14$$18; HashTable *_2; HashPosition _1; zephir_fcall_cache_entry *_7 = NULL, *_12 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *cacheKey = NULL; zval *params = NULL; zval *handler, *params_param = NULL, *cacheKey_param = NULL, *methodName, *methodParams = NULL, *reflection = NULL, *paramKey = NULL, *methodParam = NULL, *paramsCache = NULL, *className = NULL, *realClasses = NULL, *boundModel = NULL, *cache = NULL, *handlerClass = NULL, *reflectionClass = NULL, *paramsKeys = NULL, *paramValue = NULL, *_0, **_3, *_4$$7, _5$$5 = zval_used_for_init, *_6$$5 = NULL, *_10$$15 = NULL, *_11$$15 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 4, 0, &handler, ¶ms_param, &cacheKey_param, &methodName); zephir_get_arrval(params, params_param); zephir_get_strval(cacheKey, cacheKey_param); ZEPHIR_INIT_VAR(realClasses); ZVAL_NULL(realClasses); ZEPHIR_INIT_VAR(paramsCache); array_init(paramsCache); ZEPHIR_INIT_VAR(reflection); if (Z_TYPE_P(methodName) != IS_NULL) { object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionmethod") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 324, handler, methodName); zephir_check_call_status(); } else { object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 82, handler); zephir_check_call_status(); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("cache"), PH_NOISY_CC); ZEPHIR_CPY_WRT(cache, _0); ZEPHIR_CALL_METHOD(&methodParams, reflection, "getparameters", NULL, 83); zephir_check_call_status(); ZEPHIR_INIT_VAR(paramsKeys); zephir_array_keys(paramsKeys, params TSRMLS_CC); zephir_is_iterable(methodParams, &_2, &_1, 0, 0, "phalcon/mvc/model/binder.zep", 197); for ( ; zend_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zend_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(paramKey, _2, _1); ZEPHIR_GET_HVALUE(methodParam, _3); ZEPHIR_CALL_METHOD(&reflectionClass, methodParam, "getclass", NULL, 0); zephir_check_call_status(); if (!(zephir_is_true(reflectionClass))) { continue; } ZEPHIR_CALL_METHOD(&className, reflectionClass, "getname", NULL, 0); zephir_check_call_status(); if (!(zephir_array_isset(params, paramKey))) { zephir_array_fetch(&_4$$7, paramsKeys, paramKey, PH_NOISY | PH_READONLY, "phalcon/mvc/model/binder.zep", 157 TSRMLS_CC); ZEPHIR_CPY_WRT(paramKey, _4$$7); } ZEPHIR_INIT_NVAR(boundModel); ZVAL_NULL(boundModel); ZEPHIR_OBS_NVAR(paramValue); zephir_array_fetch(¶mValue, params, paramKey, PH_NOISY, "phalcon/mvc/model/binder.zep", 160 TSRMLS_CC); ZEPHIR_SINIT_NVAR(_5$$5); ZVAL_STRING(&_5$$5, "Phalcon\\Mvc\\Model", 0); ZEPHIR_CALL_FUNCTION(&_6$$5, "is_subclass_of", &_7, 325, className, &_5$$5); zephir_check_call_status(); if (ZEPHIR_IS_STRING(className, "Phalcon\\Mvc\\Model")) { if (Z_TYPE_P(realClasses) == IS_NULL) { if (zephir_instance_of_ev(handler, phalcon_mvc_controller_bindmodelinterface_ce TSRMLS_CC)) { ZEPHIR_INIT_NVAR(handlerClass); zephir_get_class(handlerClass, handler, 0 TSRMLS_CC); _8$$10 = zephir_fetch_class(handlerClass TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&realClasses, _8$$10, "getmodelname", NULL, 0); zephir_check_call_status(); } else if (zephir_instance_of_ev(handler, phalcon_mvc_model_binder_bindableinterface_ce TSRMLS_CC)) { ZEPHIR_CALL_METHOD(&realClasses, handler, "getmodelname", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Handler must implement Phalcon\\Mvc\\Model\\Binder\\BindableInterface in order to use Phalcon\\Mvc\\Model as parameter", "phalcon/mvc/model/binder.zep", 170); return; } } if (Z_TYPE_P(realClasses) == IS_ARRAY) { ZEPHIR_OBS_NVAR(className); if (zephir_array_isset_fetch(&className, realClasses, paramKey, 0 TSRMLS_CC)) { _9$$14 = zephir_fetch_class(className TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&boundModel, _9$$14, "findfirst", NULL, 0, paramValue); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(_10$$15); object_init_ex(_10$$15, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_11$$15); ZEPHIR_CONCAT_SVS(_11$$15, "You should provide model class name for ", paramKey, " parameter"); ZEPHIR_CALL_METHOD(NULL, _10$$15, "__construct", &_12, 9, _11$$15); zephir_check_call_status(); zephir_throw_exception_debug(_10$$15, "phalcon/mvc/model/binder.zep", 177 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } else if (Z_TYPE_P(realClasses) == IS_STRING) { _13$$16 = zephir_fetch_class(realClasses TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&boundModel, _13$$16, "findfirst", NULL, 0, paramValue); zephir_check_call_status(); ZEPHIR_CPY_WRT(className, realClasses); } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "getModelName should return array or string", "phalcon/mvc/model/binder.zep", 183); return; } } else if (zephir_is_true(_6$$5)) { _14$$18 = zephir_fetch_class(className TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&boundModel, _14$$18, "findfirst", NULL, 0, paramValue); zephir_check_call_status(); } if (Z_TYPE_P(boundModel) != IS_NULL) { zephir_update_property_array(this_ptr, SL("originalValues"), paramKey, paramValue TSRMLS_CC); zephir_array_update_zval(¶ms, paramKey, &boundModel, PH_COPY | PH_SEPARATE); zephir_update_property_array(this_ptr, SL("boundModels"), paramKey, boundModel TSRMLS_CC); zephir_array_update_zval(¶msCache, paramKey, &className, PH_COPY | PH_SEPARATE); } } if (Z_TYPE_P(cache) != IS_NULL) { ZEPHIR_CALL_METHOD(NULL, cache, "save", NULL, 0, cacheKey, paramsCache); zephir_check_call_status(); } zephir_update_property_array(this_ptr, SL("internalCache"), cacheKey, paramsCache TSRMLS_CC); RETURN_CTOR(params); }
/** * Returns a MongoDb collection based on the backend parameters * * @return MongoCollection */ PHP_METHOD(Phalcon_Cache_Backend_Mongo, _getCollection) { int ZEPHIR_LAST_CALL_STATUS; zend_bool _0; zval *options, *mongo = NULL, *server, *database, *collection, *mongoCollection = NULL, *_1 = NULL; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(mongoCollection); zephir_read_property_this(&mongoCollection, this_ptr, SL("_collection"), PH_NOISY_CC); if (Z_TYPE_P(mongoCollection) != IS_OBJECT) { ZEPHIR_OBS_VAR(options); zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC); ZEPHIR_OBS_VAR(mongo); if (zephir_array_isset_string_fetch(&mongo, options, SS("mongo"), 0 TSRMLS_CC)) { if (Z_TYPE_P(mongo) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The 'mongo' parameter must be a valid Mongo instance", "phalcon/cache/backend/mongo.zep", 104); return; } } else { ZEPHIR_OBS_VAR(server); zephir_array_fetch_string(&server, options, SL("server"), PH_NOISY, "phalcon/cache/backend/mongo.zep", 112 TSRMLS_CC); _0 = !zephir_is_true(server); if (!(_0)) { _0 = Z_TYPE_P(server) != IS_STRING; } if (_0) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The backend requires a valid MongoDB connection string", "phalcon/cache/backend/mongo.zep", 114); return; } ZEPHIR_INIT_NVAR(mongo); object_init_ex(mongo, zephir_get_internal_ce(SS("mongoclient") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, mongo, "__construct", NULL, server); zephir_check_call_status(); } ZEPHIR_OBS_VAR(database); zephir_array_fetch_string(&database, options, SL("db"), PH_NOISY, "phalcon/cache/backend/mongo.zep", 123 TSRMLS_CC); _0 = !zephir_is_true(database); if (!(_0)) { _0 = Z_TYPE_P(database) != IS_STRING; } if (_0) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The backend requires a valid MongoDB db", "phalcon/cache/backend/mongo.zep", 125); return; } ZEPHIR_OBS_VAR(collection); zephir_array_fetch_string(&collection, options, SL("collection"), PH_NOISY, "phalcon/cache/backend/mongo.zep", 131 TSRMLS_CC); _0 = !zephir_is_true(collection); if (!(_0)) { _0 = Z_TYPE_P(collection) != IS_STRING; } if (_0) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The backend requires a valid MongoDB collection", "phalcon/cache/backend/mongo.zep", 133); return; } ZEPHIR_CALL_METHOD(&_1, mongo, "selectdb", NULL, database); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&mongoCollection, _1, "selectcollection", NULL, collection); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_collection"), mongoCollection TSRMLS_CC); } RETURN_CCTOR(mongoCollection); }
PHP_METHOD(Pdm_Db_Adapter_AbstractPdo, bindStatmentParameters) { zephir_fcall_cache_entry *_4 = NULL, *_5 = NULL, *_7 = NULL; int ZEPHIR_LAST_CALL_STATUS; HashTable *_1; HashPosition _0; zend_bool hasBindParams, hasBindTypes, _3; zval *statement, *bindParams = NULL, *bindTypes = NULL, *wildcard = NULL, *value = NULL, *parameter = NULL, *type = NULL, *castValue = NULL, **_2, *_6 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &statement, &bindParams, &bindTypes); if (!bindParams) { ZEPHIR_INIT_VAR(bindParams); array_init(bindParams); } if (!bindTypes) { ZEPHIR_INIT_VAR(bindTypes); array_init(bindTypes); } else { ZEPHIR_SEPARATE_PARAM(bindTypes); } if (!(zephir_instance_of_ev(statement, zephir_get_internal_ce(SS("pdostatement") TSRMLS_CC) TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'statement' must be an instance of 'PDOStatement'", "", 0); return; } if (Z_TYPE_P(bindTypes) != IS_ARRAY) { ZEPHIR_INIT_NVAR(bindTypes); array_init(bindTypes); } if (zephir_fast_count_int(bindParams TSRMLS_CC) > 0) { hasBindParams = 1; } else { hasBindParams = 0; } if (zephir_fast_count_int(bindTypes TSRMLS_CC) > 0) { hasBindTypes = 1; } else { hasBindTypes = 0; } zephir_is_iterable(bindParams, &_1, &_0, 0, 0); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HMKEY(wildcard, _1, _0); ZEPHIR_GET_HVALUE(value, _2); if (Z_TYPE_P(wildcard) == IS_LONG) { ZEPHIR_INIT_NVAR(parameter); ZVAL_LONG(parameter, (zephir_get_numberval(wildcard) + 1)); } else { if (Z_TYPE_P(wildcard) == IS_STRING) { ZEPHIR_CPY_WRT(parameter, wildcard); } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(pdm_db_adapter_exception_ce, "Invalid bind parameter (1)", "pdm/db/adapter/abstractpdo.zep", 126); return; } } _3 = hasBindParams; if (_3) { _3 = hasBindTypes; } if (_3) { ZEPHIR_OBS_NVAR(type); if (!(zephir_array_isset_fetch(&type, bindTypes, wildcard, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(type); ZVAL_LONG(type, 2); } if (ZEPHIR_IS_LONG(type, 32)) { ZEPHIR_INIT_NVAR(castValue); ZVAL_DOUBLE(castValue, zephir_get_doubleval(value)); ZEPHIR_INIT_NVAR(type); ZVAL_LONG(type, 1024); } else { ZEPHIR_CPY_WRT(castValue, value); } if (ZEPHIR_IS_LONG(type, 1024)) { Z_SET_ISREF_P(castValue); ZEPHIR_CALL_METHOD(NULL, statement, "bindparam", &_4, parameter, castValue); zephir_check_call_status(); Z_UNSET_ISREF_P(castValue); } else { Z_SET_ISREF_P(castValue); ZEPHIR_CALL_METHOD(NULL, statement, "bindparam", &_5, parameter, castValue, type); zephir_check_call_status(); Z_UNSET_ISREF_P(castValue); } } else { ZEPHIR_INIT_NVAR(_6); ZVAL_LONG(_6, 2); Z_SET_ISREF_P(value); ZEPHIR_CALL_METHOD(NULL, statement, "bindparam", &_7, parameter, value, _6); zephir_check_call_status(); Z_UNSET_ISREF_P(value); } } RETURN_CCTOR(statement); }
/** * Shows a backtrace item */ PHP_METHOD(Phalcon_Debug, showTraceItem) { zend_bool _40$$24; HashTable *_18$$14; HashPosition _17$$14; zval *_1, *_26$$16 = NULL; zephir_fcall_cache_entry *_21 = NULL, *_47 = NULL; zval *trace = NULL; zval *n_param = NULL, *trace_param = NULL, *className = NULL, *prepareInternalClass = NULL, *preparedFunctionName = NULL, *html = NULL, *classReflection = NULL, *prepareUriClass = NULL, *functionName = NULL, *functionReflection = NULL, *traceArgs = NULL, *arguments = NULL, *argument = NULL, *filez = NULL, *line = NULL, *showFiles = NULL, *lines = NULL, *numberLines = NULL, *showFileFragment = NULL, *beforeLine = NULL, *afterLine = NULL, *lastLine = NULL, *linePosition = NULL, *currentLine = NULL, *classNameWithLink = NULL, *functionNameWithLink = NULL, _0, *_16, *_2$$3, *_3$$3, _4$$3, *_11$$3, *_12$$3, _5$$4, _6$$4, *_7$$5 = NULL, *_8$$6, _9$$6, _10$$6, *_13$$10 = NULL, _14$$11, _15$$11, **_19$$14, *_23$$14, *_24$$14, *_20$$15 = NULL, *_22$$15 = NULL, *_25$$16, *_27$$16, _28$$18, _29$$18, *_30$$18, _31$$23, *_32$$23, *_33$$26 = NULL, *_34$$26 = NULL, *_35$$26 = NULL, _36$$26 = zval_used_for_init, *_37$$27 = NULL, _38$$27 = zval_used_for_init, _39$$27 = zval_used_for_init, *_41$$29 = NULL, _42$$29 = zval_used_for_init, _43$$29 = zval_used_for_init, _44$$29 = zval_used_for_init, _45$$29 = zval_used_for_init, *_46$$29 = NULL; int n, ZEPHIR_LAST_CALL_STATUS, firstLine = 0, i = 0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &n_param, &trace_param); n = zephir_get_intval(n_param); trace = trace_param; ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, n); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "<tr><td align=\"right\" valign=\"top\" class=\"error-number\">#", &_0, "</td><td>"); ZEPHIR_CPY_WRT(html, _1); ZEPHIR_OBS_VAR(className); if (zephir_array_isset_string_fetch(&className, trace, SS("class"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_2$$3); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "/^Phalcon/", 0); zephir_preg_match(_3$$3, &_4$$3, className, _2$$3, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_3$$3)) { ZEPHIR_SINIT_VAR(_5$$4); ZVAL_STRING(&_5$$4, "\\", 0); ZEPHIR_SINIT_VAR(_6$$4); ZVAL_STRING(&_6$$4, "/", 0); ZEPHIR_INIT_VAR(prepareUriClass); zephir_fast_str_replace(&prepareUriClass, &_5$$4, &_6$$4, className TSRMLS_CC); ZEPHIR_INIT_VAR(classNameWithLink); ZEPHIR_CONCAT_SVSVS(classNameWithLink, "<a target=\"_new\" href=\"//api.phalconphp.com/class/", prepareUriClass, ".html\">", className, "</a>"); } else { ZEPHIR_INIT_VAR(classReflection); object_init_ex(classReflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, classReflection, "__construct", NULL, 91, className); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7$$5, classReflection, "isinternal", NULL, 163); zephir_check_call_status(); if (zephir_is_true(_7$$5)) { ZEPHIR_INIT_VAR(_8$$6); zephir_fast_strtolower(_8$$6, className); ZEPHIR_SINIT_VAR(_9$$6); ZVAL_STRING(&_9$$6, "_", 0); ZEPHIR_SINIT_VAR(_10$$6); ZVAL_STRING(&_10$$6, "-", 0); ZEPHIR_INIT_VAR(prepareInternalClass); zephir_fast_str_replace(&prepareInternalClass, &_9$$6, &_10$$6, _8$$6 TSRMLS_CC); ZEPHIR_INIT_NVAR(classNameWithLink); ZEPHIR_CONCAT_SVSVS(classNameWithLink, "<a target=\"_new\" href=\"http://php.net/manual/en/class.", prepareInternalClass, ".php\">", className, "</a>"); } else { ZEPHIR_CPY_WRT(classNameWithLink, className); } } ZEPHIR_INIT_VAR(_11$$3); ZEPHIR_CONCAT_SVS(_11$$3, "<span class=\"error-class\">", classNameWithLink, "</span>"); zephir_concat_self(&html, _11$$3 TSRMLS_CC); zephir_array_fetch_string(&_12$$3, trace, SL("type"), PH_NOISY | PH_READONLY, "phalcon/debug.zep", 386 TSRMLS_CC); zephir_concat_self(&html, _12$$3 TSRMLS_CC); } ZEPHIR_OBS_VAR(functionName); zephir_array_fetch_string(&functionName, trace, SL("function"), PH_NOISY, "phalcon/debug.zep", 392 TSRMLS_CC); if (zephir_array_isset_string(trace, SS("class"))) { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } else { if ((zephir_function_exists(functionName TSRMLS_CC) == SUCCESS)) { ZEPHIR_INIT_VAR(functionReflection); object_init_ex(functionReflection, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, functionReflection, "__construct", NULL, 82, functionName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_13$$10, functionReflection, "isinternal", NULL, 164); zephir_check_call_status(); if (zephir_is_true(_13$$10)) { ZEPHIR_SINIT_VAR(_14$$11); ZVAL_STRING(&_14$$11, "_", 0); ZEPHIR_SINIT_VAR(_15$$11); ZVAL_STRING(&_15$$11, "-", 0); ZEPHIR_INIT_VAR(preparedFunctionName); zephir_fast_str_replace(&preparedFunctionName, &_14$$11, &_15$$11, functionName TSRMLS_CC); ZEPHIR_INIT_NVAR(functionNameWithLink); ZEPHIR_CONCAT_SVSVS(functionNameWithLink, "<a target=\"_new\" href=\"http://php.net/manual/en/function.", preparedFunctionName, ".php\">", functionName, "</a>"); } else { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } } else { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } } ZEPHIR_INIT_VAR(_16); ZEPHIR_CONCAT_SVS(_16, "<span class=\"error-function\">", functionNameWithLink, "</span>"); zephir_concat_self(&html, _16 TSRMLS_CC); ZEPHIR_OBS_VAR(traceArgs); if (zephir_array_isset_string_fetch(&traceArgs, trace, SS("args"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(arguments); array_init(arguments); zephir_is_iterable(traceArgs, &_18$$14, &_17$$14, 0, 0, "phalcon/debug.zep", 441); for ( ; zend_hash_get_current_data_ex(_18$$14, (void**) &_19$$14, &_17$$14) == SUCCESS ; zend_hash_move_forward_ex(_18$$14, &_17$$14) ) { ZEPHIR_GET_HVALUE(argument, _19$$14); ZEPHIR_CALL_METHOD(&_20$$15, this_ptr, "_getvardump", &_21, 0, argument); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_22$$15); ZEPHIR_CONCAT_SVS(_22$$15, "<span class=\"error-parameter\">", _20$$15, "</span>"); zephir_array_append(&arguments, _22$$15, PH_SEPARATE, "phalcon/debug.zep", 435); } ZEPHIR_INIT_VAR(_23$$14); zephir_fast_join_str(_23$$14, SL(", "), arguments TSRMLS_CC); ZEPHIR_INIT_VAR(_24$$14); ZEPHIR_CONCAT_SVS(_24$$14, "(", _23$$14, ")"); zephir_concat_self(&html, _24$$14 TSRMLS_CC); } ZEPHIR_OBS_VAR(filez); if (zephir_array_isset_string_fetch(&filez, trace, SS("file"), 0 TSRMLS_CC)) { ZEPHIR_OBS_VAR(_25$$16); zephir_array_fetch_string(&_25$$16, trace, SL("line"), PH_NOISY, "phalcon/debug.zep", 449 TSRMLS_CC); zephir_get_strval(_26$$16, _25$$16); ZEPHIR_CPY_WRT(line, _26$$16); ZEPHIR_INIT_VAR(_27$$16); ZEPHIR_CONCAT_SVSVS(_27$$16, "<br/><div class=\"error-file\">", filez, " (", line, ")</div>"); zephir_concat_self(&html, _27$$16 TSRMLS_CC); ZEPHIR_OBS_VAR(showFiles); zephir_read_property_this(&showFiles, this_ptr, SL("_showFiles"), PH_NOISY_CC); if (zephir_is_true(showFiles)) { ZEPHIR_CALL_FUNCTION(&lines, "file", NULL, 165, filez); zephir_check_call_status(); ZEPHIR_INIT_VAR(numberLines); ZVAL_LONG(numberLines, zephir_fast_count_int(lines TSRMLS_CC)); ZEPHIR_OBS_VAR(showFileFragment); zephir_read_property_this(&showFileFragment, this_ptr, SL("_showFileFragment"), PH_NOISY_CC); if (zephir_is_true(showFileFragment)) { ZEPHIR_INIT_VAR(beforeLine); ZVAL_LONG(beforeLine, (zephir_get_numberval(line) - 7)); if (ZEPHIR_LT_LONG(beforeLine, 1)) { firstLine = 1; } else { firstLine = zephir_get_numberval(beforeLine); } ZEPHIR_INIT_VAR(afterLine); ZVAL_LONG(afterLine, (zephir_get_numberval(line) + 5)); if (ZEPHIR_GT(afterLine, numberLines)) { ZEPHIR_CPY_WRT(lastLine, numberLines); } else { ZEPHIR_CPY_WRT(lastLine, afterLine); } ZEPHIR_SINIT_VAR(_28$$18); ZVAL_LONG(&_28$$18, firstLine); ZEPHIR_SINIT_VAR(_29$$18); ZVAL_LONG(&_29$$18, firstLine); ZEPHIR_INIT_VAR(_30$$18); ZEPHIR_CONCAT_SVSVSVS(_30$$18, "<pre class=\"prettyprint highlight:", &_28$$18, ":", line, " linenums:", &_29$$18, "\">"); zephir_concat_self(&html, _30$$18 TSRMLS_CC); } else { firstLine = 1; ZEPHIR_CPY_WRT(lastLine, numberLines); ZEPHIR_SINIT_VAR(_31$$23); ZVAL_LONG(&_31$$23, firstLine); ZEPHIR_INIT_VAR(_32$$23); ZEPHIR_CONCAT_SVSVS(_32$$23, "<pre class=\"prettyprint highlight:", &_31$$23, ":", line, " linenums error-scroll\">"); zephir_concat_self(&html, _32$$23 TSRMLS_CC); } i = firstLine; while (1) { if (!(ZEPHIR_GE_LONG(lastLine, i))) { break; } ZEPHIR_INIT_NVAR(linePosition); ZVAL_LONG(linePosition, (i - 1)); ZEPHIR_OBS_NVAR(currentLine); zephir_array_fetch(¤tLine, lines, linePosition, PH_NOISY, "phalcon/debug.zep", 522 TSRMLS_CC); if (zephir_is_true(showFileFragment)) { if (i == firstLine) { ZEPHIR_INIT_NVAR(_33$$26); ZEPHIR_INIT_NVAR(_34$$26); ZEPHIR_INIT_NVAR(_35$$26); zephir_fast_trim(_35$$26, currentLine, NULL , ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_SINIT_NVAR(_36$$26); ZVAL_STRING(&_36$$26, "#\\*\\/#", 0); zephir_preg_match(_34$$26, &_36$$26, _35$$26, _33$$26, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_34$$26)) { ZEPHIR_INIT_NVAR(_37$$27); ZEPHIR_SINIT_NVAR(_38$$27); ZVAL_STRING(&_38$$27, "* /", 0); ZEPHIR_SINIT_NVAR(_39$$27); ZVAL_STRING(&_39$$27, " ", 0); zephir_fast_str_replace(&_37$$27, &_38$$27, &_39$$27, currentLine TSRMLS_CC); ZEPHIR_CPY_WRT(currentLine, _37$$27); } } } _40$$24 = ZEPHIR_IS_STRING(currentLine, "\n"); if (!(_40$$24)) { _40$$24 = ZEPHIR_IS_STRING(currentLine, "\r\n"); } if (_40$$24) { zephir_concat_self_str(&html, SL(" \n") TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(_41$$29); ZEPHIR_SINIT_NVAR(_42$$29); ZVAL_STRING(&_42$$29, "\t", 0); ZEPHIR_SINIT_NVAR(_43$$29); ZVAL_STRING(&_43$$29, " ", 0); zephir_fast_str_replace(&_41$$29, &_42$$29, &_43$$29, currentLine TSRMLS_CC); ZEPHIR_SINIT_NVAR(_44$$29); ZVAL_LONG(&_44$$29, 2); ZEPHIR_SINIT_NVAR(_45$$29); ZVAL_STRING(&_45$$29, "UTF-8", 0); ZEPHIR_CALL_FUNCTION(&_46$$29, "htmlentities", &_47, 158, _41$$29, &_44$$29, &_45$$29); zephir_check_call_status(); zephir_concat_self(&html, _46$$29 TSRMLS_CC); } i++; } zephir_concat_self_str(&html, SL("</pre>") TSRMLS_CC); } } zephir_concat_self_str(&html, SL("</td></tr>") TSRMLS_CC); RETURN_CCTOR(html); }