Attempted to set a secure cookie over a non-secure connection.
* Adds a session cookie to the response.
*/
protected function setCookie(): void
{
if($this->options['cookie_options']['secure'] && !$this->request->isSecure())
{
throw new SessionException('Attempted to set a secure cookie over a non-secure connection.');
}
$this->response->getCookies()->addSigned($this->options['name'], $this->sessionId, $this->options['cookie_ttl'], $this->options['cookie_options']);
}
/**
{
$this->sessionId = $this->generateId();
}
// Create a new / update the existing session cookie
$this->setCookie();
// Load the session data
$this->loadData();
// Create a session token if we don't have one
$this->autoCommit = $autoCommit;
$this->options = array_replace_recursive($this->options, $options);
$this->gc();
$this->start();
}
/**
* Destructor.
*/
public function __destruct()
'cookie_ttl' => $config['ttl']['cookie'],
'cookie_options' => $config['cookie_options'],
];
// Create session and return it
return new Session($container->get(Request::class), $container->get(Response::class), $this->getStore($container, $config, $classWhitelist), $options);
});
}
}
* @return object
*/
protected function closureFactory(Closure $factory, array $parameters): object
{
// Pass the container as the first parameter followed by the the provided parameters
return $factory(...[$this, ...$parameters]);
}
/**
* Creates a class instance using reflection.
*
* @param string $class Class name
public function factory($class, array $parameters = []): object
{
// Instantiate class
if($class instanceof Closure)
{
$instance = $this->closureFactory($class, $parameters);
}
else
{
$instance = $this->reflectionFactory($class, $parameters);
}
{
return $this->instances[$class];
}
// Create new instance
$instance = $this->factory($this->resolveHint($class), $parameters);
// Store the instance if it's registered as a singleton
if($reuseInstance && isset($this->hints[$class]) && $this->hints[$class]['singleton'])
{
$this->instances[$class] = $instance;
if($this->container->has($key) === false)
{
throw new ContainerException(vsprintf('Unable to resolve [ %s ].', [$key]));
}
$resolved = $this->container->get($key);
if($this->container->isSingleton($key) === false)
{
return $resolved;
}
}
return $this->get($type, $id);
}
public function get($type, $id) {
set_time_limit(0);
$this->session->put('lasturl', $this->urlBuilder->current());
$page = $this->getPersonPage($type, $id);
if (empty($page)) {
return $this->view->render('partials.error', ["errors" => ["person not found"]]);
}
$this->putPageInSession($page);
$authenticated = $this->isAuthenticated();
public function call(callable $callable, array $parameters = [])
{
if(is_array($callable))
{
$reflection = new ReflectionMethod($callable[0], $callable[1]);
return $callable(...$this->resolveParameters($reflection->getParameters(), $parameters, $reflection->getDeclaringClass(), $callable[1]));
}
return $callable(...$this->resolveParameters((new ReflectionFunction($callable))->getParameters(), $parameters));
}
}
if(empty($returnValue))
{
// The before action method didn't return any data so we can set the
// response body to whatever the route action returns
$this->response->setBody($this->container->call([$controller, $method], $parameters));
// Execute the after action method if we have one
if(method_exists($controller, 'afterAction'))
{
$this->container->call([$controller, 'afterAction']);
if($action instanceof Closure)
{
return $this->executeClosure($action, $parameters);
}
return $this->executeController($action, $parameters);
}
/**
* Dispatches the route and returns the response.
*
* @param \mako\http\routing\Route $route Route
public function dispatch(Route $route): Response
{
$onion = new Onion($this->container, null, MiddlewareInterface::class);
$this->addMiddlewareToStack($onion, [...$this->globalMiddleware, ...$route->getMiddleware()]);
return $onion->peel(fn () => $this->executeAction($route), [$this->request, $this->response]);
}
}
protected function buildCoreClosure(object $object): Closure
{
return function (...$arguments) use ($object)
{
$callable = $object instanceof Closure ? $object : [$object, $this->method];
return $callable(...$arguments);
};
}
/**
* Builds a layer closure.
*
{
$middleware = $this->middlewareFactory($layer, $middlewareParameters);
$next = $this->buildLayerClosure($middleware, $next);
}
return $next(...$parameters);
}
}
public function dispatch(Route $route): Response
{
$onion = new Onion($this->container, null, MiddlewareInterface::class);
$this->addMiddlewareToStack($onion, [...$this->globalMiddleware, ...$route->getMiddleware()]);
return $onion->peel(fn () => $this->executeAction($route), [$this->request, $this->response]);
}
}
// Route the request
$route = $this->container->get(Router::class)->route($request);
// Dispatch the request and send the response
$this->container->get(Dispatcher::class)->dispatch($route)->send();
}
}
/**
* Require init file and run the application.
*/
include __DIR__ . '/app/init.php';
Application::start(MAKO_APPLICATION_PATH)->run();
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-04-10 21:20:23 UTC |
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
(14) "54.242.220.142"
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) "45440"
GATEWAY_INTERFACE
(7) "CGI/1.1"
SERVER_PROTOCOL
(8) "HTTP/1.1"
REQUEST_METHOD
(3) "GET"
QUERY_STRING
""
REQUEST_URI
(56) "/hbrutvikling/hbr/index.php/person/daid/pf01036734002489"
SCRIPT_NAME
(27) "/hbrutvikling/hbr/index.php"
PATH_INFO
(29) "/person/daid/pf01036734002489"
PATH_TRANSLATED
(37) "/var/www/person/daid/pf01036734002489"
PHP_SELF
(56) "/hbrutvikling/hbr/index.php/person/daid/pf01036734002489"
REQUEST_TIME_FLOAT
1712784023.5896
REQUEST_TIME
1712784023