From e1773ee2b8e99259817de13d1679d720aa89df2f Mon Sep 17 00:00:00 2001 From: Vladimir Reznichenko Date: Fri, 3 Mar 2017 17:35:37 +0100 Subject: [PATCH 1/4] Static code analysis with Php Inspections (EA Extended): dead code dropped, couple bugs fixed --- .../Intl/DateFormatter/DateFormat/TimeZoneTransformer.php | 2 +- src/Symfony/Component/Process/Process.php | 1 - .../Security/Http/Firewall/DigestAuthenticationListener.php | 2 +- .../Component/Translation/Catalogue/AbstractOperation.php | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimeZoneTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimeZoneTransformer.php index 6f9c0d5a02..7695a627a6 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimeZoneTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimeZoneTransformer.php @@ -94,6 +94,6 @@ class TimeZoneTransformer extends Transformer return 'Etc/GMT'.($hours !== 0 ? $signal.$hours : ''); } - throw new \InvalidArgumentException('The GMT time zone \'%s\' does not match with the supported formats GMT[+-]HH:MM or GMT[+-]HHMM.'); + throw new \InvalidArgumentException(sprintf("The GMT time zone '%s' does not match with the supported formats GMT[+-]HH:MM or GMT[+-]HHMM.", $formattedTimeZone)); } } diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 23d561662e..96a93343f1 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -162,7 +162,6 @@ class Process $this->setTimeout($timeout); $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR; $this->pty = false; - $this->enhanceWindowsCompatibility = true; $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled(); $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options); } diff --git a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php index 702cf33595..d89111f6ae 100644 --- a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php @@ -206,7 +206,7 @@ class DigestData } elseif ('auth' === $this->elements['qop']) { $digest .= ':'.$this->elements['nc'].':'.$this->elements['cnonce'].':'.$this->elements['qop']; } else { - throw new \InvalidArgumentException('This method does not support a qop: "%s".', $this->elements['qop']); + throw new \InvalidArgumentException(sprintf('This method does not support a qop: "%s".', $this->elements['qop'])); } $digest .= ':'.$a2Md5; diff --git a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php index 062056b731..c0ca6bb9b4 100644 --- a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php +++ b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php @@ -61,7 +61,6 @@ abstract class AbstractOperation implements OperationInterface $this->source = $source; $this->target = $target; $this->result = new MessageCatalogue($source->getLocale()); - $this->domains = null; $this->messages = array(); } From 1ed0092a62a1669a50eb87382dc78400531ba5c7 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 4 Mar 2017 11:20:42 +0100 Subject: [PATCH 2/4] fix test class location --- .../Firewall/UsernamePasswordFormAuthenticationListenerTest.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/Symfony/Component/Security/{Tests/Http => Http/Tests}/Firewall/UsernamePasswordFormAuthenticationListenerTest.php (100%) diff --git a/src/Symfony/Component/Security/Tests/Http/Firewall/UsernamePasswordFormAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php similarity index 100% rename from src/Symfony/Component/Security/Tests/Http/Firewall/UsernamePasswordFormAuthenticationListenerTest.php rename to src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php From 1d43007f3c92ddc97ee90c4b21ee50cd15b41966 Mon Sep 17 00:00:00 2001 From: Daniel Wehner Date: Tue, 28 Feb 2017 18:22:29 +0000 Subject: [PATCH 3/4] Provide less state in getRequestFormat --- src/Symfony/Component/HttpFoundation/Request.php | 4 ++-- src/Symfony/Component/HttpFoundation/Tests/RequestTest.php | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 697bc6c3c3..d659d188ea 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1382,10 +1382,10 @@ class Request public function getRequestFormat($default = 'html') { if (null === $this->format) { - $this->format = $this->get('_format', $default); + $this->format = $this->get('_format'); } - return $this->format; + return null === $this->format ? $default : $this->format; } /** diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 9000eb622b..2b852f5956 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1401,6 +1401,11 @@ class RequestTest extends TestCase $request = new Request(); $this->assertEquals('html', $request->getRequestFormat()); + // Ensure that setting different default values over time is possible, + // aka. setRequestFormat determines the state. + $this->assertEquals('json', $request->getRequestFormat('json')); + $this->assertEquals('html', $request->getRequestFormat('html')); + $request = new Request(); $this->assertNull($request->getRequestFormat(null)); From 69a572dc5dc57465c5bb72c60a53d2acdaad0255 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 4 Mar 2017 12:34:09 +0100 Subject: [PATCH 4/4] [Security] fix Composer constraint --- src/Symfony/Component/Security/Http/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Http/composer.json b/src/Symfony/Component/Security/Http/composer.json index 1b36428ff6..6e28903192 100644 --- a/src/Symfony/Component/Security/Http/composer.json +++ b/src/Symfony/Component/Security/Http/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.3.9", - "symfony/security-core": "~2.6", + "symfony/security-core": "^2.7.13|^2.8.6", "symfony/event-dispatcher": "~2.1", "symfony/http-foundation": "~2.4", "symfony/http-kernel": "~2.4"