/** * {@inheritdoc} */ public function collect() { $request = $this->request; $response = $this->response; $responseHeaders = $response->headers->all(); $cookies = array(); foreach ($response->headers->getCookies() as $cookie) { $cookies[] = $this->getCookieHeader($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); } if (count($cookies) > 0) { $responseHeaders['Set-Cookie'] = $cookies; } $statusCode = $response->getStatusCode(); $data = array('format' => $request->getRequestFormat(), 'content_type' => $response->headers->get('Content-Type') ? $response->headers->get('Content-Type') : 'text/html', 'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '', 'status_code' => $statusCode, 'request_query' => $request->query->all(), 'request_request' => $request->request->all(), 'request_headers' => $request->headers->all(), 'request_server' => $request->server->all(), 'request_cookies' => $request->cookies->all(), 'response_headers' => $responseHeaders, 'path_info' => $request->getPathInfo()); if ($this->session) { $sessionAttributes = array(); foreach ($this->session->all() as $key => $value) { $sessionAttributes[$key] = $value; } $data['session_attributes'] = $sessionAttributes; } if (isset($data['request_headers']['php-auth-pw'])) { $data['request_headers']['php-auth-pw'] = '******'; } if (isset($data['request_server']['PHP_AUTH_PW'])) { $data['request_server']['PHP_AUTH_PW'] = '******'; } foreach ($data as $key => $var) { if (!is_string($data[$key])) { $data[$key] = $this->formatVar($var); } } return $data; }
/** * {@inheritdoc} */ public function collect() { $data = array(); foreach ($this->session->all() as $key => $value) { $data[$key] = is_string($value) ? $value : $this->formatVar($value); } return $data; }
/** * {@inheritdoc} */ public function collect() { $request = $this->request; $response = $this->response; $data = array('getData' => $request->query->all(), 'postData' => $request->request->all(), 'headers' => $request->headers->all(), 'cookies' => $request->cookies->all(), 'uri' => $request->getRequestUri(), 'method' => $request->getMethod(), 'responseStatus' => $response->getStatusCode()); if ($this->session) { $sessionAttributes = array(); foreach ($this->session->all() as $key => $value) { $sessionAttributes[$key] = $value; } $data['sessionData'] = $sessionAttributes; } if (isset($data['postData']['php-auth-pw'])) { $data['postData']['php-auth-pw'] = '******'; } if (isset($data['postData']['PHP_AUTH_PW'])) { $data['postData']['PHP_AUTH_PW'] = '******'; } return $data; }
/** * @param SessionInterface $session * @param Response $response */ private function postRequestHandle(SessionInterface $session, Response $response) { if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) { $id = $session->getId(); $key = 'session:' . $id; $content = $session->all(); unset($content['_token'], $content['flash']); $lastSeen = time(); $content['last_seen'] = $lastSeen; $session->set('last_seen', $lastSeen); $value = Json::dump($content); $this->redis->watch($key); $this->redis->multi(); $this->redis->set($key, $value); $this->redis->expire($key, $this->getSessionLifetimeInSeconds()); $this->redis->exec(); $cookie = new Cookie($this->key, $id, $this->getCookieExpirationDate(), $config['path'], $config['domain'], Arr::get($config, 'secure', false)); $response->headers->setCookie($cookie); } }
public function testInvalidate() { $this->session->set('invalidate', 123); $this->session->invalidate(); $this->assertEquals(array(), $this->session->all()); }
public function __invoke(array $record) { $record['extra']['session'] = $this->session->all(); return $record; }
/** * Session のログを出力する. */ protected function logSession(SessionInterface $Session) { return $this->logArray($Session->all(), '[session]'); }
/** * Removes from the session all the key-value pairs whose key has the specified prefix. * * @param string $prefix * @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session */ private function removeValues($prefix, SessionInterface $session) { foreach ($session->all() as $key => $value) { if (0 === strpos($key, $prefix)) { $session->remove($key); } } }
/** * Fetch all session data * * @return array */ public function all_userdata() { return $this->session->all(); }
/** * Gets the service container parameters. * * @return array An array of parameters * * @api */ public function all() { return $this->session->all(); }