diff options
| author | Greg Roach <fisharebest@gmail.com> | 2017-10-16 14:56:14 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2017-10-16 14:56:14 +0100 |
| commit | 542cb0023a05d14b3bf09a1c6c99f99b4256eaa2 (patch) | |
| tree | f56893fcd67f4f1c8c7da08f9344702d3b471852 /vendor/symfony | |
| parent | 14b849be814811cd4d8ef5390813857fac9669da (diff) | |
| download | webtrees-542cb0023a05d14b3bf09a1c6c99f99b4256eaa2.tar.gz webtrees-542cb0023a05d14b3bf09a1c6c99f99b4256eaa2.tar.bz2 webtrees-542cb0023a05d14b3bf09a1c6c99f99b4256eaa2.zip | |
Update vendor code
Diffstat (limited to 'vendor/symfony')
53 files changed, 203 insertions, 159 deletions
diff --git a/vendor/symfony/http-foundation/AcceptHeader.php b/vendor/symfony/http-foundation/AcceptHeader.php index 2aa91dc44c..99be6768f9 100644 --- a/vendor/symfony/http-foundation/AcceptHeader.php +++ b/vendor/symfony/http-foundation/AcceptHeader.php @@ -32,8 +32,6 @@ class AcceptHeader private $sorted = true; /** - * Constructor. - * * @param AcceptHeaderItem[] $items */ public function __construct(array $items) diff --git a/vendor/symfony/http-foundation/AcceptHeaderItem.php b/vendor/symfony/http-foundation/AcceptHeaderItem.php index fb54b4935a..e07a48aa95 100644 --- a/vendor/symfony/http-foundation/AcceptHeaderItem.php +++ b/vendor/symfony/http-foundation/AcceptHeaderItem.php @@ -39,8 +39,6 @@ class AcceptHeaderItem private $attributes = array(); /** - * Constructor. - * * @param string $value * @param array $attributes */ @@ -67,7 +65,7 @@ class AcceptHeaderItem $lastNullAttribute = null; foreach ($bits as $bit) { - if (($start = substr($bit, 0, 1)) === ($end = substr($bit, -1)) && ($start === '"' || $start === '\'')) { + if (($start = substr($bit, 0, 1)) === ($end = substr($bit, -1)) && ('"' === $start || '\'' === $start)) { $attributes[$lastNullAttribute] = substr($bit, 1, -1); } elseif ('=' === $end) { $lastNullAttribute = $bit = substr($bit, 0, -1); @@ -78,7 +76,7 @@ class AcceptHeaderItem } } - return new self(($start = substr($value, 0, 1)) === ($end = substr($value, -1)) && ($start === '"' || $start === '\'') ? substr($value, 1, -1) : $value, $attributes); + return new self(($start = substr($value, 0, 1)) === ($end = substr($value, -1)) && ('"' === $start || '\'' === $start) ? substr($value, 1, -1) : $value, $attributes); } /** diff --git a/vendor/symfony/http-foundation/BinaryFileResponse.php b/vendor/symfony/http-foundation/BinaryFileResponse.php index 5f18aa9309..4394863e9e 100644 --- a/vendor/symfony/http-foundation/BinaryFileResponse.php +++ b/vendor/symfony/http-foundation/BinaryFileResponse.php @@ -36,8 +36,6 @@ class BinaryFileResponse extends Response protected $deleteFileAfterSend = false; /** - * Constructor. - * * @param \SplFileInfo|string $file The file to stream * @param int $status The response status code * @param array $headers An array of response headers @@ -150,19 +148,19 @@ class BinaryFileResponse extends Response * Sets the Content-Disposition header with the given filename. * * @param string $disposition ResponseHeaderBag::DISPOSITION_INLINE or ResponseHeaderBag::DISPOSITION_ATTACHMENT - * @param string $filename Optionally use this filename instead of the real name of the file + * @param string $filename Optionally use this UTF-8 encoded filename instead of the real name of the file * @param string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename * * @return $this */ public function setContentDisposition($disposition, $filename = '', $filenameFallback = '') { - if ($filename === '') { + if ('' === $filename) { $filename = $this->file->getFilename(); } if ('' === $filenameFallback && (!preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) { - $encoding = mb_detect_encoding($filename, null, true); + $encoding = mb_detect_encoding($filename, null, true) ?: '8bit'; for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) { $char = mb_substr($filename, $i, 1, $encoding); @@ -217,7 +215,7 @@ class BinaryFileResponse extends Response if (false === $path) { $path = $this->file->getPathname(); } - if (strtolower($type) === 'x-accel-redirect') { + if ('x-accel-redirect' === strtolower($type)) { // Do X-Accel-Mapping substitutions. // @link http://wiki.nginx.org/X-accel#X-Accel-Redirect foreach (explode(',', $request->headers->get('X-Accel-Mapping', '')) as $mapping) { @@ -256,7 +254,7 @@ class BinaryFileResponse extends Response if ($start < 0 || $end > $fileSize - 1) { $this->setStatusCode(416); $this->headers->set('Content-Range', sprintf('bytes */%s', $fileSize)); - } elseif ($start !== 0 || $end !== $fileSize - 1) { + } elseif (0 !== $start || $end !== $fileSize - 1) { $this->maxlen = $end < $fileSize ? $end - $start + 1 : -1; $this->offset = $start; diff --git a/vendor/symfony/http-foundation/Cookie.php b/vendor/symfony/http-foundation/Cookie.php index a2139ff6ba..4519a6adae 100644 --- a/vendor/symfony/http-foundation/Cookie.php +++ b/vendor/symfony/http-foundation/Cookie.php @@ -81,8 +81,6 @@ class Cookie } /** - * Constructor. - * * @param string $name The name of the cookie * @param string|null $value The value of the cookie * @param int|string|\DateTimeInterface $expire The time the cookie expires diff --git a/vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php b/vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php index 41f7a46250..3b8e41d4a2 100644 --- a/vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php +++ b/vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php @@ -19,8 +19,6 @@ namespace Symfony\Component\HttpFoundation\File\Exception; class AccessDeniedException extends FileException { /** - * Constructor. - * * @param string $path The path to the accessed file */ public function __construct($path) diff --git a/vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php b/vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php index ac90d4035b..bfcc37ec66 100644 --- a/vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php +++ b/vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php @@ -19,8 +19,6 @@ namespace Symfony\Component\HttpFoundation\File\Exception; class FileNotFoundException extends FileException { /** - * Constructor. - * * @param string $path The path to the file that was not found */ public function __construct($path) diff --git a/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php index f917a06d6c..c2ac6768c3 100644 --- a/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php @@ -24,8 +24,6 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface private $cmd; /** - * Constructor. - * * The $cmd pattern must contain a "%s" string that will be replaced * with the file name to guess. * diff --git a/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php index 6fee94798c..9b42835e43 100644 --- a/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php @@ -24,8 +24,6 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface private $magicFile; /** - * Constructor. - * * @param string $magicFile A magic file to use with the finfo instance * * @see http://www.php.net/manual/en/function.finfo-open.php diff --git a/vendor/symfony/http-foundation/File/UploadedFile.php b/vendor/symfony/http-foundation/File/UploadedFile.php index 10837726cd..9a2d28491a 100644 --- a/vendor/symfony/http-foundation/File/UploadedFile.php +++ b/vendor/symfony/http-foundation/File/UploadedFile.php @@ -198,7 +198,7 @@ class UploadedFile extends File */ public function isValid() { - $isOk = $this->error === UPLOAD_ERR_OK; + $isOk = UPLOAD_ERR_OK === $this->error; return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname()); } @@ -259,8 +259,11 @@ class UploadedFile extends File switch (substr($iniMax, -1)) { case 't': $max *= 1024; + // no break case 'g': $max *= 1024; + // no break case 'm': $max *= 1024; + // no break case 'k': $max *= 1024; } @@ -285,7 +288,7 @@ class UploadedFile extends File ); $errorCode = $this->error; - $maxFilesize = $errorCode === UPLOAD_ERR_INI_SIZE ? self::getMaxFilesize() / 1024 : 0; + $maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0; $message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.'; return sprintf($message, $this->getClientOriginalName(), $maxFilesize); diff --git a/vendor/symfony/http-foundation/FileBag.php b/vendor/symfony/http-foundation/FileBag.php index e17a9057b7..722ec2a9c4 100644 --- a/vendor/symfony/http-foundation/FileBag.php +++ b/vendor/symfony/http-foundation/FileBag.php @@ -24,8 +24,6 @@ class FileBag extends ParameterBag private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); /** - * Constructor. - * * @param array $parameters An array of HTTP files */ public function __construct(array $parameters = array()) @@ -69,7 +67,7 @@ class FileBag extends ParameterBag * * @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information * - * @return UploadedFile|UploadedFile[] A (multi-dimensional) array of UploadedFile instances + * @return UploadedFile[]|UploadedFile|null A (multi-dimensional) array of UploadedFile instances */ protected function convertFileInformation($file) { @@ -89,7 +87,7 @@ class FileBag extends ParameterBag $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); } } else { - $file = array_map(array($this, 'convertFileInformation'), $file); + $file = array_filter(array_map(array($this, 'convertFileInformation'), $file)); } } diff --git a/vendor/symfony/http-foundation/HeaderBag.php b/vendor/symfony/http-foundation/HeaderBag.php index 3cc9e70243..e0b51ad125 100644 --- a/vendor/symfony/http-foundation/HeaderBag.php +++ b/vendor/symfony/http-foundation/HeaderBag.php @@ -22,8 +22,6 @@ class HeaderBag implements \IteratorAggregate, \Countable protected $cacheControl = array(); /** - * Constructor. - * * @param array $headers An array of HTTP headers */ public function __construct(array $headers = array()) diff --git a/vendor/symfony/http-foundation/IpUtils.php b/vendor/symfony/http-foundation/IpUtils.php index eba603b15d..dc6d3ec818 100644 --- a/vendor/symfony/http-foundation/IpUtils.php +++ b/vendor/symfony/http-foundation/IpUtils.php @@ -75,7 +75,7 @@ class IpUtils if (false !== strpos($ip, '/')) { list($address, $netmask) = explode('/', $ip, 2); - if ($netmask === '0') { + if ('0' === $netmask) { return self::$checkedIps[$cacheKey] = filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); } diff --git a/vendor/symfony/http-foundation/JsonResponse.php b/vendor/symfony/http-foundation/JsonResponse.php index cf1a11ea2c..137ac33c46 100644 --- a/vendor/symfony/http-foundation/JsonResponse.php +++ b/vendor/symfony/http-foundation/JsonResponse.php @@ -145,16 +145,22 @@ class JsonResponse extends Response // If only PHP did the same... $data = json_encode($data, $this->encodingOptions); } else { - try { - // PHP 5.4 and up wrap exceptions thrown by JsonSerializable - // objects in a new exception that needs to be removed. - // Fortunately, PHP 5.5 and up do not trigger any warning anymore. - $data = json_encode($data, $this->encodingOptions); - } catch (\Exception $e) { - if ('Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) { - throw $e->getPrevious() ?: $e; + if (!interface_exists('JsonSerializable', false)) { + set_error_handler(function () { return false; }); + try { + $data = @json_encode($data, $this->encodingOptions); + } finally { + restore_error_handler(); + } + } else { + try { + $data = json_encode($data, $this->encodingOptions); + } catch (\Exception $e) { + if ('Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) { + throw $e->getPrevious() ?: $e; + } + throw $e; } - throw $e; } } diff --git a/vendor/symfony/http-foundation/ParameterBag.php b/vendor/symfony/http-foundation/ParameterBag.php index c0b36479f5..3d278914e6 100644 --- a/vendor/symfony/http-foundation/ParameterBag.php +++ b/vendor/symfony/http-foundation/ParameterBag.php @@ -26,8 +26,6 @@ class ParameterBag implements \IteratorAggregate, \Countable protected $parameters; /** - * Constructor. - * * @param array $parameters An array of parameters */ public function __construct(array $parameters = array()) diff --git a/vendor/symfony/http-foundation/Request.php b/vendor/symfony/http-foundation/Request.php index 6fd0707b05..28e78c0a20 100644 --- a/vendor/symfony/http-foundation/Request.php +++ b/vendor/symfony/http-foundation/Request.php @@ -243,8 +243,6 @@ class Request ); /** - * Constructor. - * * @param array $query The GET parameters * @param array $request The POST parameters * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) @@ -463,22 +461,22 @@ class Request public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) { $dup = clone $this; - if ($query !== null) { + if (null !== $query) { $dup->query = new ParameterBag($query); } - if ($request !== null) { + if (null !== $request) { $dup->request = new ParameterBag($request); } - if ($attributes !== null) { + if (null !== $attributes) { $dup->attributes = new ParameterBag($attributes); } - if ($cookies !== null) { + if (null !== $cookies) { $dup->cookies = new ParameterBag($cookies); } - if ($files !== null) { + if (null !== $files) { $dup->files = new FileBag($files); } - if ($server !== null) { + if (null !== $server) { $dup->server = new ServerBag($server); $dup->headers = new HeaderBag($dup->server->getHeaders()); } @@ -1022,7 +1020,7 @@ class Request return $this->server->get('SERVER_PORT'); } - if ($host[0] === '[') { + if ('[' === $host[0]) { $pos = strpos($host, ':', strrpos($host, ']')); } else { $pos = strrpos($host, ':'); @@ -1084,7 +1082,7 @@ class Request $scheme = $this->getScheme(); $port = $this->getPort(); - if (('http' == $scheme && $port == 80) || ('https' == $scheme && $port == 443)) { + if (('http' == $scheme && 80 == $port) || ('https' == $scheme && 443 == $port)) { return $this->getHost(); } @@ -1709,7 +1707,7 @@ class Request } } else { for ($i = 0, $max = count($codes); $i < $max; ++$i) { - if ($i === 0) { + if (0 === $i) { $lang = strtolower($codes[0]); } else { $lang .= '_'.strtoupper($codes[$i]); @@ -1804,7 +1802,7 @@ class Request // IIS with ISAPI_Rewrite $requestUri = $this->headers->get('X_REWRITE_URL'); $this->headers->remove('X_REWRITE_URL'); - } elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') { + } elseif ('1' == $this->server->get('IIS_WasUrlRewritten') && '' != $this->server->get('UNENCODED_URL')) { // IIS7 with URL Rewrite: make sure we get the unencoded URL (double slash problem) $requestUri = $this->server->get('UNENCODED_URL'); $this->server->remove('UNENCODED_URL'); @@ -1813,7 +1811,7 @@ class Request $requestUri = $this->server->get('REQUEST_URI'); // HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, only use URL path $schemeAndHttpHost = $this->getSchemeAndHttpHost(); - if (strpos($requestUri, $schemeAndHttpHost) === 0) { + if (0 === strpos($requestUri, $schemeAndHttpHost)) { $requestUri = substr($requestUri, strlen($schemeAndHttpHost)); } } elseif ($this->server->has('ORIG_PATH_INFO')) { @@ -1890,7 +1888,7 @@ class Request // If using mod_rewrite or ISAPI_Rewrite strip the script filename // out of baseUrl. $pos !== 0 makes sure it is not matching a value // from PATH_INFO or QUERY_STRING - if (strlen($requestUri) >= strlen($baseUrl) && (false !== $pos = strpos($requestUri, $baseUrl)) && $pos !== 0) { + if (strlen($requestUri) >= strlen($baseUrl) && (false !== $pos = strpos($requestUri, $baseUrl)) && 0 !== $pos) { $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl)); } diff --git a/vendor/symfony/http-foundation/RequestMatcher.php b/vendor/symfony/http-foundation/RequestMatcher.php index aa4f67b58b..076d077c7d 100644 --- a/vendor/symfony/http-foundation/RequestMatcher.php +++ b/vendor/symfony/http-foundation/RequestMatcher.php @@ -173,6 +173,6 @@ class RequestMatcher implements RequestMatcherInterface // Note to future implementors: add additional checks above the // foreach above or else your check might not be run! - return count($this->ips) === 0; + return 0 === count($this->ips); } } diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php index 4af1e0bae2..ced0afa6ca 100644 --- a/vendor/symfony/http-foundation/Response.php +++ b/vendor/symfony/http-foundation/Response.php @@ -187,8 +187,6 @@ class Response ); /** - * Constructor. - * * @param mixed $content The response content, see setContent() * @param int $status The response status code * @param array $headers An array of response headers @@ -455,12 +453,12 @@ class Response /** * Sets the response status code. * - * @param int $code HTTP status code - * @param mixed $text HTTP status text - * * If the status text is null it will be automatically populated for the known * status codes and left empty otherwise. * + * @param int $code HTTP status code + * @param mixed $text HTTP status text + * * @return $this * * @throws \InvalidArgumentException When the HTTP status code is not valid @@ -1261,7 +1259,7 @@ class Response // PHP_OUTPUT_HANDLER_* are not defined on HHVM 3.3 $flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1; - while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || $flags === ($s['flags'] & $flags) : $s['del'])) { + while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || ($s['flags'] & $flags) === $flags : $s['del'])) { if ($flush) { ob_end_flush(); } else { @@ -1279,7 +1277,7 @@ class Response */ protected function ensureIEOverSSLCompatibility(Request $request) { - if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 && true === $request->isSecure()) { + if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && 1 == preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) && true === $request->isSecure()) { if ((int) preg_replace('/(MSIE )(.*?);/', '$2', $match[0]) < 9) { $this->headers->remove('Cache-Control'); } diff --git a/vendor/symfony/http-foundation/ResponseHeaderBag.php b/vendor/symfony/http-foundation/ResponseHeaderBag.php index df2931be05..7b91e4f136 100644 --- a/vendor/symfony/http-foundation/ResponseHeaderBag.php +++ b/vendor/symfony/http-foundation/ResponseHeaderBag.php @@ -40,8 +40,6 @@ class ResponseHeaderBag extends HeaderBag protected $headerNames = array(); /** - * Constructor. - * * @param array $headers An array of HTTP headers */ public function __construct(array $headers = array()) diff --git a/vendor/symfony/http-foundation/ServerBag.php b/vendor/symfony/http-foundation/ServerBag.php index 0d38c08ac0..19d2022ef7 100644 --- a/vendor/symfony/http-foundation/ServerBag.php +++ b/vendor/symfony/http-foundation/ServerBag.php @@ -68,7 +68,7 @@ class ServerBag extends ParameterBag if (0 === stripos($authorizationHeader, 'basic ')) { // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic $exploded = explode(':', base64_decode(substr($authorizationHeader, 6)), 2); - if (count($exploded) == 2) { + if (2 == count($exploded)) { list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded; } } elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader, 'digest '))) { diff --git a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php index af292e37a4..57c297197b 100644 --- a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php +++ b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php @@ -29,8 +29,6 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta protected $attributes = array(); /** - * Constructor. - * * @param string $storageKey The key used to store attributes in the session */ public function __construct($storageKey = '_sf2_attributes') diff --git a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php index d797a6f238..e149801aad 100644 --- a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php +++ b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php @@ -27,8 +27,6 @@ class NamespacedAttributeBag extends AttributeBag private $namespaceCharacter; /** - * Constructor. - * * @param string $storageKey Session storage key * @param string $namespaceCharacter Namespace character to use in keys */ @@ -109,7 +107,7 @@ class NamespacedAttributeBag extends AttributeBag protected function &resolveAttributePath($name, $writeContext = false) { $array = &$this->attributes; - $name = (strpos($name, $this->namespaceCharacter) === 0) ? substr($name, 1) : $name; + $name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name; // Check if there is anything to do, else return if (!$name) { diff --git a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php index ddd603fdd1..8110aee0cf 100644 --- a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php +++ b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php @@ -35,8 +35,6 @@ class AutoExpireFlashBag implements FlashBagInterface private $storageKey; /** - * Constructor. - * * @param string $storageKey The key used to store flashes in the session */ public function __construct($storageKey = '_sf2_flashes') diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php index 85b4f00b00..a86dc6c1a2 100644 --- a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php +++ b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php @@ -35,8 +35,6 @@ class FlashBag implements FlashBagInterface private $storageKey; /** - * Constructor. - * * @param string $storageKey The key used to store flashes in the session */ public function __construct($storageKey = '_sf2_flashes') diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php index 70bcf3e090..f063651a18 100644 --- a/vendor/symfony/http-foundation/Session/Session.php +++ b/vendor/symfony/http-foundation/Session/Session.php @@ -19,8 +19,6 @@ use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; /** - * Session. - * * @author Fabien Potencier <fabien@symfony.com> * @author Drak <drak@zikula.org> */ @@ -44,8 +42,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable private $attributeName; /** - * Constructor. - * * @param SessionStorageInterface $storage A SessionStorageInterface instance * @param AttributeBagInterface $attributes An AttributeBagInterface instance, (defaults null for default AttributeBag) * @param FlashBagInterface $flashes A FlashBagInterface instance (defaults null for default FlashBag) diff --git a/vendor/symfony/http-foundation/Session/SessionInterface.php b/vendor/symfony/http-foundation/Session/SessionInterface.php index d3fcd2eec4..172c9b457f 100644 --- a/vendor/symfony/http-foundation/Session/SessionInterface.php +++ b/vendor/symfony/http-foundation/Session/SessionInterface.php @@ -25,7 +25,7 @@ interface SessionInterface * * @return bool True if session started * - * @throws \RuntimeException If session fails to start. + * @throws \RuntimeException if session fails to start */ public function start(); diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php index 962a3878d9..d31aa7667e 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * MemcacheSessionHandler. - * * @author Drak <drak@zikula.org> */ class MemcacheSessionHandler implements \SessionHandlerInterface @@ -34,8 +32,6 @@ class MemcacheSessionHandler implements \SessionHandlerInterface private $prefix; /** - * Constructor. - * * List of available options: * * prefix: The prefix to use for the memcache keys in order to avoid collision * * expiretime: The time to live in seconds @@ -95,7 +91,9 @@ class MemcacheSessionHandler implements \SessionHandlerInterface */ public function destroy($sessionId) { - return $this->memcache->delete($this->prefix.$sessionId); + $this->memcache->delete($this->prefix.$sessionId); + + return true; } /** diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php index 76b08e2db9..3bbde5420d 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * MemcachedSessionHandler. - * * Memcached based session storage handler based on the Memcached class * provided by the PHP memcached extension. * @@ -39,8 +37,6 @@ class MemcachedSessionHandler implements \SessionHandlerInterface private $prefix; /** - * Constructor. - * * List of available options: * * prefix: The prefix to use for the memcached keys in order to avoid collision * * expiretime: The time to live in seconds @@ -101,7 +97,9 @@ class MemcachedSessionHandler implements \SessionHandlerInterface */ public function destroy($sessionId) { - return $this->memcached->delete($this->prefix.$sessionId); + $result = $this->memcached->delete($this->prefix.$sessionId); + + return $result || \Memcached::RES_NOTFOUND == $this->memcached->getResultCode(); } /** diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php index 8408f000cd..f140939dbd 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * MongoDB session handler. - * * @author Markus Bachmann <markus.bachmann@bachi.biz> */ class MongoDbSessionHandler implements \SessionHandlerInterface @@ -34,8 +32,6 @@ class MongoDbSessionHandler implements \SessionHandlerInterface private $options; /** - * Constructor. - * * List of available options: * * database: The name of the database [required] * * collection: The name of the collection [required] @@ -122,7 +118,7 @@ class MongoDbSessionHandler implements \SessionHandlerInterface */ public function gc($maxlifetime) { - $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove'; + $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteMany' : 'remove'; $this->getCollection()->$methodName(array( $this->options['expiry_field'] => array('$lt' => $this->createDateTime()), diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php index 1be0a39837..d6ad93749f 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * NativeFileSessionHandler. - * * Native session handler using PHP's built in file storage. * * @author Drak <drak@zikula.org> @@ -21,8 +19,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; class NativeFileSessionHandler extends NativeSessionHandler { /** - * Constructor. - * * @param string $savePath Path of directory to save session files * Default null will leave setting as defined by PHP. * '/path', 'N;/path', or 'N;octal-mode;/path diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php index 8909a5f401..5cdac63939 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php @@ -148,8 +148,6 @@ class PdoSessionHandler implements \SessionHandlerInterface private $gcCalled = false; /** - * Constructor. - * * You can either pass an existing database connection as PDO instance or * pass a DSN string that will be used to lazy-connect to the database * when the session is actually used. Furthermore it's possible to pass null @@ -580,11 +578,11 @@ class PdoSessionHandler implements \SessionHandlerInterface return $releaseStmt; case 'pgsql': // Obtaining an exclusive session level advisory lock requires an integer key. - // So we convert the HEX representation of the session id to an integer. - // Since integers are signed, we have to skip one hex char to fit in the range. - if (4 === PHP_INT_SIZE) { - $sessionInt1 = hexdec(substr($sessionId, 0, 7)); - $sessionInt2 = hexdec(substr($sessionId, 7, 7)); + // When session.sid_bits_per_character > 4, the session id can contain non-hex-characters. + // So we cannot just use hexdec(). + if (4 === \PHP_INT_SIZE) { + $sessionInt1 = $this->convertStringToInt($sessionId); + $sessionInt2 = $this->convertStringToInt(substr($sessionId, 4, 4)); $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key1, :key2)'); $stmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT); @@ -595,7 +593,7 @@ class PdoSessionHandler implements \SessionHandlerInterface $releaseStmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT); $releaseStmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT); } else { - $sessionBigInt = hexdec(substr($sessionId, 0, 15)); + $sessionBigInt = $this->convertStringToInt($sessionId); $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key)'); $stmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT); @@ -614,6 +612,27 @@ class PdoSessionHandler implements \SessionHandlerInterface } /** + * Encodes the first 4 (when PHP_INT_SIZE == 4) or 8 characters of the string as an integer. + * + * Keep in mind, PHP integers are signed. + * + * @param string $string + * + * @return int + */ + private function convertStringToInt($string) + { + if (4 === \PHP_INT_SIZE) { + return (ord($string[3]) << 24) + (ord($string[2]) << 16) + (ord($string[1]) << 8) + ord($string[0]); + } + + $int1 = (ord($string[7]) << 24) + (ord($string[6]) << 16) + (ord($string[5]) << 8) + ord($string[4]); + $int2 = (ord($string[3]) << 24) + (ord($string[2]) << 16) + (ord($string[1]) << 8) + ord($string[0]); + + return $int2 + ($int1 << 32); + } + + /** * Return a locking or nonlocking SQL query to read session information. * * @return string The SQL string diff --git a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php index 322dd560f8..6f59af4869 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php +++ b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php @@ -54,8 +54,6 @@ class MetadataBag implements SessionBagInterface private $updateThreshold; /** - * Constructor. - * * @param string $storageKey The key used to store bag in the session * @param int $updateThreshold The time to wait between two UPDATED updates */ diff --git a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php index 348fd23018..0349a43367 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php @@ -63,8 +63,6 @@ class MockArraySessionStorage implements SessionStorageInterface protected $bags = array(); /** - * Constructor. - * * @param string $name Session name * @param MetadataBag $metaBag MetadataBag instance */ diff --git a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php index 71f9e55512..8c1bf73cae 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php @@ -30,8 +30,6 @@ class MockFileSessionStorage extends MockArraySessionStorage private $savePath; /** - * Constructor. - * * @param string $savePath Path of directory to save session files * @param string $name Session name * @param MetadataBag $metaBag MetadataBag instance diff --git a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php index 97161b8d0f..8f4ebefaab 100644 --- a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php @@ -52,8 +52,6 @@ class NativeSessionStorage implements SessionStorageInterface protected $metadataBag; /** - * Constructor. - * * Depending on how you want the storage driver to behave you probably * want to override this constructor entirely. * diff --git a/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php index 6f02a7fd73..9420d086ca 100644 --- a/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php @@ -22,8 +22,6 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandle class PhpBridgeSessionStorage extends NativeSessionStorage { /** - * Constructor. - * * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler * @param MetadataBag $metaBag MetadataBag */ diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php index 0db34aa28d..21ed1ada04 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php +++ b/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php @@ -12,17 +12,12 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; /** - * NativeProxy. - * * This proxy is built-in session handlers in PHP 5.3.x * * @author Drak <drak@zikula.org> */ class NativeProxy extends AbstractProxy { - /** - * Constructor. - */ public function __construct() { // this makes an educated guess as to what the handler is since it should already be set. diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php index 68ed713c22..be39f6baeb 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -12,8 +12,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; /** - * SessionHandler proxy. - * * @author Drak <drak@zikula.org> */ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface @@ -24,8 +22,6 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf protected $handler; /** - * Constructor. - * * @param \SessionHandlerInterface $handler */ public function __construct(\SessionHandlerInterface $handler) diff --git a/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php b/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php index 34f6c4633f..097583d5a5 100644 --- a/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php +++ b/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php @@ -26,7 +26,7 @@ interface SessionStorageInterface * * @return bool True if started * - * @throws \RuntimeException If something goes wrong starting the session. + * @throws \RuntimeException if something goes wrong starting the session */ public function start(); @@ -104,8 +104,8 @@ interface SessionStorageInterface * a real PHP session would interfere with testing, in which case * it should actually persist the session data if required. * - * @throws \RuntimeException If the session is saved without being started, or if the session - * is already closed. + * @throws \RuntimeException if the session is saved without being started, or if the session + * is already closed */ public function save(); diff --git a/vendor/symfony/http-foundation/StreamedResponse.php b/vendor/symfony/http-foundation/StreamedResponse.php index 928531309a..3cbbfc5f4f 100644 --- a/vendor/symfony/http-foundation/StreamedResponse.php +++ b/vendor/symfony/http-foundation/StreamedResponse.php @@ -31,8 +31,6 @@ class StreamedResponse extends Response private $headersSent; /** - * Constructor. - * * @param callable|null $callback A valid PHP callback or null to set it later * @param int $status The response status code * @param array $headers An array of response headers diff --git a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php index 89e078ca2a..1b9e58991c 100644 --- a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php @@ -69,6 +69,17 @@ class BinaryFileResponseTest extends ResponseTestCase $this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%C3%B6%C3%B6.html', $response->headers->get('Content-Disposition')); } + public function testSetContentDispositionGeneratesSafeFallbackFilenameForWronglyEncodedFilename() + { + $response = new BinaryFileResponse(__FILE__); + + $iso88591EncodedFilename = utf8_decode('föö.html'); + $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $iso88591EncodedFilename); + + // the parameter filename* is invalid in this case (rawurldecode('f%F6%F6') does not provide a UTF-8 string but an ISO-8859-1 encoded one) + $this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%F6%F6.html', $response->headers->get('Content-Disposition')); + } + /** * @dataProvider provideRanges */ diff --git a/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php b/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php index 5a2b7a21c3..b3f1f026a5 100644 --- a/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php +++ b/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php @@ -71,7 +71,7 @@ class MimeTypeTest extends TestCase touch($path); @chmod($path, 0333); - if (substr(sprintf('%o', fileperms($path)), -4) == '0333') { + if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) { $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException'); MimeTypeGuesser::getInstance()->guess($path); } else { diff --git a/vendor/symfony/http-foundation/Tests/FileBagTest.php b/vendor/symfony/http-foundation/Tests/FileBagTest.php index e7defa6777..7d2902d325 100644 --- a/vendor/symfony/http-foundation/Tests/FileBagTest.php +++ b/vendor/symfony/http-foundation/Tests/FileBagTest.php @@ -60,6 +60,19 @@ class FileBagTest extends TestCase $this->assertNull($bag->get('file')); } + public function testShouldRemoveEmptyUploadedFilesForMultiUpload() + { + $bag = new FileBag(array('file' => array( + 'name' => array(''), + 'type' => array(''), + 'tmp_name' => array(''), + 'error' => array(UPLOAD_ERR_NO_FILE), + 'size' => array(0), + ))); + + $this->assertSame(array(), $bag->get('file')); + } + public function testShouldConvertUploadedFilesWithPhpBug() { $tmpFile = $this->createTempFile(); diff --git a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php index c8b9377895..201839f89c 100644 --- a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php @@ -228,6 +228,10 @@ class JsonResponseTest extends TestCase */ public function testSetContentJsonSerializeError() { + if (!interface_exists('JsonSerializable', false)) { + $this->markTestSkipped('JsonSerializable is required.'); + } + $serializable = new JsonSerializableObject(); JsonResponse::create($serializable); @@ -242,7 +246,7 @@ class JsonResponseTest extends TestCase } } -if (interface_exists('JsonSerializable')) { +if (interface_exists('JsonSerializable', false)) { class JsonSerializableObject implements \JsonSerializable { public function jsonSerialize() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index 74366863f7..b5fee8eba4 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -285,7 +285,7 @@ class MongoDbSessionHandlerTest extends TestCase ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); - $methodName = phpversion('mongodb') ? 'deleteOne' : 'remove'; + $methodName = phpversion('mongodb') ? 'deleteMany' : 'remove'; $collection->expects($this->once()) ->method($methodName) diff --git a/vendor/symfony/http-foundation/composer.json b/vendor/symfony/http-foundation/composer.json index dfa25f79ec..a964975ecb 100644 --- a/vendor/symfony/http-foundation/composer.json +++ b/vendor/symfony/http-foundation/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-mbstring": "~1.1" }, "require-dev": { diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index 48fc3ddf3a..e184b21041 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -28,7 +28,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } } } diff --git a/vendor/symfony/polyfill-php70/README.md b/vendor/symfony/polyfill-php70/README.md index d3a3a53289..279c5af27a 100644 --- a/vendor/symfony/polyfill-php70/README.md +++ b/vendor/symfony/polyfill-php70/README.md @@ -9,6 +9,9 @@ This component provides functions unavailable in releases prior to PHP 7.0: - `random_bytes` and `random_int` (from [paragonie/random_compat](https://github.com/paragonie/random_compat)) - [`*Error` throwable classes](http://php.net/Error) +Also, it provides a constant added to PHP 7.0: +- [`PHP_INT_MIN`](http://php.net/manual/en/reserved.constants.php#constant.php-int-min) + More information can be found in the [main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). diff --git a/vendor/symfony/polyfill-php70/composer.json b/vendor/symfony/polyfill-php70/composer.json index 3ce13ad1a2..2da3f6d82d 100644 --- a/vendor/symfony/polyfill-php70/composer.json +++ b/vendor/symfony/polyfill-php70/composer.json @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } } } diff --git a/vendor/symfony/polyfill-php71/composer.json b/vendor/symfony/polyfill-php71/composer.json index b89ccd03b4..920b6b45da 100644 --- a/vendor/symfony/polyfill-php71/composer.json +++ b/vendor/symfony/polyfill-php71/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } } } diff --git a/vendor/symfony/polyfill-php72/Php72.php b/vendor/symfony/polyfill-php72/Php72.php index dee935e7e2..5925c1b9ab 100644 --- a/vendor/symfony/polyfill-php72/Php72.php +++ b/vendor/symfony/polyfill-php72/Php72.php @@ -13,20 +13,13 @@ namespace Symfony\Polyfill\Php72; /** * @author Nicolas Grekas <p@tchwork.com> + * @author Dariusz Rumiński <dariusz.ruminski@gmail.com> * * @internal */ final class Php72 { - public static function stream_isatty($stream) - { - return function_exists('posix_isatty') && @posix_isatty($stream); - } - - public static function sapi_windows_vt100_support() - { - return false; - } + private static $hashMask; public static function utf8_encode($s) { @@ -70,4 +63,57 @@ final class Php72 return substr($s, 0, $j); } + + public static function php_os_family() + { + if ('\\' === DIRECTORY_SEPARATOR) { + return 'Windows'; + } + + $map = array( + 'Darwin' => 'Darwin', + 'DragonFly' => 'BSD', + 'FreeBSD' => 'BSD', + 'NetBSD' => 'BSD', + 'OpenBSD' => 'BSD', + 'Linux' => 'Linux', + 'SunOS' => 'Solaris', + ); + + return isset($map[PHP_OS]) ? $map[PHP_OS] : 'Unknown'; + } + + public static function spl_object_id($object) + { + if (null === self::$hashMask) { + self::initHashMask(); + } + if (null === $hash = spl_object_hash($object)) { + return; + } + + return self::$hashMask ^ hexdec(substr($hash, 16 - \PHP_INT_SIZE, \PHP_INT_SIZE)); + } + + private static function initHashMask() + { + $obj = (object) array(); + self::$hashMask = -1; + + // check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below + $obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush'); + foreach (debug_backtrace(\PHP_VERSION_ID >= 50400 ? DEBUG_BACKTRACE_IGNORE_ARGS : false) as $frame) { + if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) { + $frame['line'] = 0; + break; + } + } + if (!empty($frame['line'])) { + ob_start(); + debug_zval_dump($obj); + self::$hashMask = (int) substr(ob_get_clean(), 17); + } + + self::$hashMask ^= hexdec(substr(spl_object_hash($obj), 16 - \PHP_INT_SIZE, \PHP_INT_SIZE)); + } } diff --git a/vendor/symfony/polyfill-php72/README.md b/vendor/symfony/polyfill-php72/README.md index b6445f5f5e..82c45f7a58 100644 --- a/vendor/symfony/polyfill-php72/README.md +++ b/vendor/symfony/polyfill-php72/README.md @@ -3,6 +3,7 @@ Symfony Polyfill / Php72 This component provides functions added to PHP 7.2 core: +- [`spl_object_id`](https://php.net/spl_object_id) - [`stream_isatty`](https://php.net/stream_isatty) On Windows only: @@ -14,6 +15,9 @@ Moved to core since 7.2 (was in the optional XML extension earlier): - [`utf8_encode`](https://php.net/utf8_encode) - [`utf8_decode`](https://php.net/utf8_decode) +Also, it provides a constant added to PHP 7.2: +- [`PHP_OS_FAMILY`](http://php.net/manual/en/reserved.constants.php#constant.php-os-family) + More information can be found in the [main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). diff --git a/vendor/symfony/polyfill-php72/bootstrap.php b/vendor/symfony/polyfill-php72/bootstrap.php index 1ad7f16ce4..b6522e84f4 100644 --- a/vendor/symfony/polyfill-php72/bootstrap.php +++ b/vendor/symfony/polyfill-php72/bootstrap.php @@ -11,13 +11,21 @@ use Symfony\Polyfill\Php72 as p; -if ('\\' === DIRECTORY_SEPARATOR && !function_exists('sapi_windows_vt100_support')) { - function sapi_windows_vt100_support() { return false; } -} -if (!function_exists('stream_isatty')) { - function stream_isatty($stream) { return function_exists('posix_isatty') && @posix_isatty($stream); } -} -if (!function_exists('utf8_encode')) { - function utf8_encode($s) { return p\Php72::utf8_encode($s); } - function utf8_decode($s) { return p\Php72::utf8_decode($s); } +if (PHP_VERSION_ID < 70200) { + if ('\\' === DIRECTORY_SEPARATOR && !function_exists('sapi_windows_vt100_support')) { + function sapi_windows_vt100_support() { return false; } + } + if (!function_exists('stream_isatty')) { + function stream_isatty($stream) { return function_exists('posix_isatty') && @posix_isatty($stream); } + } + if (!function_exists('utf8_encode')) { + function utf8_encode($s) { return p\Php72::utf8_encode($s); } + function utf8_decode($s) { return p\Php72::utf8_decode($s); } + } + if (!function_exists('spl_object_id')) { + function spl_object_id($s) { return p\Php72::spl_object_id($s); } + } + if (!defined('PHP_OS_FAMILY')) { + define('PHP_OS_FAMILY', p\Php72::php_os_family()); + } } diff --git a/vendor/symfony/polyfill-php72/composer.json b/vendor/symfony/polyfill-php72/composer.json index a1a78afa52..215a785bef 100644 --- a/vendor/symfony/polyfill-php72/composer.json +++ b/vendor/symfony/polyfill-php72/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } } } |
