PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: guzzle/psr7 (php)

Issue:
Urgent - v2.1.1 - MessageTrait assertValue broken
**PHP version**: 7.4.27 (hint: `php --version`)

**Description**
I updated my dependencies, and guzzlehttp/psr7 was updated to v2.1.1. This broke an integration with a third party API that I'm working with. (Largest credit card payment processor in Scandiavia).

I have traced it down to the changes introduced in MessageTrait for the method `assertValue`.
When the response (which I am not in control over), contains the following header, I get an InvalidArgumentException XXX is not a valid header value.

```
X-Iinfo: 12-34567890-123456789 AAAA BC(12 34 5) DE(1234567890123 123) a(1 2 3 4) b(1 2) A1
```

I have changed the actual values from the header, as I'm not sure if it contains confidential information. The relevant part here is the whitespaces, which failes the parsing introduced in 2.1.1.


**How to reproduce**
Add the above header to a response.

**Possible Solution**
Revert the changes done in 2.1.1 back to the behavior in 2.1.0

**Additional context**



Pull request:
Release 2.1.2
Closes #489.

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bfbd193..9170442 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## Unreleased
 
+## 2.1.2 - 2022-03-20
+
+### Fixed
+
+- Correct header value validation
+
 ## 2.1.1 - 2022-03-20
 
 ### Fixed
diff --git a/src/MessageTrait.php b/src/MessageTrait.php
index 809502c..a8696b9 100644
--- a/src/MessageTrait.php
+++ b/src/MessageTrait.php
@@ -259,7 +259,7 @@ trait MessageTrait
         // Clients must not send a request with line folding and a server sending folded headers is
         // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting
         // folding is not likely to break any legitimate use case.
-        if (! preg_match('/^(?:[\x21-\x7E\x80-\xFF](?:[\x20\x09]+[\x21-\x7E\x80-\xFF])?)*$/', $value)) {
+        if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/', $value)) {
             throw new \InvalidArgumentException(sprintf('"%s" is not valid header value', $value));
         }
     }


Test patch:
diff --git a/tests/RequestTest.php b/tests/RequestTest.php
index f8c04bf..71d90b2 100644
--- a/tests/RequestTest.php
+++ b/tests/RequestTest.php
@@ -176,6 +176,17 @@ class RequestTest extends TestCase
         ], $r->getHeaders());
     }
 
+    public function testHeaderValueWithWhitespace(): void
+    {
+        $r = new Request('GET', 'https://example.com/', [
+            'User-Agent' => 'Linux f0f489981e90 5.10.104-linuxkit 1 SMP Wed Mar 9 19:05:23 UTC 2022 x86_64'
+        ]);
+        self::assertSame([
+            'Host' => ['example.com'],
+            'User-Agent' => ['Linux f0f489981e90 5.10.104-linuxkit 1 SMP Wed Mar 9 19:05:23 UTC 2022 x86_64']
+        ], $r->getHeaders());
+    }
+
     public function testCanGetHeaderAsCsv(): void
     {
         $r = new Request('GET', 'http://foo.com/baz?bar=bam', [
Repository: phoenixframework/phoenix (elixir)

Issue:
Warn on phx.gen.live if LiveView.JS is missing?
<!--
### Precheck

* For general discussions and support, use Stack Overflow or the Elixir Forum
* For proposing and discussing new features, start a thread on the Phoenix Core mailing list
* For bugs, do a quick search and make sure the bug has not yet been reported
* Ensure that this issue is related to the Phoenix library and not one of the dependencies listed in mix.exs (Ecto, Plug, etc.)
* All checked? Be nice and have fun!
-->

The latest generator relies on `Phoenix.LiveView.JS` which requires LiveView v0.17+. Without the module, running `mix phx.server` after running the generator will emit a compilation error:

```sh
== Compilation error in file lib/fiddle_web/live/live_helpers.ex ==
** (CompileError) lib/fiddle_web/live/live_helpers.ex:55: Phoenix.LiveView.JS.__struct__/1 is undefined, cannot expand struct Phoenix.LiveView.JS. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code
    lib/fiddle_web/live/live_helpers.ex:55: (module)
```

Should we check whether or not `LiveView.JS` is loaded and print a warning for the user to upgrade? They will need to update deps for LiveView and LiveDashboard:

```elixir
defp deps do
 [
    {:phoenix_live_view, "~> 0.17"},
    {:phoenix_live_dashboard", "~> 0.6"}
    # deps...
  ]
end
```


Pull request:
Add upgrade instructions to phx.gen.live task
Closes #4642

Patch:
diff --git a/lib/mix/tasks/phx.gen.live.ex b/lib/mix/tasks/phx.gen.live.ex
index 4bf63ca47..fbb2924a0 100644
--- a/lib/mix/tasks/phx.gen.live.ex
+++ b/lib/mix/tasks/phx.gen.live.ex
@@ -219,6 +219,18 @@ defmodule Mix.Tasks.Phx.Gen.Live do
       """
     end
     if context.generate?, do: Gen.Context.print_shell_instructions(context)
+    maybe_print_upgrade_info()
+  end
+
+  defp maybe_print_upgrade_info do
+    unless Code.ensure_loaded?(Phoenix.LiveView.JS) do
+      Mix.shell().info """
+
+      You must update :phoenix_live_view to v0.17 or later and
+      :phoenix_live_dashboard to v0.6 or later to use the features
+      in this generator.
+      """
+    end
   end
 
   defp live_route_instructions(schema) do


Test patch:
diff --git a/test/mix/tasks/phx.gen.live_test.exs b/test/mix/tasks/phx.gen.live_test.exs
index 68fc6b645..f397e0b07 100644
--- a/test/mix/tasks/phx.gen.live_test.exs
+++ b/test/mix/tasks/phx.gen.live_test.exs
@@ -174,6 +174,13 @@ defmodule Mix.Tasks.Phx.Gen.LiveTest do
           live "/comments/:id", CommentLive.Show, :show
           live "/comments/:id/show/edit", CommentLive.Show, :edit
       """]}
+
+      assert_receive({:mix_shell, :info, ["""
+
+      You must update :phoenix_live_view to v0.17 or later and
+      :phoenix_live_dashboard to v0.6 or later to use the features
+      in this generator.
+      """]})
     end
   end