$parts = explode('\\', static::class);
trigger_error(
sprintf(
Cake\Error\ErrorTrap->handleError() [internal], line ?? /var/www/html/vendor/cakephp/cakephp/src/Controller/Controller.php /var/www/html/vendor/cakephp/cakephp/src/Controller/Controller.php, line 316 Cake\Controller\Controller->__get() /var/www/html/src/Controller/AppController.php, line 96 App\Controller\AppController->beforeRender() /var/www/html/src/Controller/ErrorController.php, line 54 App\Controller\ErrorController->beforeRender() /var/www/html/vendor/cakephp/cakephp/src/Event/EventManager.php, line 334 Cake\Event\EventManager->_callListener() /var/www/html/vendor/cakephp/cakephp/src/Event/EventManager.php, line 312 Cake\Event\EventManager->dispatch() /var/www/html/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php, line 88 Cake\Controller\Controller->dispatchEvent() /var/www/html/vendor/cakephp/cakephp/src/Controller/Controller.php, line 696 Cake\Controller\Controller->render() /var/www/html/vendor/cakephp/cakephp/src/Error/Renderer/WebExceptionRenderer.php, line 419 Cake\Error\Renderer\WebExceptionRenderer->_outputMessage() /var/www/html/vendor/cakephp/cakephp/src/Error/Renderer/WebExceptionRenderer.php, line 290 Cake\Error\Renderer\WebExceptionRenderer->render() /var/www/html/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php, line 149 Cake\Error\Middleware\ErrorHandlerMiddleware->handleException() /var/www/html/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php, line 119 Cake\Error\Middleware\ErrorHandlerMiddleware->process() /var/www/html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/html/vendor/cakephp/debug_kit/src/Middleware/DebugKitMiddleware.php, line 60 DebugKit\Middleware\DebugKitMiddleware->process() /var/www/html/vendor/cakephp/cakephp/src/Http/Runner.php, line 82 Cake\Http\Runner->handle() /var/www/html/vendor/cakephp/cakephp/src/Http/Runner.php, line 60 Cake\Http\Runner->run() /var/www/html/vendor/cakephp/cakephp/src/Http/Server.php, line 104 Cake\Http\Server->run() /var/www/html/webroot/index.php, line 36 [main]
$message = "Unable to emit headers. Headers sent in file={$file} line={$line}";
trigger_error($message, E_USER_WARNING);
}
Cake\Error\ErrorTrap->handleError() [internal], line ?? /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 65 Cake\Http\ResponseEmitter->emit() /var/www/html/vendor/cakephp/cakephp/src/Http/Server.php, line 148 Cake\Http\Server->emit() /var/www/html/webroot/index.php, line 36 [main]
$reasonPhrase = $response->getReasonPhrase();
header(sprintf(
'HTTP/%s %d%s',
Cake\Error\ErrorTrap->handleError() [internal], line ?? /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 159 Cake\Http\ResponseEmitter->emitStatusLine() /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 68 Cake\Http\ResponseEmitter->emit() /var/www/html/vendor/cakephp/cakephp/src/Http/Server.php, line 148 Cake\Http\Server->emit() /var/www/html/webroot/index.php, line 36 [main]
foreach ($values as $value) {
header(sprintf(
'%s: %s',
Cake\Error\ErrorTrap->handleError() [internal], line ?? /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 192 Cake\Http\ResponseEmitter->emitHeaders() /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 69 Cake\Http\ResponseEmitter->emit() /var/www/html/vendor/cakephp/cakephp/src/Http/Server.php, line 148 Cake\Http\Server->emit() /var/www/html/webroot/index.php, line 36 [main]
foreach ($values as $value) {
header(sprintf(
'%s: %s',
Cake\Error\ErrorTrap->handleError() [internal], line ?? /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 192 Cake\Http\ResponseEmitter->emitHeaders() /var/www/html/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 69 Cake\Http\ResponseEmitter->emit() /var/www/html/vendor/cakephp/cakephp/src/Http/Server.php, line 148 Cake\Http\Server->emit() /var/www/html/webroot/index.php, line 36 [main]
Connection to Mysql could not be established: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for db failed: Name or service not known
$retry = new CommandRetry(new ErrorCodeWaitStrategy(static::RETRY_ERROR_CODES, 5), 4); |
|
try { |
|
return $retry->run($action); |
|
} catch (PDOException $e) { |
|
throw new MissingConnectionException( |
|
[ |
|
'driver' => App::shortName(static::class, 'Database/Driver'), |
|
'reason' => $e->getMessage(), |
|
], |
if (!empty($config['encoding'])) { |
|
$dsn .= ";charset={$config['encoding']}"; |
|
} |
|
|
|
$this->pdo = $this->createPdo($dsn, $config); |
|
|
|
if (!empty($config['init'])) { |
|
foreach ((array)$config['init'] as $command) { |
|
$this->pdo->exec($command); |
* @param \Cake\Database\Driver $driver The driver to use. |
|
*/ |
|
public function __construct(Driver $driver) |
|
{ |
|
$driver->connect(); |
|
$this->_driver = $driver; |
|
} |
|
|
|
/** |
* @inheritDoc |
|
*/ |
|
public function schemaDialect(): SchemaDialect |
|
{ |
|
return $this->_schemaDialect ?? ($this->_schemaDialect = new MysqlSchemaDialect($this)); |
|
} |
|
|
|
/** |
|
* @inheritDoc |
*/ |
|
public function __construct(Connection $connection) |
|
{ |
|
$this->_connection = $connection; |
|
$this->_dialect = $connection->getDriver()->schemaDialect(); |
|
} |
|
|
|
/** |
|
* Get the list of tables, excluding any views, available in the current connection. |
} |
|
|
|
if (!empty($this->_config['cacheMetadata'])) { |
|
return $this->_schemaCollection = new CachedCollection( |
|
new SchemaCollection($this), |
|
empty($this->_config['cacheKeyPrefix']) ? $this->configName() : $this->_config['cacheKeyPrefix'], |
|
$this->getCacher(), |
|
); |
|
} |
public function getSchema(): TableSchemaInterface |
|
{ |
|
if ($this->_schema === null) { |
|
$this->_schema = $this->getConnection() |
|
->getSchemaCollection() |
|
->describe($this->getTable()); |
|
if (Configure::read('debug')) { |
|
$this->checkAliasLengths(); |
|
} |
} |
|
|
|
public function getSchema(): TableSchemaInterface |
|
{ |
|
$schema = parent::getSchema(); |
|
//Workaround with special json type which returns array as default value |
|
//TODO: need to add checks in code where it needed |
|
$schema->setColumnType('zones', 'jsontoarray'); |
|
$schema->setColumnType('options', 'json'); |
* @return void |
|
*/ |
|
public function initialize(array $config): void { |
|
if ($this->_config['length'] === null) { |
|
$field = $this->_table->getSchema()->getColumn($this->_config['field']); |
|
$length = $field ? $field['length'] : 0; |
|
$this->_config['length'] = $length; |
|
} |
|
|
$config, |
|
); |
|
$this->_table = $table; |
|
$this->setConfig($config); |
|
$this->initialize($config); |
|
} |
|
|
|
/** |
|
* Constructor hook method. |
$this->_defaultConfig['replace'][$key] = __d('tools', $value); |
|
} |
|
$config += (array)Configure::read('Slugged'); |
|
|
|
parent::__construct($table, $config); |
|
} |
|
|
|
/** |
|
* Constructor hook method. |
if (is_object($class)) { |
|
return $class; |
|
} |
|
|
|
$instance = new $class($this->_table, $config); |
|
|
|
$enable = $config['enabled'] ?? true; |
|
if ($enable) { |
|
$this->getEventManager()->on($instance); |
$this->_throwMissingClassError($name, $plugin); |
|
} |
|
} |
|
|
|
$instance = $this->_create($className, $objName, $config); |
|
$this->_loaded[$objName] = $instance; |
|
|
|
return $instance; |
|
} |
* @see \Cake\ORM\Behavior |
|
*/ |
|
public function addBehavior(string $name, array $options = []) |
|
{ |
|
$this->_behaviors->load($name, $options); |
|
|
|
return $this; |
|
} |
|
|
]; |
|
$translit = Configure::read('translit'); |
|
if (isset($translit[I18n::getLocale()])) |
|
$cfg['replace'] = $translit[I18n::getLocale()]; |
|
$this->addBehavior('Tools.Slugged', $cfg); |
|
|
|
$this->addBehavior('Upload', [ |
|
'poster' => [ |
|
'writer' => 'App\File\Writer\Base64Writer', |
$this->_associations = $associations ?: new AssociationCollection(); |
|
/** @psalm-suppress TypeDoesNotContainType */ |
|
$this->queryFactory ??= new QueryFactory(); |
|
|
|
$this->initialize($config); |
|
|
|
assert($this->_eventManager !== null, 'EventManager not available'); |
|
|
|
$this->_eventManager->on($this); |
{ |
|
/** @var class-string<\Cake\ORM\Table> $class */ |
|
$class = $options['className']; |
|
|
|
return new $class($options); |
|
} |
|
|
|
/** |
|
* Set a Table instance. |
$options['queryFactory'] = $this->queryFactory; |
|
} |
|
|
|
$options['registryAlias'] = $alias; |
|
$instance = $this->_create($options); |
|
|
|
if ($options['className'] === $this->fallbackClassName) { |
|
$this->_fallbacked[$alias] = $instance; |
|
} |
} |
|
|
|
$this->options[$alias] = $storeOptions; |
|
|
|
return $this->instances[$alias] = $this->createInstance($alias, $options); |
|
} |
|
|
|
/** |
|
* Create an instance of a given classname. |
*/ |
|
public function get(string $alias, array $options = []): Table |
|
{ |
|
/** @var \Cake\ORM\Table */ |
|
return parent::get($alias, $options); |
|
} |
|
|
|
/** |
|
* @inheritDoc |
'You must provide an `$alias` or set the `$defaultTable` property to a non empty string.', |
|
); |
|
} |
|
|
|
return $this->getTableLocator()->get($alias, $options); |
|
} |
|
} |
|
|
[, $class] = pluginSplit($this->defaultTable, true); |
|
} |
|
|
|
if ($class === $name) { |
|
return $this->fetchTable(); |
|
} |
|
} |
|
|
|
if ($this->components()->has($name)) { |
} |
|
|
|
protected function archiveEvents($page = 1) |
|
{ |
|
$query = $this->Events->find('events') |
|
->find('archive'); |
|
if(!$this->Tools->isBaseDomain()){ |
|
$query->find('byCountryDomain', domain: $this->request->host()); |
|
} |
} |
|
|
|
public function archive() |
|
{ |
|
$this->archiveEvents(); |
|
return $this->render('archive'); |
|
} |
|
|
|
public function archivePaged($page = null) |
* @return void |
|
*/ |
|
public function invokeAction(Closure $action, array $args): void |
|
{ |
|
$result = $action(...$args); |
|
if ($result !== null) { |
|
assert( |
|
$result instanceof Response, |
|
sprintf( |
$args = $this->getActionArgs( |
|
$action, |
|
array_values((array)$controller->getRequest()->getParam('pass')), |
|
); |
|
$controller->invokeAction($action, $args); |
|
|
|
$result = $controller->shutdownProcess(); |
|
if ($result !== null) { |
|
return $result; |
|
|
return $runner->run($middlewareQueue, $controller->getRequest(), $this); |
|
} |
|
|
|
return $this->handle($controller->getRequest()); |
|
} |
|
|
|
/** |
|
* Invoke the action. |
} |
|
|
|
$controller = $this->controllerFactory->create($request); |
|
|
|
return $this->controllerFactory->invoke($controller); |
|
} |
|
} |
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
|
} |
|
|
|
return new Response([ |
|
'body' => 'Middleware queue was exhausted without returning a response ' |
$request = $request->withAttribute('authentication', $service); |
|
$request = $request->withAttribute('authenticationResult', $result); |
|
|
|
try { |
|
$response = $handler->handle($request); |
|
$authenticator = $service->getAuthenticationProvider(); |
|
|
|
if ($authenticator !== null && !$authenticator instanceof StatelessInterface) { |
|
/** |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
Hash::get($params, 'plugin') !== 'ADmad/SocialAuth' |
|
|| Hash::get($params, 'controller') !== 'Auth' |
|
|| !in_array($action, ['login', 'callback'], true) |
|
) { |
|
return $handler->handle($request); |
|
} |
|
|
|
$method = '_handle' . ucfirst($action) . 'Action'; |
|
|
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
*/ |
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
if (!in_array($request->getMethod(), $this->methods, true)) { |
|
return $handler->handle($request); |
|
} |
|
[$type] = explode(';', $request->getHeaderLine('Content-Type')); |
|
$type = strtolower($type); |
|
if (!isset($this->parsers[$type])) { |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
); |
|
} |
|
$matching = Router::getRouteCollection()->getMiddleware($middleware); |
|
if (!$matching) { |
|
return $handler->handle($request); |
|
} |
|
|
|
$container = $this->app instanceof ContainerApplicationInterface |
|
? $this->app->getContainer() |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
$url = $request->getUri()->getPath(); |
|
if (str_contains($url, '..') || !str_contains($url, '.')) { |
|
return $handler->handle($request); |
|
} |
|
|
|
if (str_contains($url, '/.')) { |
|
return $handler->handle($request); |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
*/ |
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
{ |
|
try { |
|
return $handler->handle($request); |
|
} catch (RedirectException $exception) { |
|
return $this->handleRedirect($exception); |
|
} catch (Throwable $exception) { |
|
return $this->handleException($exception, Router::getRequest() ?? $request); |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
if ($this->service->isEnabled()) { |
|
$this->service->loadPanels(); |
|
$this->service->initializePanels(); |
|
} |
|
$response = $handler->handle($request); |
|
|
|
if (!$this->service->isEnabled()) { |
|
return $response; |
|
} |
if ($this->queue->valid()) { |
|
$middleware = $this->queue->current(); |
|
$this->queue->next(); |
|
|
|
return $middleware->process($request, $this); |
|
} |
|
|
|
if ($this->fallbackHandler) { |
|
return $this->fallbackHandler->handle($request); |
$this->queue = $queue; |
|
$this->queue->rewind(); |
|
$this->fallbackHandler = $fallbackHandler; |
|
|
|
return $this->handle($request); |
|
} |
|
|
|
/** |
|
* Handle incoming server request and return a response. |
} |
|
|
|
$this->dispatchEvent('Server.buildMiddleware', ['middleware' => $middleware]); |
|
|
|
$response = $this->runner->run($middleware, $request, $this->app); |
|
|
|
if ($request instanceof ServerRequest) { |
|
$request->getSession()->close(); |
|
} |
// Bind your application to the server. |
|
$server = new Server(new Application(dirname(__DIR__) . '/config')); |
|
|
|
// Run the request/response through the application and emit the response. |
|
$server->emit($server->run()); |
|
|
* @return \PDO |
|
*/ |
|
protected function createPdo(string $dsn, array $config): PDO |
|
{ |
|
$action = fn (): PDO => new PDO( |
|
$dsn, |
|
$config['username'] ?: null, |
|
$config['password'] ?: null, |
|
$config['flags'], |
* @return \PDO |
|
*/ |
|
protected function createPdo(string $dsn, array $config): PDO |
|
{ |
|
$action = fn (): PDO => new PDO( |
|
$dsn, |
|
$config['username'] ?: null, |
|
$config['password'] ?: null, |
|
$config['flags'], |
{ |
|
$this->numRetries = 0; |
|
while (true) { |
|
try { |
|
return $action(); |
|
} catch (Exception $e) { |
|
if ( |
|
$this->numRetries < $this->maxRetries && |
|
$this->strategy->shouldRetry($e, $this->numRetries) |
); |
|
|
|
$retry = new CommandRetry(new ErrorCodeWaitStrategy(static::RETRY_ERROR_CODES, 5), 4); |
|
try { |
|
return $retry->run($action); |
|
} catch (PDOException $e) { |
|
throw new MissingConnectionException( |
|
[ |
|
'driver' => App::shortName(static::class, 'Database/Driver'), |
* @return \PDO |
|
*/ |
|
protected function createPdo(string $dsn, array $config): PDO |
|
{ |
|
$action = fn (): PDO => new PDO( |
|
$dsn, |
|
$config['username'] ?: null, |
|
$config['password'] ?: null, |
|
$config['flags'], |
If you want to customize this error message, create templates/Error/missing_connection.php