/** * Sets the cache item key prefix. * * @param string prefix * * @return \Xpl\Cache\Cache */ PHP_METHOD(Xpl_Cache_Cache, setPrefix) { zval *prefix_param = NULL, *_0, _1, *_2; zval *prefix = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &prefix_param); if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) { zephir_get_strval(prefix, prefix_param); } else { ZEPHIR_INIT_VAR(prefix); ZVAL_EMPTY_STRING(prefix); } ZEPHIR_INIT_VAR(_0); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, ".", 0); zephir_fast_trim(_0, prefix, &_1, ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_INIT_VAR(_2); ZEPHIR_CONCAT_VS(_2, _0, "."); zephir_update_property_this(this_ptr, SL("prefix"), _2 TSRMLS_CC); RETURN_THIS(); }
/** * Returns a SQL modified with a LOCK IN SHARE MODE clause * *<code> * $sql = $dialect->sharedLock('SELECT * FROM robots'); * echo $sql; // SELECT * FROM robots LOCK IN SHARE MODE *</code> * * @param string sqlQuery * @return string */ PHP_METHOD(Pdm_Db_AbstractDialect, sharedLock) { zval *sqlQuery_param = NULL; zval *sqlQuery = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &sqlQuery_param); 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 (unlikely(Z_TYPE_P(sqlQuery_param) == IS_STRING)) { sqlQuery = sqlQuery_param; } else { ZEPHIR_INIT_VAR(sqlQuery); ZVAL_EMPTY_STRING(sqlQuery); } ZEPHIR_CONCAT_VS(return_value, sqlQuery, " LOCK IN SHARE MODE"); RETURN_MM(); }
/** * Get a route from collection * * @see ArrayAccess * @param mixed offset * @return mixed * @throws \InvalidArgumentException */ PHP_METHOD(Prr_RouteCollection, offsetGet) { int ZEPHIR_LAST_CALL_STATUS; zval *offset, *value, *_0, *_1, *_2; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &offset); ZEPHIR_OBS_VAR(value); _0 = zephir_fetch_nproperty_this(this_ptr, SL("storage"), PH_NOISY_CC); if (zephir_array_isset_fetch(&value, _0, offset, 0 TSRMLS_CC)) { RETURN_CCTOR(value); } ZEPHIR_INIT_VAR(_1); object_init_ex(_1, spl_ce_InvalidArgumentException); ZEPHIR_INIT_VAR(_2); ZEPHIR_CONCAT_VS(_2, offset, " does not exist."); ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, _2); zephir_check_call_status(); zephir_throw_exception_debug(_1, "prr/routecollection.zep", 144 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; }
/** * Writes data to the socket. Performs a connection if none is available */ PHP_METHOD(Phalcon_Queue_Beanstalk, write) { int ZEPHIR_LAST_CALL_STATUS; zval *data_param = NULL, *connection = NULL, *packet = NULL, _1; zval *data = NULL, *_0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &data_param); zephir_get_strval(data, data_param); ZEPHIR_OBS_VAR(connection); zephir_read_property_this(&connection, this_ptr, SL("_connection"), PH_NOISY_CC); if (Z_TYPE_P(connection) != IS_RESOURCE) { ZEPHIR_CALL_METHOD(&connection, this_ptr, "connect", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(connection) != IS_RESOURCE) { RETURN_MM_BOOL(0); } } ZEPHIR_INIT_VAR(_0); ZEPHIR_CONCAT_VS(_0, data, "\r\n"); ZEPHIR_CPY_WRT(packet, _0); ZEPHIR_SINIT_VAR(_1); ZVAL_LONG(&_1, zephir_fast_strlen_ev(packet)); ZEPHIR_RETURN_CALL_FUNCTION("fwrite", NULL, 388, connection, packet, &_1); zephir_check_call_status(); RETURN_MM(); }
/** * Gets the signing key * * @return string */ PHP_METHOD(OAuth_V1_Signature, getSigningKey) { zval *signingKey, *credentials = NULL, *consumerSecret, *tokenSecret, *_0, *_1; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(_0); zephir_call_method(_0, this_ptr, "getcredentials"); ZEPHIR_CPY_WRT(credentials, _0); ZEPHIR_INIT_VAR(consumerSecret); zephir_call_method(consumerSecret, credentials, "getconsumersecret"); ZEPHIR_INIT_VAR(tokenSecret); zephir_call_method(tokenSecret, this_ptr, "gettokensecret"); ZEPHIR_INIT_BNVAR(_0); zephir_call_func_p1(_0, "rawurlencode", consumerSecret); ZEPHIR_INIT_VAR(signingKey); ZEPHIR_CONCAT_VS(signingKey, _0, "&"); if (!(ZEPHIR_IS_EMPTY(tokenSecret))) { ZEPHIR_INIT_VAR(_1); zephir_call_func_p1(_1, "rawurlencode", tokenSecret); zephir_concat_self(&signingKey, _1 TSRMLS_CC); } RETURN_CCTOR(signingKey); }
/** * Destroys the active session * *<code> * var_dump($session->destroy()); * var_dump($session->destroy(true)); *</code> */ PHP_METHOD(Phalcon_Session_Adapter, destroy) { HashTable *_2$$4; HashPosition _1$$4; int ZEPHIR_LAST_CALL_STATUS; zval *removeData_param = NULL, *_SESSION = NULL, *uniqueId = NULL, *key = NULL, *_0$$4 = NULL, **_3$$4, *_4$$5 = NULL; zend_bool removeData; ZEPHIR_MM_GROW(); zephir_get_global(&_SESSION, SS("_SESSION") TSRMLS_CC); zephir_fetch_params(1, 0, 1, &removeData_param); if (!removeData_param) { removeData = 0; } else { removeData = zephir_get_boolval(removeData_param); } if (removeData) { ZEPHIR_OBS_VAR(uniqueId); zephir_read_property_this(&uniqueId, this_ptr, SL("_uniqueId"), PH_NOISY_CC); if (!(ZEPHIR_IS_EMPTY(uniqueId))) { ZEPHIR_INIT_VAR(_0$$4); zephir_is_iterable(_SESSION, &_2$$4, &_1$$4, 1, 0, "phalcon/session/adapter.zep", 262); for ( ; zephir_hash_get_current_data_ex(_2$$4, (void**) &_3$$4, &_1$$4) == SUCCESS ; zephir_hash_move_forward_ex(_2$$4, &_1$$4) ) { ZEPHIR_GET_HMKEY(key, _2$$4, _1$$4); ZEPHIR_GET_HVALUE(_0$$4, _3$$4); ZEPHIR_INIT_LNVAR(_4$$5); ZEPHIR_CONCAT_VS(_4$$5, uniqueId, "#"); if (zephir_start_with(key, _4$$5, NULL)) { zephir_array_unset(&_SESSION, key, PH_SEPARATE); } } zend_hash_destroy(_2$$4); FREE_HASHTABLE(_2$$4); } else { ZEPHIR_INIT_NVAR(_SESSION); array_init(_SESSION); } } if (0) { zephir_update_property_this(this_ptr, SL("_started"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_started"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } ZEPHIR_RETURN_CALL_FUNCTION("session_destroy", NULL, 32); zephir_check_call_status(); RETURN_MM(); }
/** * Sends the headers to the client */ PHP_METHOD(Phalcon_Http_Response_Headers, send) { zend_bool _7$$6; HashTable *_3$$3; HashPosition _2$$3; zval *header = NULL, *value = NULL, *_0 = NULL, *_1$$3, **_4$$3, *_5$$5 = NULL, _8$$6 = zval_used_for_init, _9$$6 = zval_used_for_init, *_10$$6 = NULL, *_11$$8 = NULL; zephir_fcall_cache_entry *_6 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_CALL_FUNCTION(&_0, "headers_sent", NULL, 28); zephir_check_call_status(); if (!(zephir_is_true(_0))) { _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_headers"), PH_NOISY_CC); zephir_is_iterable(_1$$3, &_3$$3, &_2$$3, 0, 0, "phalcon/http/response/headers.zep", 94); for ( ; zend_hash_get_current_data_ex(_3$$3, (void**) &_4$$3, &_2$$3) == SUCCESS ; zend_hash_move_forward_ex(_3$$3, &_2$$3) ) { ZEPHIR_GET_HMKEY(header, _3$$3, _2$$3); ZEPHIR_GET_HVALUE(value, _4$$3); if (Z_TYPE_P(value) != IS_NULL) { ZEPHIR_INIT_LNVAR(_5$$5); ZEPHIR_CONCAT_VSV(_5$$5, header, ": ", value); ZEPHIR_CALL_FUNCTION(NULL, "header", &_6, 257, _5$$5, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); } else { _7$$6 = zephir_memnstr_str(header, SL(":"), "phalcon/http/response/headers.zep", 87); if (!(_7$$6)) { ZEPHIR_SINIT_NVAR(_8$$6); ZVAL_LONG(&_8$$6, 0); ZEPHIR_SINIT_NVAR(_9$$6); ZVAL_LONG(&_9$$6, 5); ZEPHIR_INIT_NVAR(_10$$6); zephir_substr(_10$$6, header, 0 , 5 , 0); _7$$6 = ZEPHIR_IS_STRING(_10$$6, "HTTP/"); } if (_7$$6) { ZEPHIR_CALL_FUNCTION(NULL, "header", &_6, 257, header, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); } else { ZEPHIR_INIT_LNVAR(_11$$8); ZEPHIR_CONCAT_VS(_11$$8, header, ": "); ZEPHIR_CALL_FUNCTION(NULL, "header", &_6, 257, _11$$8, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); } } } RETURN_MM_BOOL(1); } RETURN_MM_BOOL(0); }
PHP_METHOD(PhalconPlus_Enum_Sys, getRootDir) { zval *_0; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(_0); zephir_read_static_property_ce(&_0, phalconplus_enum_sys_ce, SL("rootDir") TSRMLS_CC); ZEPHIR_CONCAT_VS(return_value, _0, "/"); RETURN_MM(); }
/** * Detects and returns the first available cache driver. * * @return \Xpl\Cache\DriverInterface */ PHP_METHOD(Xpl_Cache_Cache, getDetectedDriver) { zend_class_entry *_7$$4; HashTable *_2; HashPosition _1; zval *driverClasses = NULL, *classname = NULL, *_0 = NULL, **_3, *_4$$3 = NULL, *_5$$3 = NULL, *_6$$4 = NULL; zephir_fcall_cache_entry *_8 = NULL; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(driverClasses); zephir_create_array(driverClasses, 3, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "Xpl\\Cache\\Driver\\ApcuDriver", 1); zephir_array_fast_append(driverClasses, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "Xpl\\Cache\\Driver\\ApcDriver", 1); zephir_array_fast_append(driverClasses, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "Xpl\\Cache\\Driver\\XCacheDriver", 1); zephir_array_fast_append(driverClasses, _0); zephir_is_iterable(driverClasses, &_2, &_1, 0, 0, "xpl/cache/cache.zep", 215); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(classname, _3); ZEPHIR_INIT_NVAR(_4$$3); ZEPHIR_INIT_LNVAR(_5$$3); ZEPHIR_CONCAT_VS(_5$$3, classname, "::isAvailable"); ZEPHIR_CALL_USER_FUNC(_4$$3, _5$$3); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_4$$3)) { zephir_fetch_safe_class(_6$$4, classname); _7$$4 = zend_fetch_class(Z_STRVAL_P(_6$$4), Z_STRLEN_P(_6$$4), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(return_value, _7$$4); if (zephir_has_constructor(return_value TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_8, 0); zephir_check_call_status(); } RETURN_MM(); } } object_init_ex(return_value, xpl_cache_driver_memorydriver_ce); if (zephir_has_constructor(return_value TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0); zephir_check_call_status(); } RETURN_MM(); }
/** * Adds a role to the ACL list. Second parameter allows inheriting access data from other existing role * * Example: * <code> * $acl->addRole( * new Phalcon\Acl\Role("administrator"), * "consultant" * ); * * $acl->addRole("administrator", "consultant"); * </code> * * @param array|string accessInherits * @param RoleInterface|string role */ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addRole) { zend_bool _0; int ZEPHIR_LAST_CALL_STATUS; zval *role, *accessInherits = NULL, *roleName = NULL, *roleObject = NULL, *_1, *_2, *_3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &role, &accessInherits); if (!accessInherits) { accessInherits = ZEPHIR_GLOBAL(global_null); } _0 = Z_TYPE_P(role) == IS_OBJECT; if (_0) { _0 = zephir_instance_of_ev(role, phalcon_acl_roleinterface_ce TSRMLS_CC); } if (_0) { ZEPHIR_CALL_METHOD(&roleName, role, "getname", NULL, 0); zephir_check_call_status(); ZEPHIR_CPY_WRT(roleObject, role); } else if (Z_TYPE_P(role) == IS_STRING) { ZEPHIR_CPY_WRT(roleName, role); ZEPHIR_INIT_NVAR(roleObject); object_init_ex(roleObject, phalcon_acl_role_ce); ZEPHIR_CALL_METHOD(NULL, roleObject, "__construct", NULL, 82, role); zephir_check_call_status(); } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_acl_exception_ce, "Role must be either an string or implement RoleInterface", "phalcon/acl/adapter/memory.zep", 201); return; } _1 = zephir_fetch_nproperty_this(this_ptr, SL("_rolesNames"), PH_NOISY_CC); if (zephir_array_isset(_1, roleName)) { RETURN_MM_BOOL(0); } zephir_update_property_array_append(this_ptr, SL("_roles"), roleObject TSRMLS_CC); zephir_update_property_array(this_ptr, SL("_rolesNames"), roleName, ZEPHIR_GLOBAL(global_true) TSRMLS_CC); _2 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAccess"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3); ZEPHIR_CONCAT_VS(_3, roleName, "!*!*"); zephir_update_property_array(this_ptr, SL("_access"), _3, _2 TSRMLS_CC); if (Z_TYPE_P(accessInherits) != IS_NULL) { ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addinherit", NULL, 0, roleName, accessInherits); zephir_check_call_status(); RETURN_MM(); } RETURN_MM_BOOL(1); }
/** * Return the content type string for the resource * * @return string */ PHP_METHOD(Phal_Format_AbstractWriter, getContentType) { int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_2 = NULL; zval *_0, *_1; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(_0); zephir_get_called_class(_0 TSRMLS_CC); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_VS(_1, _0, "::CONTENT_TYPE"); ZEPHIR_RETURN_CALL_FUNCTION("constant", &_2, _1); zephir_check_call_status(); RETURN_MM(); }
/** * Adds a role to the ACL list. Second parameter allows inheriting access data from other existing role * * Example: * <code> * $acl->addRole(new Phalcon\Acl\Role('administrator'), 'consultant'); * $acl->addRole('administrator', 'consultant'); * </code> * * @param array|string accessInherits */ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addRole) { int ZEPHIR_LAST_CALL_STATUS; zval *role, *accessInherits = NULL, *roleName = NULL, *roleObject = NULL, *_0, *_1, *_2; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &role, &accessInherits); if (!accessInherits) { accessInherits = ZEPHIR_GLOBAL(global_null); } if (Z_TYPE_P(role) == IS_OBJECT) { ZEPHIR_CALL_METHOD(&roleName, role, "getname", NULL, 0); zephir_check_call_status(); ZEPHIR_CPY_WRT(roleObject, role); } else { ZEPHIR_CPY_WRT(roleName, role); ZEPHIR_INIT_NVAR(roleObject); object_init_ex(roleObject, phalcon_acl_role_ce); ZEPHIR_CALL_METHOD(NULL, roleObject, "__construct", NULL, 79, role); zephir_check_call_status(); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_rolesNames"), PH_NOISY_CC); if (zephir_array_isset(_0, roleName)) { RETURN_MM_BOOL(0); } zephir_update_property_array_append(this_ptr, SL("_roles"), roleObject TSRMLS_CC); zephir_update_property_array(this_ptr, SL("_rolesNames"), roleName, ZEPHIR_GLOBAL(global_true) TSRMLS_CC); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAccess"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_2); ZEPHIR_CONCAT_VS(_2, roleName, "!*!*"); zephir_update_property_array(this_ptr, SL("_access"), _2, _1 TSRMLS_CC); if (Z_TYPE_P(accessInherits) != IS_NULL) { ZEPHIR_RETURN_CALL_METHOD(this_ptr, "addinherit", NULL, 0, roleName, accessInherits); zephir_check_call_status(); RETURN_MM(); } RETURN_MM_BOOL(1); }
/** * Sets a Expires header to use HTTP cache * *<code> * $this->response->setExpires(new DateTime()); *</code> */ PHP_METHOD(Phalcon_Http_Response, setExpires) { int ZEPHIR_LAST_CALL_STATUS; zval *datetime, *date, *_0, *_1 = NULL, *_2 = NULL, *_3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &datetime); ZEPHIR_INIT_VAR(date); if (zephir_clone(date, datetime TSRMLS_CC) == FAILURE) { RETURN_MM(); } ZEPHIR_INIT_VAR(_0); object_init_ex(_0, php_date_get_timezone_ce()); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "UTC", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 0, _1); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, date, "settimezone", NULL, 0, _0); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "D, d M Y H:i:s", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_2, date, "format", NULL, 0, _1); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZEPHIR_CONCAT_VS(_3, _2, " GMT"); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "Expires", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, this_ptr, "setheader", NULL, 0, _1, _3); zephir_check_temp_parameter(_1); zephir_check_call_status(); RETURN_THIS(); }
/** * Creates an ItemPool for the given namespace. * * @param string namespaceName * * @return \Xpl\Cache\ItemPool */ PHP_METHOD(Xpl_Cache_Cache, createPool) { int ZEPHIR_LAST_CALL_STATUS; zval *name_param = NULL, *config = NULL, *driver = NULL, *driverClass = NULL, *prefix = NULL, *cachePrefix = NULL, *defaultTtl = NULL, *_0, *_5, *_1$$5, _2$$5, *_3$$5; zval *name = NULL, *_4$$7; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &name_param); 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); } ZEPHIR_CALL_METHOD(&config, this_ptr, "getconfig", NULL, 0, name); zephir_check_call_status(); ZEPHIR_OBS_VAR(driverClass); if (zephir_array_isset_string_fetch(&driverClass, config, SS("driver"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(driver); ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(driver, driverClass TSRMLS_CC); zephir_check_call_status(); } else { ZEPHIR_CALL_METHOD(&driver, this_ptr, "getdriver", NULL, 0); zephir_check_call_status(); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("prefix"), PH_NOISY_CC); ZEPHIR_CPY_WRT(prefix, _0); ZEPHIR_OBS_VAR(cachePrefix); if (zephir_array_isset_string_fetch(&cachePrefix, config, SS("prefix"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_1$$5); ZEPHIR_SINIT_VAR(_2$$5); ZVAL_STRING(&_2$$5, ".", 0); zephir_fast_trim(_1$$5, cachePrefix, &_2$$5, ZEPHIR_TRIM_BOTH TSRMLS_CC); ZEPHIR_INIT_VAR(_3$$5); ZEPHIR_CONCAT_VS(_3$$5, _1$$5, "."); zephir_concat_self(&prefix, _3$$5 TSRMLS_CC); } else { if (!ZEPHIR_IS_STRING_IDENTICAL(name, "default")) { ZEPHIR_INIT_VAR(_4$$7); ZEPHIR_CONCAT_VS(_4$$7, name, "."); zephir_concat_self(&prefix, _4$$7 TSRMLS_CC); } } ZEPHIR_OBS_VAR(defaultTtl); if (!(zephir_array_isset_string_fetch(&defaultTtl, config, SS("default_ttl"), 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(defaultTtl); ZVAL_LONG(defaultTtl, 0); } object_init_ex(return_value, xpl_cache_itempool_ce); ZEPHIR_INIT_VAR(_5); ZVAL_LONG(_5, zephir_get_intval(defaultTtl)); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 26, driver, prefix, _5); zephir_check_call_status(); RETURN_MM(); }
/** * Replaces placeholders from pattern returning a valid PCRE regular expression */ PHP_METHOD(Phalcon_Cli_Router_Route, compilePattern) { zval *pattern_param = NULL, *idPattern = NULL, *part = NULL, *_0$$3, *_4$$3, *_6$$3, *_8$$3, *_10$$3, *_12$$3, *_16$$3, *_1$$4, *_2$$4, _3$$4, *_5$$5, *_7$$6, *_9$$7, *_11$$8, *_13$$9, *_14$$9, *_15$$9, *_17$$10, *_18$$10, *_19$$10; zval *pattern = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &pattern_param); if (UNEXPECTED(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(pattern_param) == IS_STRING)) { zephir_get_strval(pattern, pattern_param); } else { ZEPHIR_INIT_VAR(pattern); ZVAL_EMPTY_STRING(pattern); } if (zephir_memnstr_str(pattern, SL(":"), "phalcon/cli/router/route.zep", 94)) { _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_VAR(idPattern); ZEPHIR_CONCAT_VS(idPattern, _0$$3, "([a-zA-Z0-9\\_\\-]+)"); if (zephir_memnstr_str(pattern, SL(":delimiter"), "phalcon/cli/router/route.zep", 100)) { ZEPHIR_INIT_VAR(_1$$4); _2$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_3$$4); ZVAL_STRING(&_3$$4, ":delimiter", 0); zephir_fast_str_replace(&_1$$4, &_3$$4, _2$$4, pattern TSRMLS_CC); zephir_get_strval(pattern, _1$$4); } _4$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_VAR(part); ZEPHIR_CONCAT_VS(part, _4$$3, ":module"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 106)) { ZEPHIR_INIT_VAR(_5$$5); zephir_fast_str_replace(&_5$$5, part, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _5$$5); } _6$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(part); ZEPHIR_CONCAT_VS(part, _6$$3, ":task"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 112)) { ZEPHIR_INIT_VAR(_7$$6); zephir_fast_str_replace(&_7$$6, part, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _7$$6); } _8$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(part); ZEPHIR_CONCAT_VS(part, _8$$3, ":namespace"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 118)) { ZEPHIR_INIT_VAR(_9$$7); zephir_fast_str_replace(&_9$$7, part, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _9$$7); } _10$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(part); ZEPHIR_CONCAT_VS(part, _10$$3, ":action"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 124)) { ZEPHIR_INIT_VAR(_11$$8); zephir_fast_str_replace(&_11$$8, part, idPattern, pattern TSRMLS_CC); zephir_get_strval(pattern, _11$$8); } _12$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(part); ZEPHIR_CONCAT_VS(part, _12$$3, ":params"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 130)) { ZEPHIR_INIT_VAR(_13$$9); _14$$9 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_15$$9); ZEPHIR_CONCAT_SVS(_15$$9, "(", _14$$9, ".*)*"); zephir_fast_str_replace(&_13$$9, part, _15$$9, pattern TSRMLS_CC); zephir_get_strval(pattern, _13$$9); } _16$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(part); ZEPHIR_CONCAT_VS(part, _16$$3, ":int"); if (zephir_memnstr(pattern, part, "phalcon/cli/router/route.zep", 136)) { ZEPHIR_INIT_VAR(_17$$10); _18$$10 = zephir_fetch_nproperty_this(this_ptr, SL("_delimiter"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_19$$10); ZEPHIR_CONCAT_VS(_19$$10, _18$$10, "([0-9]+)"); zephir_fast_str_replace(&_17$$10, part, _19$$10, pattern TSRMLS_CC); zephir_get_strval(pattern, _17$$10); } } if (zephir_memnstr_str(pattern, SL("("), "phalcon/cli/router/route.zep", 142)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } if (zephir_memnstr_str(pattern, SL("["), "phalcon/cli/router/route.zep", 147)) { ZEPHIR_CONCAT_SVS(return_value, "#^", pattern, "$#"); RETURN_MM(); } RETURN_CTOR(pattern); }
/** * 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); }
/** * 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); }
/** * Get an object from the container * * @param string offset * @throws \Pdm\Di\Exception\ServiceNotFound * @return mixed */ PHP_METHOD(Pdm_Di_Container, get) { zend_class_entry *_3, *_4; int ZEPHIR_LAST_CALL_STATUS; zval *offset_param = NULL, *service, *className, *instance, *_0, *_1; zval *offset = NULL, *_2; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &offset_param); if (unlikely(Z_TYPE_P(offset_param) != IS_STRING && Z_TYPE_P(offset_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'offset' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (unlikely(Z_TYPE_P(offset_param) == IS_STRING)) { offset = offset_param; } else { ZEPHIR_INIT_VAR(offset); ZVAL_EMPTY_STRING(offset); } ZEPHIR_OBS_VAR(service); _0 = zephir_fetch_nproperty_this(this_ptr, SL("container"), PH_NOISY_CC); if (!(zephir_array_isset_fetch(&service, _0, offset, 0 TSRMLS_CC))) { ZEPHIR_INIT_VAR(_1); object_init_ex(_1, pdm_di_exception_servicenotfound_ce); ZEPHIR_INIT_VAR(_2); ZEPHIR_CONCAT_VS(_2, offset, " is not defined."); ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, _2); zephir_check_call_status(); zephir_throw_exception_debug(_1, "pdm/di/container.zep", 142 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(service) == IS_STRING) { _3 = zend_fetch_class(Z_STRVAL_P(service), Z_STRLEN_P(service), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(return_value, _3); if (zephir_has_constructor(return_value TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL); zephir_check_call_status(); } RETURN_MM(); } if (Z_TYPE_P(service) == IS_ARRAY) { ZEPHIR_OBS_VAR(className); if (zephir_array_isset_string_fetch(&className, service, SS("className"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(instance); _4 = zend_fetch_class(Z_STRVAL_P(className), Z_STRLEN_P(className), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(instance, _4); if (zephir_has_constructor(instance TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, instance, "__construct", NULL, service); zephir_check_call_status(); } if (Z_TYPE_P(instance) == IS_OBJECT) { if (zephir_instance_of_ev(instance, pdm_di_injectionawareinterface_ce TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, instance, "setdi", NULL, this_ptr); zephir_check_call_status(); } } RETURN_CCTOR(instance); } } if (Z_TYPE_P(service) == IS_OBJECT) { if (zephir_instance_of_ev(service, zend_ce_closure TSRMLS_CC)) { ZEPHIR_RETURN_CALL_ZVAL_FUNCTION(service, NULL); zephir_check_call_status(); RETURN_MM(); } } RETURN_CCTOR(service); }
PHP_METHOD(Test_RegexDNA, process) { HashTable *_27; HashPosition _26; zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard, *_0, *_1, *_2, *_3, *_4, *_5, *_6, *_7, *_8, *_9, *_10, *_11, *_12, *_13, *_14, *_15, *_16, *_17, *_18, *_19, *_20, *_21, *_22, *_23, _24, *_25 = NULL, **_28, *_29 = NULL, *_30 = NULL, *_31; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(variants); array_init(variants); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "agggtaaa|tttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "[cgt]gggtaaa|tttaccc[acg]", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "a[act]ggtaaa|tttacc[agt]t", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "ag[act]gtaaa|tttac[agt]ct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agg[act]taaa|ttta[agt]cct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "aggg[acg]aaa|ttt[cgt]ccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggt[cgt]aa|tt[acg]accct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggta[cgt]a|t[acg]taccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggtaa[cgt]|[acg]ttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_VAR(vIUB); array_init(vIUB); ZEPHIR_INIT_VAR(vIUBnew); array_init(vIUBnew); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/B/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "(c|g|t)", 1); zephir_array_append(&vIUBnew, _1, PH_SEPARATE); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "/D/S", 1); zephir_array_append(&vIUB, _2, PH_SEPARATE); ZEPHIR_INIT_VAR(_3); ZVAL_STRING(_3, "(a|g|t)", 1); zephir_array_append(&vIUBnew, _3, PH_SEPARATE); ZEPHIR_INIT_VAR(_4); ZVAL_STRING(_4, "/H/S", 1); zephir_array_append(&vIUB, _4, PH_SEPARATE); ZEPHIR_INIT_VAR(_5); ZVAL_STRING(_5, "(a|c|t)", 1); zephir_array_append(&vIUBnew, _5, PH_SEPARATE); ZEPHIR_INIT_VAR(_6); ZVAL_STRING(_6, "/K/S", 1); zephir_array_append(&vIUB, _6, PH_SEPARATE); ZEPHIR_INIT_VAR(_7); ZVAL_STRING(_7, "(g|t)", 1); zephir_array_append(&vIUBnew, _7, PH_SEPARATE); ZEPHIR_INIT_VAR(_8); ZVAL_STRING(_8, "/M/S", 1); zephir_array_append(&vIUB, _8, PH_SEPARATE); ZEPHIR_INIT_VAR(_9); ZVAL_STRING(_9, "(a|c)", 1); zephir_array_append(&vIUBnew, _9, PH_SEPARATE); ZEPHIR_INIT_VAR(_10); ZVAL_STRING(_10, "/N/S", 1); zephir_array_append(&vIUB, _10, PH_SEPARATE); ZEPHIR_INIT_VAR(_11); ZVAL_STRING(_11, "(a|c|g|t)", 1); zephir_array_append(&vIUBnew, _11, PH_SEPARATE); ZEPHIR_INIT_VAR(_12); ZVAL_STRING(_12, "/R/S", 1); zephir_array_append(&vIUB, _12, PH_SEPARATE); ZEPHIR_INIT_VAR(_13); ZVAL_STRING(_13, "(a|g)", 1); zephir_array_append(&vIUBnew, _13, PH_SEPARATE); ZEPHIR_INIT_VAR(_14); ZVAL_STRING(_14, "/S/S", 1); zephir_array_append(&vIUB, _14, PH_SEPARATE); ZEPHIR_INIT_VAR(_15); ZVAL_STRING(_15, "(c|g)", 1); zephir_array_append(&vIUBnew, _15, PH_SEPARATE); ZEPHIR_INIT_VAR(_16); ZVAL_STRING(_16, "/V/S", 1); zephir_array_append(&vIUB, _16, PH_SEPARATE); ZEPHIR_INIT_VAR(_17); ZVAL_STRING(_17, "(a|c|g)", 1); zephir_array_append(&vIUBnew, _17, PH_SEPARATE); ZEPHIR_INIT_VAR(_18); ZVAL_STRING(_18, "/W/S", 1); zephir_array_append(&vIUB, _18, PH_SEPARATE); ZEPHIR_INIT_VAR(_19); ZVAL_STRING(_19, "(a|t)", 1); zephir_array_append(&vIUBnew, _19, PH_SEPARATE); ZEPHIR_INIT_VAR(_20); ZVAL_STRING(_20, "/Y/S", 1); zephir_array_append(&vIUB, _20, PH_SEPARATE); ZEPHIR_INIT_VAR(_21); ZVAL_STRING(_21, "(c|t)", 1); zephir_array_append(&vIUBnew, _21, PH_SEPARATE); ZEPHIR_INIT_VAR(stuffToRemove); ZVAL_STRING(stuffToRemove, "^>.*$|\n", 1); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(contents); zephir_call_func_p1(contents, "file_get_contents", path); ZEPHIR_INIT_VAR(initialLength); ZVAL_LONG(initialLength, zephir_fast_strlen_ev(contents)); ZEPHIR_INIT_VAR(_22); ZEPHIR_CONCAT_SV(_22, "/", stuffToRemove); ZEPHIR_INIT_VAR(_23); ZEPHIR_CONCAT_VS(_23, _22, "/mS"); ZEPHIR_SINIT_VAR(_24); ZVAL_STRING(&_24, "", 0); ZEPHIR_INIT_VAR(_25); zephir_call_func_p3(_25, "preg_replace", _23, &_24, contents); ZEPHIR_CPY_WRT(contents, _25); ZEPHIR_INIT_VAR(codeLength); ZVAL_LONG(codeLength, zephir_fast_strlen_ev(contents)); zephir_is_iterable(variants, &_27, &_26, 0, 0); for ( ; zend_hash_get_current_data_ex(_27, (void**) &_28, &_26) == SUCCESS ; zend_hash_move_forward_ex(_27, &_26) ) { ZEPHIR_GET_HVALUE(regex, _28); zend_print_zval(regex, 0); php_printf(" "); ZEPHIR_INIT_LNVAR(_29); ZEPHIR_CONCAT_SV(_29, "/", regex); ZEPHIR_INIT_LNVAR(_30); ZEPHIR_CONCAT_VS(_30, _29, "/iS"); Z_SET_ISREF_P(discard); ZEPHIR_INIT_NVAR(_25); zephir_call_func_p3(_25, "preg_match_all", _30, contents, discard); zend_print_zval(_25, 0); php_printf("%c", '\n'); } ZEPHIR_INIT_VAR(_31); zephir_call_func_p3(_31, "preg_replace", vIUB, vIUBnew, contents); ZEPHIR_CPY_WRT(contents, _31); php_printf("%c", '\n'); zend_print_zval(initialLength, 0); php_printf("%c", '\n'); zend_print_zval(codeLength, 0); php_printf("%c", '\n'); php_printf("%d", zephir_fast_strlen_ev(contents)); php_printf("%c", '\n'); ZEPHIR_MM_RESTORE(); }
/** * 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); }
/** * Check whether a role is allowed to access an action from a resource * * <code> * //Does andres have access to the customers resource to create? * $acl->isAllowed('andres', 'Products', 'create'); * * //Do guests have access to any resource to edit? * $acl->isAllowed('guests', '*', 'edit'); * </code> */ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) { HashTable *_5, *_8, *_11; HashPosition _4, _7, _10; int ZEPHIR_LAST_CALL_STATUS; zval *roleName_param = NULL, *resourceName_param = NULL, *access_param = NULL, *eventsManager = NULL, *accessList, *accessKey = NULL, *haveAccess = NULL, *roleInherits, *inheritedRole = NULL, *rolesNames, *inheritedRoles, *_0, *_1 = NULL, *_2 = NULL, **_6, **_9, **_12; zval *roleName = NULL, *resourceName = NULL, *access = NULL, *_3 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &roleName_param, &resourceName_param, &access_param); zephir_get_strval(roleName, roleName_param); zephir_get_strval(resourceName, resourceName_param); zephir_get_strval(access, access_param); ZEPHIR_INIT_VAR(haveAccess); ZVAL_NULL(haveAccess); zephir_update_property_this(this_ptr, SL("_activeRole"), roleName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_activeResource"), resourceName TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_activeAccess"), access TSRMLS_CC); ZEPHIR_OBS_VAR(accessList); zephir_read_property_this(&accessList, this_ptr, SL("_access"), PH_NOISY_CC); _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(_2); ZVAL_STRING(_2, "acl:beforeCheckAccess", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_1, eventsManager, "fire", NULL, 0, _2, this_ptr); zephir_check_temp_parameter(_2); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_1)) { RETURN_MM_BOOL(0); } } ZEPHIR_OBS_VAR(rolesNames); zephir_read_property_this(&rolesNames, this_ptr, SL("_rolesNames"), PH_NOISY_CC); if (!(zephir_array_isset(rolesNames, roleName))) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAccess"), PH_NOISY_CC); RETURN_MM_BOOL((ZEPHIR_IS_LONG(_0, 1))); } ZEPHIR_INIT_VAR(_3); ZEPHIR_CONCAT_VSVSV(_3, roleName, "!", resourceName, "!", access); ZEPHIR_CPY_WRT(accessKey, _3); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 530 TSRMLS_CC); } if (Z_TYPE_P(haveAccess) == IS_NULL) { ZEPHIR_OBS_VAR(roleInherits); zephir_read_property_this(&roleInherits, this_ptr, SL("_roleInherits"), PH_NOISY_CC); ZEPHIR_OBS_VAR(inheritedRoles); if (zephir_array_isset_fetch(&inheritedRoles, roleInherits, roleName, 0 TSRMLS_CC)) { if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) { zephir_is_iterable(inheritedRoles, &_5, &_4, 0, 0, "phalcon/acl/adapter/memory.zep", 551); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(inheritedRole, _6); ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VSVSV(accessKey, inheritedRole, "!", resourceName, "!", access); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 548 TSRMLS_CC); } } } } } if (Z_TYPE_P(haveAccess) == IS_NULL) { ZEPHIR_INIT_LNVAR(_3); ZEPHIR_CONCAT_VSVS(_3, roleName, "!", resourceName, "!*"); ZEPHIR_CPY_WRT(accessKey, _3); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 566 TSRMLS_CC); } else { if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) { zephir_is_iterable(inheritedRoles, &_8, &_7, 0, 0, "phalcon/acl/adapter/memory.zep", 580); for ( ; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS ; zephir_hash_move_forward_ex(_8, &_7) ) { ZEPHIR_GET_HVALUE(inheritedRole, _9); ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VSVS(accessKey, inheritedRole, "!", resourceName, "!*"); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 576 TSRMLS_CC); break; } } } } } if (Z_TYPE_P(haveAccess) == IS_NULL) { ZEPHIR_INIT_LNVAR(_3); ZEPHIR_CONCAT_VS(_3, roleName, "!*!*"); ZEPHIR_CPY_WRT(accessKey, _3); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 595 TSRMLS_CC); } else { if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) { zephir_is_iterable(inheritedRoles, &_11, &_10, 0, 0, "phalcon/acl/adapter/memory.zep", 609); for ( ; zephir_hash_get_current_data_ex(_11, (void**) &_12, &_10) == SUCCESS ; zephir_hash_move_forward_ex(_11, &_10) ) { ZEPHIR_GET_HVALUE(inheritedRole, _12); ZEPHIR_INIT_NVAR(accessKey); ZEPHIR_CONCAT_VS(accessKey, inheritedRole, "!*!*"); if (zephir_array_isset(accessList, accessKey)) { ZEPHIR_OBS_NVAR(haveAccess); zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 605 TSRMLS_CC); break; } } } } } zephir_update_property_this(this_ptr, SL("_accessGranted"), haveAccess TSRMLS_CC); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_2); ZVAL_STRING(_2, "acl:afterCheckAccess", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _2, this_ptr); zephir_check_temp_parameter(_2); zephir_check_call_status(); } if (Z_TYPE_P(haveAccess) == IS_NULL) { RETURN_MM_BOOL(0); } RETURN_MM_BOOL((ZEPHIR_IS_LONG(haveAccess, 1))); }
/** * Dispatches a handle action taking into account the routing parameters * * @return object */ PHP_METHOD(Phalcon_Dispatcher, dispatch) { zval *_18 = NULL; zephir_fcall_cache_entry *_4 = NULL, *_5 = NULL, *_8 = NULL, *_10 = NULL, *_11 = NULL, *_12 = NULL, *_13 = NULL, *_14 = NULL, *_16 = NULL, *_19 = NULL; zval *value, *handler = NULL, *dependencyInjector = NULL, *namespaceName = NULL, *handlerName = NULL, *actionName = NULL, *camelizedClass = NULL, *params = NULL, *eventsManager = NULL, *handlerSuffix, *actionSuffix, *handlerClass = NULL, *status = NULL, *actionMethod = NULL, *e = NULL, *_0, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_6, *_7 = NULL, *_9 = NULL, *_15 = NULL, *_17; int numberDispatches, ZEPHIR_LAST_CALL_STATUS; zend_bool hasService, wasFresh = 0; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "A dependency injection container is required to access related dispatching services", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_2); ZVAL_LONG(_2, 0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "_throwdispatchexception", NULL, _1, _2); zephir_check_temp_parameter(_1); zephir_check_call_status(); RETURN_MM_BOOL(0); } _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_NVAR(_1); ZVAL_STRING(_1, "dispatch:beforeDispatchLoop", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_3, eventsManager, "fire", NULL, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_3)) { RETURN_MM_BOOL(0); } } ZEPHIR_INIT_VAR(value); ZVAL_NULL(value); ZEPHIR_INIT_VAR(handler); ZVAL_NULL(handler); numberDispatches = 0; ZEPHIR_OBS_VAR(handlerSuffix); zephir_read_property_this(&handlerSuffix, this_ptr, SL("_handlerSuffix"), PH_NOISY_CC); ZEPHIR_OBS_VAR(actionSuffix); zephir_read_property_this(&actionSuffix, this_ptr, SL("_actionSuffix"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_finished"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); while (1) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (!(!(zephir_is_true(_0)))) { break; } numberDispatches++; if (numberDispatches == 256) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "Dispatcher has detected a cyclic routing causing stability problems", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_2); ZVAL_LONG(_2, 1); ZEPHIR_CALL_METHOD(NULL, this_ptr, "_throwdispatchexception", &_4, _1, _2); zephir_check_temp_parameter(_1); zephir_check_call_status(); break; } zephir_update_property_this(this_ptr, SL("_finished"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); ZEPHIR_OBS_NVAR(namespaceName); zephir_read_property_this(&namespaceName, this_ptr, SL("_namespaceName"), PH_NOISY_CC); if (!(zephir_is_true(namespaceName))) { ZEPHIR_OBS_NVAR(namespaceName); zephir_read_property_this(&namespaceName, this_ptr, SL("_defaultNamespace"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_namespaceName"), namespaceName TSRMLS_CC); } ZEPHIR_OBS_NVAR(handlerName); zephir_read_property_this(&handlerName, this_ptr, SL("_handlerName"), PH_NOISY_CC); if (!(zephir_is_true(handlerName))) { ZEPHIR_OBS_NVAR(handlerName); zephir_read_property_this(&handlerName, this_ptr, SL("_defaultHandler"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_handlerName"), handlerName TSRMLS_CC); } ZEPHIR_OBS_NVAR(actionName); zephir_read_property_this(&actionName, this_ptr, SL("_actionName"), PH_NOISY_CC); if (!(zephir_is_true(actionName))) { ZEPHIR_OBS_NVAR(actionName); zephir_read_property_this(&actionName, this_ptr, SL("_defaultAction"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_actionName"), actionName TSRMLS_CC); } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:beforeDispatch", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_3, eventsManager, "fire", &_5, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_3)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } if (!(zephir_memnstr_str(handlerName, SL("\\"), "phalcon/dispatcher.zep", 390))) { ZEPHIR_INIT_NVAR(camelizedClass); zephir_camelize(camelizedClass, handlerName); } else { ZEPHIR_CPY_WRT(camelizedClass, handlerName); } if (zephir_is_true(namespaceName)) { ZEPHIR_INIT_NVAR(handlerClass); if (zephir_end_with_str(namespaceName, SL("\\"))) { ZEPHIR_CONCAT_VVV(handlerClass, namespaceName, camelizedClass, handlerSuffix); } else { ZEPHIR_CONCAT_VSVV(handlerClass, namespaceName, "\\", camelizedClass, handlerSuffix); } } else { ZEPHIR_INIT_NVAR(handlerClass); ZEPHIR_CONCAT_VV(handlerClass, camelizedClass, handlerSuffix); } ZEPHIR_CALL_METHOD(&_7, dependencyInjector, "has", &_8, handlerClass); zephir_check_call_status(); hasService = zephir_get_boolval(_7); if (!(hasService)) { hasService = zephir_class_exists(handlerClass, 1 TSRMLS_CC); } if (!(hasService)) { ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_VS(_9, handlerClass, " handler class cannot be loaded"); ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, 2); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_10, _9, _1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } break; } ZEPHIR_CALL_METHOD(&handler, dependencyInjector, "getshared", &_11, handlerClass); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7, dependencyInjector, "wasfreshinstance", &_12); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_7)) { wasFresh = 1; } if (Z_TYPE_P(handler) != IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "Invalid handler returned from the services container", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_2); ZVAL_LONG(_2, 3); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_13, _1, _2); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } break; } zephir_update_property_this(this_ptr, SL("_activeHandler"), handler TSRMLS_CC); ZEPHIR_OBS_NVAR(params); zephir_read_property_this(¶ms, this_ptr, SL("_params"), PH_NOISY_CC); if (Z_TYPE_P(params) != IS_ARRAY) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "Action parameters must be an Array", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_2); ZVAL_LONG(_2, 4); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_14, _1, _2); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } break; } ZEPHIR_INIT_NVAR(actionMethod); ZEPHIR_CONCAT_VV(actionMethod, actionName, actionSuffix); if (!((zephir_method_exists(handler, actionMethod TSRMLS_CC) == SUCCESS))) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:beforeNotFoundAction", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_15, eventsManager, "fire", &_5, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVSVS(_9, "Action '", actionName, "' was not found on handler '", handlerName, "'"); ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, 5); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_16, _9, _1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _17 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_17)) { continue; } } break; } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:beforeExecuteRoute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_15, eventsManager, "fire", &_5, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } if ((zephir_method_exists_ex(handler, SS("beforeexecuteroute") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&_15, handler, "beforeexecuteroute", NULL, this_ptr); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } if (wasFresh == 1) { if ((zephir_method_exists_ex(handler, SS("initialize") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(NULL, handler, "initialize", NULL); zephir_check_call_status(); } if (zephir_is_true(eventsManager)) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:afterInitialize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_15, eventsManager, "fire", &_5, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } } /* try_start_1: */ ZEPHIR_INIT_NVAR(_1); ZEPHIR_INIT_NVAR(_18); zephir_create_array(_18, 2, 0 TSRMLS_CC); zephir_array_fast_append(_18, handler); zephir_array_fast_append(_18, actionMethod); ZEPHIR_CALL_USER_FUNC_ARRAY(_1, _18, params); zephir_check_call_status_or_jump(try_end_1); zephir_update_property_this(this_ptr, SL("_returnedValue"), _1 TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_lastHandler"), handler TSRMLS_CC); 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_CALL_METHOD(&_15, this_ptr, "_handleexception", &_19, e); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } else { zephir_throw_exception_debug(e, "phalcon/dispatcher.zep", 550 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_2); ZVAL_STRING(_2, "dispatch:afterExecuteRoute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_15, eventsManager, "fire", &_5, _2, this_ptr, value); zephir_check_temp_parameter(_2); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } ZEPHIR_INIT_NVAR(_2); ZVAL_STRING(_2, "dispatch:afterDispatch", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_5, _2, this_ptr); zephir_check_temp_parameter(_2); zephir_check_call_status(); } if ((zephir_method_exists_ex(handler, SS("afterexecuteroute") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&_15, handler, "afterexecuteroute", NULL, this_ptr, value); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:afterDispatchLoop", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_5, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); } RETURN_CCTOR(handler); }
/** * Generates SQL to add an index to a table */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addIndex) { int ZEPHIR_LAST_CALL_STATUS; zval *tableName_param = NULL, *schemaName_param = NULL, *index, *sql, *indexType = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL; zval *tableName = NULL, *schemaName = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index); 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(&indexType, index, "gettype", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_VAR(sql); if (!(ZEPHIR_IS_EMPTY(indexType))) { ZEPHIR_CONCAT_SVS(sql, "CREATE ", indexType, " INDEX \""); } else { ZVAL_STRING(sql, "CREATE INDEX \"", 1); } if (schemaName && Z_STRLEN_P(schemaName)) { ZEPHIR_CALL_METHOD(&_0, index, "getname", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_VSVSVS(_1, schemaName, "\".\"", _0, "\" ON \"", tableName, "\" ("); zephir_concat_self(&sql, _1 TSRMLS_CC); } else { ZEPHIR_CALL_METHOD(&_0, index, "getname", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_1); ZEPHIR_CONCAT_VSVS(_1, _0, "\" ON \"", tableName, "\" ("); zephir_concat_self(&sql, _1 TSRMLS_CC); } ZEPHIR_CALL_METHOD(&_2, index, "getcolumns", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, this_ptr, "getcolumnlist", NULL, 100, _2); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_1); ZEPHIR_CONCAT_VS(_1, _0, ")"); zephir_concat_self(&sql, _1 TSRMLS_CC); RETURN_CCTOR(sql); }
/** * Autoloads the registered classes */ PHP_METHOD(Phalcon_Loader, autoLoad) { zephir_fcall_cache_entry *_10 = NULL, *_12 = NULL, *_13 = NULL, *_23 = NULL, *_24 = NULL, *_31 = NULL, *_32 = NULL; HashTable *_2, *_7, *_15, *_21, *_26, *_29; HashPosition _1, _6, _14, _20, _25, _28; int ZEPHIR_LAST_CALL_STATUS; zval *className_param = NULL, *eventsManager, *classes, *extensions, *filePath = NULL, *ds, *fixedDirectory = NULL, *prefixes, *directories, *namespaceSeparator, *namespaces, *nsPrefix = NULL, *directory = NULL, *fileName = NULL, *extension = NULL, *prefix = NULL, *dsClassName, *nsClassName, *_0 = NULL, **_3, *_4 = NULL, _5 = zval_used_for_init, **_8, *_9 = NULL, *_11 = NULL, **_16, *_17 = NULL, _18 = zval_used_for_init, _19 = zval_used_for_init, **_22, **_27, **_30; zval *className = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &className_param); if (unlikely(Z_TYPE_P(className_param) != IS_STRING && Z_TYPE_P(className_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'className' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(className_param) == IS_STRING)) { zephir_get_strval(className, className_param); } else { ZEPHIR_INIT_VAR(className); ZVAL_EMPTY_STRING(className); } ZEPHIR_OBS_VAR(eventsManager); zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "loader:beforeCheckClass", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _0, this_ptr, className); zephir_check_temp_parameter(_0); zephir_check_call_status(); } ZEPHIR_OBS_VAR(classes); zephir_read_property_this(&classes, this_ptr, SL("_classes"), PH_NOISY_CC); if (Z_TYPE_P(classes) == IS_ARRAY) { ZEPHIR_OBS_VAR(filePath); if (zephir_array_isset_fetch(&filePath, classes, className, 0 TSRMLS_CC)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _0, this_ptr, filePath); zephir_check_temp_parameter(_0); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } ZEPHIR_OBS_VAR(extensions); zephir_read_property_this(&extensions, this_ptr, SL("_extensions"), PH_NOISY_CC); ZEPHIR_INIT_VAR(ds); ZVAL_STRING(ds, "/", 1); ZEPHIR_INIT_VAR(namespaceSeparator); ZVAL_STRING(namespaceSeparator, "\\", 1); ZEPHIR_OBS_VAR(namespaces); zephir_read_property_this(&namespaces, this_ptr, SL("_namespaces"), PH_NOISY_CC); if (Z_TYPE_P(namespaces) == IS_ARRAY) { zephir_is_iterable(namespaces, &_2, &_1, 0, 0, "phalcon/loader.zep", 347); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(nsPrefix, _2, _1); ZEPHIR_GET_HVALUE(directory, _3); if (zephir_start_with(className, nsPrefix, NULL)) { ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_VV(_4, nsPrefix, namespaceSeparator); ZEPHIR_SINIT_NVAR(_5); ZVAL_LONG(&_5, zephir_fast_strlen_ev(_4)); ZEPHIR_INIT_NVAR(fileName); zephir_substr(fileName, className, zephir_get_intval(&_5), 0, ZEPHIR_SUBSTR_NO_LENGTH); ZEPHIR_INIT_NVAR(_0); zephir_fast_str_replace(&_0, namespaceSeparator, ds, fileName TSRMLS_CC); ZEPHIR_CPY_WRT(fileName, _0); if (zephir_is_true(fileName)) { ZEPHIR_INIT_NVAR(_0); zephir_fast_trim(_0, directory, ds, ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_INIT_NVAR(fixedDirectory); ZEPHIR_CONCAT_VV(fixedDirectory, _0, ds); zephir_is_iterable(extensions, &_7, &_6, 0, 0, "phalcon/loader.zep", 344); for ( ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS ; zephir_hash_move_forward_ex(_7, &_6) ) { ZEPHIR_GET_HVALUE(extension, _8); ZEPHIR_INIT_NVAR(filePath); ZEPHIR_CONCAT_VVSV(filePath, fixedDirectory, fileName, ".", extension); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_checkedPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:beforeCheckPath", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_10, 0, _9, this_ptr); zephir_check_temp_parameter(_9); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_11, "is_file", &_12, 279, filePath); zephir_check_call_status(); if (zephir_is_true(_11)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_13, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } } } } } ZEPHIR_OBS_VAR(prefixes); zephir_read_property_this(&prefixes, this_ptr, SL("_prefixes"), PH_NOISY_CC); if (Z_TYPE_P(prefixes) == IS_ARRAY) { zephir_is_iterable(prefixes, &_15, &_14, 0, 0, "phalcon/loader.zep", 402); for ( ; zephir_hash_get_current_data_ex(_15, (void**) &_16, &_14) == SUCCESS ; zephir_hash_move_forward_ex(_15, &_14) ) { ZEPHIR_GET_HMKEY(prefix, _15, _14); ZEPHIR_GET_HVALUE(directory, _16); if (zephir_start_with(className, prefix, NULL)) { ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_VV(_4, prefix, namespaceSeparator); ZEPHIR_SINIT_NVAR(_5); ZVAL_STRING(&_5, "", 0); ZEPHIR_INIT_NVAR(fileName); zephir_fast_str_replace(&fileName, _4, &_5, className TSRMLS_CC); ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_LNVAR(_17); ZEPHIR_CONCAT_VS(_17, prefix, "_"); ZEPHIR_SINIT_NVAR(_18); ZVAL_STRING(&_18, "", 0); zephir_fast_str_replace(&_0, _17, &_18, fileName TSRMLS_CC); ZEPHIR_CPY_WRT(fileName, _0); ZEPHIR_INIT_NVAR(_0); ZEPHIR_SINIT_NVAR(_19); ZVAL_STRING(&_19, "_", 0); zephir_fast_str_replace(&_0, &_19, ds, fileName TSRMLS_CC); ZEPHIR_CPY_WRT(fileName, _0); if (zephir_is_true(fileName)) { ZEPHIR_INIT_NVAR(_0); zephir_fast_trim(_0, directory, ds, ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_INIT_NVAR(fixedDirectory); ZEPHIR_CONCAT_VV(fixedDirectory, _0, ds); zephir_is_iterable(extensions, &_21, &_20, 0, 0, "phalcon/loader.zep", 399); for ( ; zephir_hash_get_current_data_ex(_21, (void**) &_22, &_20) == SUCCESS ; zephir_hash_move_forward_ex(_21, &_20) ) { ZEPHIR_GET_HVALUE(extension, _22); ZEPHIR_INIT_NVAR(filePath); ZEPHIR_CONCAT_VVSV(filePath, fixedDirectory, fileName, ".", extension); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_checkedPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:beforeCheckPath", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_23, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_11, "is_file", &_12, 279, filePath); zephir_check_call_status(); if (zephir_is_true(_11)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_24, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } } } } } ZEPHIR_SINIT_NVAR(_5); ZVAL_STRING(&_5, "_", 0); ZEPHIR_INIT_VAR(dsClassName); zephir_fast_str_replace(&dsClassName, &_5, ds, className TSRMLS_CC); ZEPHIR_SINIT_NVAR(_18); ZVAL_STRING(&_18, "\\", 0); ZEPHIR_INIT_VAR(nsClassName); zephir_fast_str_replace(&nsClassName, &_18, ds, dsClassName TSRMLS_CC); ZEPHIR_OBS_VAR(directories); zephir_read_property_this(&directories, this_ptr, SL("_directories"), PH_NOISY_CC); if (Z_TYPE_P(directories) == IS_ARRAY) { zephir_is_iterable(directories, &_26, &_25, 0, 0, "phalcon/loader.zep", 464); for ( ; zephir_hash_get_current_data_ex(_26, (void**) &_27, &_25) == SUCCESS ; zephir_hash_move_forward_ex(_26, &_25) ) { ZEPHIR_GET_HVALUE(directory, _27); ZEPHIR_INIT_NVAR(_0); zephir_fast_trim(_0, directory, ds, ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_INIT_NVAR(fixedDirectory); ZEPHIR_CONCAT_VV(fixedDirectory, _0, ds); zephir_is_iterable(extensions, &_29, &_28, 0, 0, "phalcon/loader.zep", 463); for ( ; zephir_hash_get_current_data_ex(_29, (void**) &_30, &_28) == SUCCESS ; zephir_hash_move_forward_ex(_29, &_28) ) { ZEPHIR_GET_HVALUE(extension, _30); ZEPHIR_INIT_NVAR(filePath); ZEPHIR_CONCAT_VVSV(filePath, fixedDirectory, nsClassName, ".", extension); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_checkedPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:beforeCheckPath", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_31, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } ZEPHIR_CALL_FUNCTION(&_11, "is_file", &_12, 279, filePath); zephir_check_call_status(); if (zephir_is_true(_11)) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { zephir_update_property_this(this_ptr, SL("_foundPath"), filePath TSRMLS_CC); ZEPHIR_INIT_NVAR(_9); ZVAL_STRING(_9, "loader:pathFound", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_32, 0, _9, this_ptr, filePath); zephir_check_temp_parameter(_9); zephir_check_call_status(); } if (zephir_require_zval(filePath TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } RETURN_MM_BOOL(1); } } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "loader:afterCheckClass", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", NULL, 0, _0, this_ptr, className); zephir_check_temp_parameter(_0); zephir_check_call_status(); } RETURN_MM_BOOL(0); }
/** * Generates SQL to add an index to a table */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addIndex) { zephir_nts_static zephir_fcall_cache_entry *_3 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *tableName_param = NULL, *schemaName_param = NULL, *index, *sql, *indexType = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL; zval *tableName = NULL, *schemaName = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index); 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); } if (Z_TYPE_P(index) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Index parameter must be an object compatible with Phalcon\\Db\\IndexInterface", "phalcon/db/dialect/sqlite.zep", 188); return; } ZEPHIR_CALL_METHOD(&indexType, index, "gettype", NULL); zephir_check_call_status(); ZEPHIR_INIT_VAR(sql); if (!(ZEPHIR_IS_EMPTY(indexType))) { ZEPHIR_CONCAT_SVS(sql, "CREATE ", indexType, " INDEX \""); } else { ZVAL_STRING(sql, "CREATE INDEX \"", 1); } if (schemaName && Z_STRLEN_P(schemaName)) { ZEPHIR_CALL_METHOD(&_0, index, "getname", NULL); zephir_check_call_status(); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_VSVSVS(_1, schemaName, "\".\"", _0, "\" ON \"", tableName, "\" ("); zephir_concat_self(&sql, _1 TSRMLS_CC); } else { ZEPHIR_CALL_METHOD(&_0, index, "getname", NULL); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_1); ZEPHIR_CONCAT_VSVS(_1, _0, "\" ON \"", tableName, "\" ("); zephir_concat_self(&sql, _1 TSRMLS_CC); } ZEPHIR_CALL_METHOD(&_2, index, "getcolumns", NULL); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, this_ptr, "getcolumnlist", &_3, _2); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_1); ZEPHIR_CONCAT_VS(_1, _0, ")"); zephir_concat_self(&sql, _1 TSRMLS_CC); RETURN_CCTOR(sql); }
/** * 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(); }
/** * Replaces placeholders from pattern returning a valid PCRE regular expression * * @param string pattern * @return string */ PHP_METHOD(Test_Router_Route, compilePattern) { zval *pattern = NULL, *idPattern, _0 = zval_used_for_init, *_1 = NULL, _2 = zval_used_for_init, *_3 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &pattern); ZEPHIR_SEPARATE_PARAM(pattern); if (zephir_memnstr_str(pattern, SL(":"), "test/router/route.zep", 57)) { ZEPHIR_INIT_VAR(idPattern); ZVAL_STRING(idPattern, "/([a-zA-Z0-9\\_\\-]+)", 1); if (zephir_memnstr_str(pattern, SL("/:module"), "test/router/route.zep", 63)) { ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "/:module", 0); ZEPHIR_INIT_VAR(_1); zephir_call_func_p3(_1, "str_replace", &_0, idPattern, pattern); ZEPHIR_CPY_WRT(pattern, _1); } if (zephir_memnstr_str(pattern, SL("/:controller"), "test/router/route.zep", 68)) { ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "/:controller", 0); ZEPHIR_INIT_NVAR(_1); zephir_call_func_p3(_1, "str_replace", &_0, idPattern, pattern); ZEPHIR_CPY_WRT(pattern, _1); } if (zephir_memnstr_str(pattern, SL("/:namespace"), "test/router/route.zep", 73)) { ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "/:namespace", 0); ZEPHIR_INIT_NVAR(_1); zephir_call_func_p3(_1, "str_replace", &_0, idPattern, pattern); ZEPHIR_CPY_WRT(pattern, _1); } if (zephir_memnstr_str(pattern, SL("/:action"), "test/router/route.zep", 78)) { ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "/:action", 0); ZEPHIR_INIT_NVAR(_1); zephir_call_func_p3(_1, "str_replace", &_0, idPattern, pattern); ZEPHIR_CPY_WRT(pattern, _1); } if (zephir_memnstr_str(pattern, SL("/:params"), "test/router/route.zep", 83)) { ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "/:params", 0); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "(/.*)*", 0); ZEPHIR_INIT_NVAR(_1); zephir_call_func_p3(_1, "str_replace", &_0, &_2, pattern); ZEPHIR_CPY_WRT(pattern, _1); } if (zephir_memnstr_str(pattern, SL("/:int"), "test/router/route.zep", 88)) { ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "/:int", 0); ZEPHIR_SINIT_NVAR(_2); ZVAL_STRING(&_2, "/([0-9]+)", 0); ZEPHIR_INIT_NVAR(_1); zephir_call_func_p3(_1, "str_replace", &_0, &_2, pattern); ZEPHIR_CPY_WRT(pattern, _1); } } if (zephir_memnstr_str(pattern, SL("("), "test/router/route.zep", 94)) { ZEPHIR_INIT_VAR(_3); ZEPHIR_CONCAT_SV(_3, "#^", pattern); ZEPHIR_CONCAT_VS(return_value, _3, "$#"); RETURN_MM(); } if (zephir_memnstr_str(pattern, SL("["), "test/router/route.zep", 99)) { ZEPHIR_INIT_LNVAR(_3); ZEPHIR_CONCAT_SV(_3, "#^", pattern); ZEPHIR_CONCAT_VS(return_value, _3, "$#"); RETURN_MM(); } RETURN_CCTOR(pattern); }
PHP_METHOD(PhalconPlus_RPC_Client_Adapter_Local, callByParams) { zephir_nts_static zephir_fcall_cache_entry *_7 = NULL; zval *_5, *_11, *_12; int ZEPHIR_LAST_CALL_STATUS; zend_class_entry *_3; zval *service_param = NULL, *method_param = NULL, *request, *serviceClass, *serviceObj, *response, *_0 = NULL, *_1, *_2 = NULL, *_4, *_6, *_9, *_10; zval *service = NULL, *method = NULL, *_8; 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(_1); zephir_ucfirst(_1, service); ZEPHIR_INIT_VAR(serviceClass); ZEPHIR_CONCAT_VS(serviceClass, _1, "Service"); ZEPHIR_INIT_VAR(serviceObj); zephir_fetch_safe_class(_2, serviceClass); _3 = zend_fetch_class(Z_STRVAL_P(_2), Z_STRLEN_P(_2), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(serviceObj, _3); if (zephir_has_constructor(serviceObj TSRMLS_CC)) { _4 = zephir_fetch_nproperty_this(this_ptr, SL("di"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, serviceObj, "__construct", NULL, _4); zephir_check_call_status(); } ZEPHIR_INIT_VAR(_5); zephir_create_array(_5, 2, 0 TSRMLS_CC); zephir_array_fast_append(_5, serviceObj); zephir_array_fast_append(_5, method); if (zephir_is_callable(_5 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_6); ZEPHIR_CONCAT_SV(_6, "ServerClass: ", serviceClass); ZEPHIR_CALL_FUNCTION(NULL, "error_log", &_7, _6); zephir_check_call_status(); ZEPHIR_INIT_VAR(_8); ZEPHIR_CONCAT_SV(_8, "InvokeMethod: ", method); ZEPHIR_CALL_FUNCTION(NULL, "error_log", &_7, _8); zephir_check_call_status(); ZEPHIR_INIT_VAR(_9); zephir_var_export_ex(_9, &(request) TSRMLS_CC); ZEPHIR_INIT_VAR(_10); ZEPHIR_CONCAT_SV(_10, "InputParma: ", _9); ZEPHIR_CALL_FUNCTION(NULL, "error_log", &_7, _10); zephir_check_call_status(); ZEPHIR_INIT_VAR(response); ZEPHIR_INIT_VAR(_11); zephir_create_array(_11, 2, 0 TSRMLS_CC); zephir_array_fast_append(_11, serviceObj); zephir_array_fast_append(_11, method); ZEPHIR_INIT_VAR(_12); zephir_create_array(_12, 1, 0 TSRMLS_CC); zephir_array_fast_append(_12, request); ZEPHIR_CALL_USER_FUNC_ARRAY(response, _11, _12); zephir_check_call_status(); RETURN_CCTOR(response); } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(zend_exception_get_default(TSRMLS_C), "No service is found", "phalconplus/RPC/Client/Adapter/Local.zep", 29); return; } }
PHP_METHOD(Phalcon_Validation_Validator_Uniqueness, isUniqueness) { zval *_32$$16 = NULL, *_44$$20 = NULL, *_58$$25 = NULL; zend_bool _11$$7, _18$$12; zend_class_entry *_78; HashTable *_2, *_8, *_24$$13, *_29$$15, *_41$$19, *_50$$22, *_55$$24, *_68$$27; HashPosition _1, _7, _23$$13, _28$$15, _40$$19, _49$$22, _54$$24, _67$$27; zephir_fcall_cache_entry *_5 = NULL, *_12 = NULL, *_14 = NULL; int ZEPHIR_LAST_CALL_STATUS, index = 0; zval *validation, *field = NULL, *value = NULL, *values = NULL, *convert = NULL, *record = NULL, *attribute = NULL, *except = NULL, *params = NULL, *metaData = NULL, *primaryField = NULL, *className = NULL, *singleField = NULL, *fieldExcept = NULL, *singleExcept = NULL, *notInValues = NULL, *exceptConditions = NULL, *_0 = NULL, **_3, **_9, *_63 = NULL, *_76, *_77 = NULL, *_4$$4 = NULL, *_6$$5 = NULL, *_10$$7 = NULL, *_13$$7 = NULL, _15$$10 = zval_used_for_init, *_16$$10 = NULL, *_17$$11 = NULL, *_19$$12, _20$$12, _21$$12, *_22$$12 = NULL, **_25$$13, *_26$$14 = NULL, *_27$$14 = NULL, **_30$$15, *_33$$15 = NULL, *_34$$15 = NULL, _31$$16 = zval_used_for_init, _35$$17 = zval_used_for_init, *_36$$17 = NULL, *_37$$18 = NULL, *_38$$18, *_39$$18, **_42$$19, *_45$$19, *_46$$19, _43$$20 = zval_used_for_init, _47$$21, *_48$$21, **_51$$22, *_52$$23 = NULL, *_53$$23 = NULL, **_56$$24, *_59$$24 = NULL, *_60$$24 = NULL, _57$$25 = zval_used_for_init, _61$$26 = zval_used_for_init, *_62$$26 = NULL, *_64$$27 = NULL, *_65$$27, *_66$$27 = NULL, **_69$$27, *_70$$28 = NULL, _71$$28 = zval_used_for_init, *_72$$28 = NULL, *_73$$28 = NULL, *_74$$29, *_75$$29; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &validation, &field); ZEPHIR_SEPARATE_PARAM(field); ZEPHIR_INIT_VAR(exceptConditions); array_init(exceptConditions); index = 0; ZEPHIR_INIT_VAR(params); zephir_create_array(params, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_0); array_init(_0); zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_0); array_init(_0); zephir_array_update_string(¶ms, SL("bind"), &_0, PH_COPY | PH_SEPARATE); if (Z_TYPE_P(field) != IS_ARRAY) { ZEPHIR_CPY_WRT(singleField, field); ZEPHIR_INIT_NVAR(field); array_init(field); zephir_array_append(&field, singleField, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 156); } ZEPHIR_INIT_VAR(values); array_init(values); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "convert", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&convert, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); zephir_is_iterable(field, &_2, &_1, 0, 0, "phalcon/validation/validator/uniqueness.zep", 166); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(singleField, _3); ZEPHIR_CALL_METHOD(&_4$$4, validation, "getvalue", &_5, 0, singleField); zephir_check_call_status(); zephir_array_update_zval(&values, singleField, &_4$$4, PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(convert) != IS_NULL) { ZEPHIR_CALL_ZVAL_FUNCTION(&_6$$5, convert, NULL, 0, values); zephir_check_call_status(); ZEPHIR_CPY_WRT(values, _6$$5); if (!(Z_TYPE_P(values) == IS_ARRAY)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Value conversion must return an array", "phalcon/validation/validator/uniqueness.zep", 170); return; } } zephir_is_iterable(field, &_8, &_7, 0, 0, "phalcon/validation/validator/uniqueness.zep", 200); for ( ; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS ; zephir_hash_move_forward_ex(_8, &_7) ) { ZEPHIR_GET_HVALUE(singleField, _9); ZEPHIR_INIT_NVAR(fieldExcept); ZVAL_NULL(fieldExcept); ZEPHIR_INIT_NVAR(notInValues); array_init(notInValues); ZEPHIR_INIT_NVAR(_10$$7); ZVAL_STRING(_10$$7, "model", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&record, this_ptr, "getoption", NULL, 0, _10$$7); zephir_check_temp_parameter(_10$$7); zephir_check_call_status(); ZEPHIR_OBS_NVAR(value); zephir_array_fetch(&value, values, singleField, PH_NOISY, "phalcon/validation/validator/uniqueness.zep", 178 TSRMLS_CC); _11$$7 = ZEPHIR_IS_EMPTY(record); if (!(_11$$7)) { _11$$7 = Z_TYPE_P(record) != IS_OBJECT; } if (_11$$7) { ZEPHIR_CALL_METHOD(&record, validation, "getentity", &_12, 0); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(record)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Model of record must be set to property \"model\"", "phalcon/validation/validator/uniqueness.zep", 184); return; } } ZEPHIR_INIT_NVAR(_10$$7); ZVAL_STRING(_10$$7, "attribute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_13$$7, this_ptr, "getoption", NULL, 0, _10$$7, singleField); zephir_check_temp_parameter(_10$$7); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&attribute, this_ptr, "getcolumnnamereal", &_14, 0, record, _13$$7); zephir_check_call_status(); if (Z_TYPE_P(value) != IS_NULL) { ZEPHIR_SINIT_NVAR(_15$$10); ZVAL_LONG(&_15$$10, index); ZEPHIR_INIT_LNVAR(_16$$10); ZEPHIR_CONCAT_VSV(_16$$10, attribute, " = ?", &_15$$10); zephir_array_update_multi(¶ms, &_16$$10 TSRMLS_CC, SL("sa"), 3, SL("conditions")); zephir_array_update_multi(¶ms, &value TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } else { ZEPHIR_INIT_LNVAR(_17$$11); ZEPHIR_CONCAT_VS(_17$$11, attribute, " IS NULL"); zephir_array_update_multi(¶ms, &_17$$11 TSRMLS_CC, SL("sa"), 3, SL("conditions")); } } ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "except", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&except, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); if (zephir_is_true(except)) { _18$$12 = Z_TYPE_P(except) == IS_ARRAY; if (_18$$12) { ZEPHIR_INIT_VAR(_19$$12); zephir_array_keys(_19$$12, except TSRMLS_CC); ZEPHIR_SINIT_VAR(_20$$12); ZVAL_LONG(&_20$$12, 0); ZEPHIR_SINIT_VAR(_21$$12); ZVAL_LONG(&_21$$12, (zephir_fast_count_int(except TSRMLS_CC) - 1)); ZEPHIR_CALL_FUNCTION(&_22$$12, "range", NULL, 446, &_20$$12, &_21$$12); zephir_check_call_status(); _18$$12 = !ZEPHIR_IS_IDENTICAL(_19$$12, _22$$12); } if (_18$$12) { zephir_is_iterable(except, &_24$$13, &_23$$13, 0, 0, "phalcon/validation/validator/uniqueness.zep", 219); for ( ; zephir_hash_get_current_data_ex(_24$$13, (void**) &_25$$13, &_23$$13) == SUCCESS ; zephir_hash_move_forward_ex(_24$$13, &_23$$13) ) { ZEPHIR_GET_HMKEY(singleField, _24$$13, _23$$13); ZEPHIR_GET_HVALUE(fieldExcept, _25$$13); ZEPHIR_INIT_NVAR(_27$$14); ZVAL_STRING(_27$$14, "attribute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_26$$14, this_ptr, "getoption", NULL, 0, _27$$14, singleField); zephir_check_temp_parameter(_27$$14); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&attribute, this_ptr, "getcolumnnamereal", &_14, 0, record, _26$$14); zephir_check_call_status(); if (Z_TYPE_P(fieldExcept) == IS_ARRAY) { zephir_is_iterable(fieldExcept, &_29$$15, &_28$$15, 0, 0, "phalcon/validation/validator/uniqueness.zep", 212); for ( ; zephir_hash_get_current_data_ex(_29$$15, (void**) &_30$$15, &_28$$15) == SUCCESS ; zephir_hash_move_forward_ex(_29$$15, &_28$$15) ) { ZEPHIR_GET_HVALUE(singleExcept, _30$$15); ZEPHIR_SINIT_NVAR(_31$$16); ZVAL_LONG(&_31$$16, index); ZEPHIR_INIT_LNVAR(_32$$16); ZEPHIR_CONCAT_SV(_32$$16, "?", &_31$$16); zephir_array_append(¬InValues, _32$$16, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 208); zephir_array_update_multi(¶ms, &singleExcept TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } ZEPHIR_INIT_NVAR(_33$$15); zephir_fast_join_str(_33$$15, SL(","), notInValues TSRMLS_CC); ZEPHIR_INIT_LNVAR(_34$$15); ZEPHIR_CONCAT_VSVS(_34$$15, attribute, " NOT IN (", _33$$15, ")"); zephir_array_append(&exceptConditions, _34$$15, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 212); } else { ZEPHIR_SINIT_NVAR(_35$$17); ZVAL_LONG(&_35$$17, index); ZEPHIR_INIT_LNVAR(_36$$17); ZEPHIR_CONCAT_VSV(_36$$17, attribute, " <> ?", &_35$$17); zephir_array_append(&exceptConditions, _36$$17, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 214); zephir_array_update_multi(¶ms, &fieldExcept TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } } } else if (zephir_fast_count_int(field TSRMLS_CC) == 1) { zephir_array_fetch_long(&_38$$18, field, 0, PH_NOISY | PH_READONLY, "phalcon/validation/validator/uniqueness.zep", 220 TSRMLS_CC); ZEPHIR_INIT_VAR(_39$$18); ZVAL_STRING(_39$$18, "attribute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_37$$18, this_ptr, "getoption", NULL, 0, _39$$18, _38$$18); zephir_check_temp_parameter(_39$$18); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&attribute, this_ptr, "getcolumnnamereal", &_14, 0, record, _37$$18); zephir_check_call_status(); if (Z_TYPE_P(except) == IS_ARRAY) { zephir_is_iterable(except, &_41$$19, &_40$$19, 0, 0, "phalcon/validation/validator/uniqueness.zep", 227); for ( ; zephir_hash_get_current_data_ex(_41$$19, (void**) &_42$$19, &_40$$19) == SUCCESS ; zephir_hash_move_forward_ex(_41$$19, &_40$$19) ) { ZEPHIR_GET_HVALUE(singleExcept, _42$$19); ZEPHIR_SINIT_NVAR(_43$$20); ZVAL_LONG(&_43$$20, index); ZEPHIR_INIT_LNVAR(_44$$20); ZEPHIR_CONCAT_SV(_44$$20, "?", &_43$$20); zephir_array_append(¬InValues, _44$$20, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 223); zephir_array_update_multi(¶ms, &singleExcept TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } ZEPHIR_INIT_VAR(_45$$19); zephir_fast_join_str(_45$$19, SL(","), notInValues TSRMLS_CC); ZEPHIR_INIT_VAR(_46$$19); ZEPHIR_CONCAT_VSVS(_46$$19, attribute, " NOT IN (", _45$$19, ")"); zephir_array_append(&exceptConditions, _46$$19, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 227); } else { ZEPHIR_SINIT_VAR(_47$$21); ZVAL_LONG(&_47$$21, index); ZEPHIR_INIT_VAR(_48$$21); ZEPHIR_CONCAT_VSV(_48$$21, attribute, " <> ?", &_47$$21); zephir_array_update_multi(¶ms, &_48$$21 TSRMLS_CC, SL("sa"), 3, SL("conditions")); zephir_array_update_multi(¶ms, &except TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } } else if (zephir_fast_count_int(field TSRMLS_CC) > 1) { zephir_is_iterable(field, &_50$$22, &_49$$22, 0, 0, "phalcon/validation/validator/uniqueness.zep", 249); for ( ; zephir_hash_get_current_data_ex(_50$$22, (void**) &_51$$22, &_49$$22) == SUCCESS ; zephir_hash_move_forward_ex(_50$$22, &_49$$22) ) { ZEPHIR_GET_HVALUE(singleField, _51$$22); ZEPHIR_INIT_NVAR(_53$$23); ZVAL_STRING(_53$$23, "attribute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_52$$23, this_ptr, "getoption", NULL, 0, _53$$23, singleField); zephir_check_temp_parameter(_53$$23); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&attribute, this_ptr, "getcolumnnamereal", &_14, 0, record, _52$$23); zephir_check_call_status(); if (Z_TYPE_P(except) == IS_ARRAY) { zephir_is_iterable(except, &_55$$24, &_54$$24, 0, 0, "phalcon/validation/validator/uniqueness.zep", 242); for ( ; zephir_hash_get_current_data_ex(_55$$24, (void**) &_56$$24, &_54$$24) == SUCCESS ; zephir_hash_move_forward_ex(_55$$24, &_54$$24) ) { ZEPHIR_GET_HVALUE(singleExcept, _56$$24); ZEPHIR_SINIT_NVAR(_57$$25); ZVAL_LONG(&_57$$25, index); ZEPHIR_INIT_LNVAR(_58$$25); ZEPHIR_CONCAT_SV(_58$$25, "?", &_57$$25); zephir_array_append(¬InValues, _58$$25, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 238); zephir_array_update_multi(¶ms, &singleExcept TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } ZEPHIR_INIT_NVAR(_59$$24); zephir_fast_join_str(_59$$24, SL(","), notInValues TSRMLS_CC); ZEPHIR_INIT_LNVAR(_60$$24); ZEPHIR_CONCAT_VSVS(_60$$24, attribute, " NOT IN (", _59$$24, ")"); zephir_array_append(&exceptConditions, _60$$24, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 242); } else { ZEPHIR_SINIT_NVAR(_61$$26); ZVAL_LONG(&_61$$26, index); ZEPHIR_INIT_LNVAR(_62$$26); ZEPHIR_CONCAT_VSV(_62$$26, attribute, " <> ?", &_61$$26); zephir_array_update_multi(¶ms, &_62$$26 TSRMLS_CC, SL("sa"), 3, SL("conditions")); zephir_array_update_multi(¶ms, &except TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } } } } ZEPHIR_CALL_METHOD(&_63, record, "getdirtystate", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_63, 0)) { ZEPHIR_CALL_METHOD(&_64$$27, record, "getdi", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_65$$27); ZVAL_STRING(_65$$27, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&metaData, _64$$27, "getshared", NULL, 0, _65$$27); zephir_check_temp_parameter(_65$$27); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_66$$27, metaData, "getprimarykeyattributes", NULL, 0, record); zephir_check_call_status(); zephir_is_iterable(_66$$27, &_68$$27, &_67$$27, 0, 0, "phalcon/validation/validator/uniqueness.zep", 263); for ( ; zephir_hash_get_current_data_ex(_68$$27, (void**) &_69$$27, &_67$$27) == SUCCESS ; zephir_hash_move_forward_ex(_68$$27, &_67$$27) ) { ZEPHIR_GET_HVALUE(primaryField, _69$$27); ZEPHIR_CALL_METHOD(&_70$$28, this_ptr, "getcolumnnamereal", &_14, 0, record, primaryField); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_71$$28); ZVAL_LONG(&_71$$28, index); ZEPHIR_INIT_LNVAR(_72$$28); ZEPHIR_CONCAT_VSV(_72$$28, _70$$28, " <> ?", &_71$$28); zephir_array_update_multi(¶ms, &_72$$28 TSRMLS_CC, SL("sa"), 3, SL("conditions")); ZEPHIR_CALL_METHOD(&_73$$28, record, "readattribute", NULL, 0, primaryField); zephir_check_call_status(); zephir_array_update_multi(¶ms, &_73$$28 TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } } ZEPHIR_INIT_VAR(className); zephir_get_class(className, record, 0 TSRMLS_CC); if (!(ZEPHIR_IS_EMPTY(exceptConditions))) { ZEPHIR_INIT_VAR(_74$$29); zephir_fast_join_str(_74$$29, SL(" OR "), exceptConditions TSRMLS_CC); ZEPHIR_INIT_VAR(_75$$29); ZEPHIR_CONCAT_SVS(_75$$29, "(", _74$$29, ")"); zephir_array_update_multi(¶ms, &_75$$29 TSRMLS_CC, SL("sa"), 3, SL("conditions")); } ZEPHIR_INIT_NVAR(_0); zephir_array_fetch_string(&_76, params, SL("conditions"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/uniqueness.zep", 269 TSRMLS_CC); zephir_fast_join_str(_0, SL(" AND "), _76 TSRMLS_CC); zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); _78 = zephir_fetch_class(className TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&_77, _78, "count", NULL, 0, params); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_LONG(_77, 0)); }
/** * Executes the validation */ PHP_METHOD(Phalcon_Validation_Validator_Uniqueness, validate) { zend_class_entry *_4, *_5; zval *_1 = NULL, *_3 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *field = NULL; zval *validation, *field_param = NULL, *attribute = NULL, *value = NULL, *model = NULL, *except = NULL, *number = NULL, *message = NULL, *label = NULL, *replacePairs, *_0 = NULL, *_2 = NULL, *_6 = NULL, *_7; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &validation, &field_param); if (unlikely(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(field_param) == IS_STRING)) { zephir_get_strval(field, field_param); } else { ZEPHIR_INIT_VAR(field); ZVAL_EMPTY_STRING(field); } ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field); zephir_check_call_status(); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "model", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&model, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "attribute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&attribute, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "except", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&except, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(model)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Model must be set", "phalcon/validation/validator/uniqueness.zep", 65); return; } if (ZEPHIR_IS_EMPTY(attribute)) { ZEPHIR_CPY_WRT(attribute, field); } if (zephir_is_true(except)) { ZEPHIR_INIT_VAR(_1); zephir_create_array(_1, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_2); ZEPHIR_CONCAT_VSVS(_2, attribute, " = :value: AND ", attribute, " != :except:"); zephir_array_fast_append(_1, _2); ZEPHIR_INIT_VAR(_3); zephir_create_array(_3, 2, 0 TSRMLS_CC); zephir_array_update_string(&_3, SL("value"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_3, SL("except"), &except, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_1, SL("bind"), &_3, PH_COPY | PH_SEPARATE); _4 = zephir_fetch_class(model TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&number, _4, "count", NULL, 0, _1); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(_1); zephir_create_array(_1, 2, 0 TSRMLS_CC); ZEPHIR_INIT_LNVAR(_2); ZEPHIR_CONCAT_VS(_2, attribute, " = :value:"); zephir_array_fast_append(_1, _2); ZEPHIR_INIT_NVAR(_3); zephir_create_array(_3, 1, 0 TSRMLS_CC); zephir_array_update_string(&_3, SL("value"), &value, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_1, SL("bind"), &_3, PH_COPY | PH_SEPARATE); _5 = zephir_fetch_class(model TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&number, _5, "count", NULL, 0, _1); zephir_check_call_status(); } if (zephir_is_true(number)) { ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "label", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(label)) { ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "message", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(replacePairs); zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE); if (ZEPHIR_IS_EMPTY(message)) { ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "Uniqueness", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); } ZEPHIR_INIT_NVAR(_0); object_init_ex(_0, phalcon_validation_message_ce); ZEPHIR_CALL_FUNCTION(&_6, "strtr", NULL, 54, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_VAR(_7); ZVAL_STRING(_7, "Uniqueness", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 436, _6, field, _7); zephir_check_temp_parameter(_7); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _0); zephir_check_call_status(); RETURN_MM_BOOL(0); } RETURN_MM_BOOL(1); }