Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
111 return $this->updateTimestamp($sessionId, $data); | 111 return $this->updateTimestamp($sessionId, $data); |
112 } | 112 } |
113 } | 113 } |
114 if (null === $this->igbinaryEmptyData) { | 114 if (null === $this->igbinaryEmptyData) { |
115 // see https://github.com/igbinary/igbinary/issues/146 | 115 // see https://github.com/igbinary/igbinary/issues/146 |
116 $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize(array()) : ''; | 116 $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize([]) : ''; |
117 } | 117 } |
118 if ('' === $data || $this->igbinaryEmptyData === $data) { | 118 if ('' === $data || $this->igbinaryEmptyData === $data) { |
119 return $this->destroy($sessionId); | 119 return $this->destroy($sessionId); |
120 } | 120 } |
121 $this->newSessionId = null; | 121 $this->newSessionId = null; |
129 public function destroy($sessionId) | 129 public function destroy($sessionId) |
130 { | 130 { |
131 if (\PHP_VERSION_ID < 70000) { | 131 if (\PHP_VERSION_ID < 70000) { |
132 $this->prefetchData = null; | 132 $this->prefetchData = null; |
133 } | 133 } |
134 if (!headers_sent() && ini_get('session.use_cookies')) { | 134 if (!headers_sent() && filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN)) { |
135 if (!$this->sessionName) { | 135 if (!$this->sessionName) { |
136 throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', get_class($this))); | 136 throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', \get_class($this))); |
137 } | 137 } |
138 $sessionCookie = sprintf(' %s=', urlencode($this->sessionName)); | 138 $sessionCookie = sprintf(' %s=', urlencode($this->sessionName)); |
139 $sessionCookieWithId = sprintf('%s%s;', $sessionCookie, urlencode($sessionId)); | 139 $sessionCookieWithId = sprintf('%s%s;', $sessionCookie, urlencode($sessionId)); |
140 $sessionCookieFound = false; | 140 $sessionCookieFound = false; |
141 $otherCookies = array(); | 141 $otherCookies = []; |
142 foreach (headers_list() as $h) { | 142 foreach (headers_list() as $h) { |
143 if (0 !== stripos($h, 'Set-Cookie:')) { | 143 if (0 !== stripos($h, 'Set-Cookie:')) { |
144 continue; | 144 continue; |
145 } | 145 } |
146 if (11 === strpos($h, $sessionCookie, 11)) { | 146 if (11 === strpos($h, $sessionCookie, 11)) { |
157 header_remove('Set-Cookie'); | 157 header_remove('Set-Cookie'); |
158 foreach ($otherCookies as $h) { | 158 foreach ($otherCookies as $h) { |
159 header($h, false); | 159 header($h, false); |
160 } | 160 } |
161 } else { | 161 } else { |
162 setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly')); | 162 setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), filter_var(ini_get('session.cookie_secure'), FILTER_VALIDATE_BOOLEAN), filter_var(ini_get('session.cookie_httponly'), FILTER_VALIDATE_BOOLEAN)); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 return $this->newSessionId === $sessionId || $this->doDestroy($sessionId); | 166 return $this->newSessionId === $sessionId || $this->doDestroy($sessionId); |
167 } | 167 } |