Error
Mako: 8.1.0, PHP: 8.2.6

mako\session\exceptions\SessionException

Attempted to set a secure cookie over a non-secure connection.

Stack Trace
Environment
Database
- Error mako\session\exceptions\SessionException
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/session/Session.php on line 234.
228
	 * Adds a session cookie to the response.
229
	 */
230
	protected function setCookie(): void
231
	{
232
		if($this->options['cookie_options']['secure'] && !$this->request->isSecure())
233
		{
234
			throw new SessionException('Attempted to set a secure cookie over a non-secure connection.');
235
		}
236

237
		$this->response->getCookies()->addSigned($this->options['name'], $this->sessionId, $this->options['cookie_ttl'], $this->options['cookie_options']);
238
	}
239

240
	/**
18 Vendor mako\session\Session->setCookie()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/session/Session.php on line 173.
167
		{
168
			$this->sessionId = $this->generateId();
169
		}
170

171
		// Create a new / update the existing session cookie
172

173
		$this->setCookie();
174

175
		// Load the session data
176

177
		$this->loadData();
178

179
		// Create a session token if we don't have one
17 Vendor mako\session\Session->start()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/session/Session.php on line 143.
137
		$this->autoCommit = $autoCommit;
138

139
		$this->options = array_replace_recursive($this->options, $options);
140

141
		$this->gc();
142

143
		$this->start();
144
	}
145

146
	/**
147
	 * Destructor.
148
	 */
149
	public function __destruct()
16 Vendor mako\session\Session->__construct()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/application/services/SessionService.php on line 120.
114
				'cookie_ttl'     => $config['ttl']['cookie'],
115
				'cookie_options' => $config['cookie_options'],
116
			];
117

118
			// Create session and return it
119

120
			return new Session($container->get(Request::class), $container->get(Response::class), $this->getStore($container, $config, $classWhitelist), $options);
121
		});
122
	}
123
}
124
15 Vendor mako\application\services\SessionService->mako\application\services\{closure}()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/syringe/Container.php on line 431.
425
	 * @return object
426
	 */
427
	protected function closureFactory(Closure $factory, array $parameters): object
428
	{
429
		// Pass the container as the first parameter followed by the the provided parameters
430

431
		return $factory(...[$this, ...$parameters]);
432
	}
433

434
	/**
435
	 * Creates a class instance using reflection.
436
	 *
437
	 * @param  string $class      Class name
14 Vendor mako\syringe\Container->closureFactory()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/syringe/Container.php on line 481.
475
	public function factory($class, array $parameters = []): object
476
	{
477
		// Instantiate class
478

479
		if($class instanceof Closure)
480
		{
481
			$instance = $this->closureFactory($class, $parameters);
482
		}
483
		else
484
		{
485
			$instance = $this->reflectionFactory($class, $parameters);
486
		}
487

13 Vendor mako\syringe\Container->factory()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/syringe/Container.php on line 558.
552
		{
553
			return $this->instances[$class];
554
		}
555

556
		// Create new instance
557

558
		$instance = $this->factory($this->resolveHint($class), $parameters);
559

560
		// Store the instance if it's registered as a singleton
561

562
		if($reuseInstance && isset($this->hints[$class]) && $this->hints[$class]['singleton'])
563
		{
564
			$this->instances[$class] = $instance;
12 Vendor mako\syringe\Container->get()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/syringe/traits/ContainerAwareTrait.php on line 89.
83

84
		if($this->container->has($key) === false)
85
		{
86
			throw new ContainerException(vsprintf('Unable to resolve [ %s ].', [$key]));
87
		}
88

89
		$resolved = $this->container->get($key);
90

91
		if($this->container->isSingleton($key) === false)
92
		{
93
			return $resolved;
94
		}
95

11 App mako\http\routing\Controller->__get()
Location: /var/www/hbrutvikling/hbr/app/controllers/PersonController.php on line 258.
252
        }
253
        return $this->get($type, $id);
254
    }
255

256
    public function get($type, $id) {
257
        set_time_limit(0);
258
        $this->session->put('lasturl', $this->urlBuilder->current());
259
        $page = $this->getPersonPage($type, $id);
260
        if (empty($page)) {
261
            return $this->view->render('partials.error', ["errors" => ["person not found"]]);
262
        }
263
        $this->putPageInSession($page);
264
        $authenticated = $this->isAuthenticated();
10 App app\controllers\PersonController->get()
Location: /var/www/hbrutvikling/hbr/app/controllers/PersonController.php on line 253.
247

248
    public function show($id) {
249
        $type = $this->getType($id);
250
        if ($type === NULL) {
251
            return $this->view->render('partials.error', ["errors" => ["error"]]);
252
        }
253
        return $this->get($type, $id);
254
    }
255

256
    public function get($type, $id) {
257
        set_time_limit(0);
258
        $this->session->put('lasturl', $this->urlBuilder->current());
259
        $page = $this->getPersonPage($type, $id);
9 Vendor app\controllers\PersonController->show()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/syringe/Container.php on line 597.
591
	public function call(callable $callable, array $parameters = [])
592
	{
593
		if(is_array($callable))
594
		{
595
			$reflection = new ReflectionMethod($callable[0], $callable[1]);
596

597
			return $callable(...$this->resolveParameters($reflection->getParameters(), $parameters, $reflection->getDeclaringClass(), $callable[1]));
598
		}
599

600
		return $callable(...$this->resolveParameters((new ReflectionFunction($callable))->getParameters(), $parameters));
601
	}
602
}
603
8 Vendor mako\syringe\Container->call()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/http/routing/Dispatcher.php on line 283.
277

278
		if(empty($returnValue))
279
		{
280
			// The before action method didn't return any data so we can set the
281
			// response body to whatever the route action returns
282

283
			$this->response->setBody($this->container->call([$controller, $method], $parameters));
284

285
			// Execute the after action method if we have one
286

287
			if(method_exists($controller, 'afterAction'))
288
			{
289
				$this->container->call([$controller, 'afterAction']);
7 Vendor mako\http\routing\Dispatcher->executeController()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/http/routing/Dispatcher.php on line 319.
313

314
		if($action instanceof Closure)
315
		{
316
			return $this->executeClosure($action, $parameters);
317
		}
318

319
		return $this->executeController($action, $parameters);
320
	}
321

322
	/**
323
	 * Dispatches the route and returns the response.
324
	 *
325
	 * @param  \mako\http\routing\Route $route Route
6 Vendor mako\http\routing\Dispatcher->executeAction()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/http/routing/Dispatcher.php on line 334.
328
	public function dispatch(Route $route): Response
329
	{
330
		$onion = new Onion($this->container, null, MiddlewareInterface::class);
331

332
		$this->addMiddlewareToStack($onion, [...$this->globalMiddleware, ...$route->getMiddleware()]);
333

334
		return $onion->peel(fn () => $this->executeAction($route), [$this->request, $this->response]);
335
	}
336
}
337
5 Vendor mako\http\routing\Dispatcher->mako\http\routing\{closure}()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/onion/Onion.php on line 125.
119
	protected function buildCoreClosure(object $object): Closure
120
	{
121
		return function (...$arguments) use ($object)
122
		{
123
			$callable = $object instanceof Closure ? $object : [$object, $this->method];
124

125
			return $callable(...$arguments);
126
		};
127
	}
128

129
	/**
130
	 * Builds a layer closure.
131
	 *
4 Vendor mako\onion\Onion->mako\onion\{closure}()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/onion/Onion.php on line 201.
195
		{
196
			$middleware = $this->middlewareFactory($layer, $middlewareParameters);
197

198
			$next = $this->buildLayerClosure($middleware, $next);
199
		}
200

201
		return $next(...$parameters);
202
	}
203
}
204
3 Vendor mako\onion\Onion->peel()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/http/routing/Dispatcher.php on line 334.
328
	public function dispatch(Route $route): Response
329
	{
330
		$onion = new Onion($this->container, null, MiddlewareInterface::class);
331

332
		$this->addMiddlewareToStack($onion, [...$this->globalMiddleware, ...$route->getMiddleware()]);
333

334
		return $onion->peel(fn () => $this->executeAction($route), [$this->request, $this->response]);
335
	}
336
}
337
2 Vendor mako\http\routing\Dispatcher->dispatch()
Location: /var/www/hbrutvikling/hbr/vendor/mako/framework/src/mako/application/web/Application.php on line 50.
44
		// Route the request
45

46
		$route = $this->container->get(Router::class)->route($request);
47

48
		// Dispatch the request and send the response
49

50
		$this->container->get(Dispatcher::class)->dispatch($route)->send();
51
	}
52
}
53
1 Vendor mako\application\web\Application->run()
Location: /var/www/hbrutvikling/hbr/index.php on line 10.
4

5
/**
6
 * Require init file and run the application.
7
 */
8
include __DIR__ . '/app/init.php';
9

10
Application::start(MAKO_APPLICATION_PATH)->run();
11
os Linux hbr3.nr.no 5.15.0-1039-azure #46-Ubuntu SMP Mon May 22 15:18:07 UTC 2023 x86_64
server time 2024-03-19 07:15:32 UTC
$_SERVER
  • DB_USERNAME

    (9) "hbrremote"
    

  • DB_PASSWORD

    (7) "99hbr00"
    

  • MODE

    (3) "DEV"
    

  • HTTP_ACCEPT

    (3) "*/*"
    

  • HTTP_USER_AGENT

    (9) "claudebot"
    

  • HTTP_HOST

    (10) "hbr2.nr.no"
    

  • PATH

    (70) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
    

  • SERVER_SIGNATURE

    (71) "<address>Apache/2.4.54 (Ubuntu) Server at hbr2.nr.no Port 80</address>\n"
    

  • SERVER_SOFTWARE

    (22) "Apache/2.4.54 (Ubuntu)"
    

  • SERVER_NAME

    (10) "hbr2.nr.no"
    

  • SERVER_ADDR

    (13) "156.116.18.11"
    

  • SERVER_PORT

    (2) "80"
    

  • REMOTE_ADDR

    (13) "107.23.85.179"
    

  • DOCUMENT_ROOT

    (9) "/var/www/"
    

  • REQUEST_SCHEME

    (4) "http"
    

  • CONTEXT_PREFIX

    ""
    

  • CONTEXT_DOCUMENT_ROOT

    (9) "/var/www/"
    

  • SERVER_ADMIN

    (19) "webmaster@localhost"
    

  • SCRIPT_FILENAME

    (35) "/var/www/hbrutvikling/hbr/index.php"
    

  • REMOTE_PORT

    (5) "46078"
    

  • GATEWAY_INTERFACE

    (7) "CGI/1.1"
    

  • SERVER_PROTOCOL

    (8) "HTTP/1.1"
    

  • REQUEST_METHOD

    (3) "GET"
    

  • QUERY_STRING

    ""
    

  • REQUEST_URI

    (51) "/hbrutvikling/hbr/index.php/person/pd00000009185733"
    

  • SCRIPT_NAME

    (27) "/hbrutvikling/hbr/index.php"
    

  • PATH_INFO

    (24) "/person/pd00000009185733"
    

  • PATH_TRANSLATED

    (32) "/var/www/person/pd00000009185733"
    

  • PHP_SELF

    (51) "/hbrutvikling/hbr/index.php/person/pd00000009185733"
    

  • REQUEST_TIME_FLOAT

    1710832532.9412
    

  • REQUEST_TIME

    1710832532
    

No database connections have been established.