File tree Expand file tree Collapse file tree 4 files changed +29
-7
lines changed Expand file tree Collapse file tree 4 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ java_script_error_handler:
44
44
45
45
Requirements
46
46
------------
47
- PHP 7.1 or higher and Symfony 3 .3+.
47
+ PHP 7.2 or higher and Symfony 4 .3+.
48
48
49
49
50
50
Author
Original file line number Diff line number Diff line change 18
18
],
19
19
"require" : {
20
20
"php" : " ~7.2" ,
21
- "symfony/config" : " ^4.2 " ,
22
- "symfony/dependency-injection" : " ^4.2 " ,
23
- "symfony/event-dispatcher" : " ^4.2 " ,
24
- "symfony/expression-language" : " ^4.2 " ,
25
- "symfony/http-foundation" : " ^4.2 " ,
26
- "symfony/http-kernel" : " ^4.2 "
21
+ "symfony/config" : " ^4.3 " ,
22
+ "symfony/dependency-injection" : " ^4.3 " ,
23
+ "symfony/event-dispatcher" : " ^4.3 " ,
24
+ "symfony/expression-language" : " ^4.3 " ,
25
+ "symfony/http-foundation" : " ^4.3.4 " ,
26
+ "symfony/http-kernel" : " ^4.3 "
27
27
},
28
28
"require-dev" : {
29
29
"consistence/coding-standard" : " 3.5" ,
Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ public function onKernelResponse(FilterResponseEvent $event): void
56
56
protected function injectScript (Response $ response , Request $ request ): void
57
57
{
58
58
$ content = $ response ->getContent ();
59
+ if ($ content === false ) {
60
+ return ;
61
+ }
62
+
59
63
$ pos = stripos ($ content , '<head> ' );
60
64
61
65
if ($ pos !== false ) {
Original file line number Diff line number Diff line change 9
9
use Symfony \Component \HttpFoundation \HeaderBag ;
10
10
use Symfony \Component \HttpFoundation \Request ;
11
11
use Symfony \Component \HttpFoundation \Response ;
12
+ use Symfony \Component \HttpFoundation \StreamedResponse ;
12
13
use Symfony \Component \HttpKernel \Event \FilterResponseEvent ;
13
14
use Symfony \Component \HttpKernel \HttpKernelInterface ;
14
15
use Symfony \Component \HttpKernel \Kernel ;
@@ -134,6 +135,23 @@ public function redirectCodesDataProvider(): array
134
135
];
135
136
}
136
137
138
+ public function testScriptIsNotInjectedToStreamedResponse (): void
139
+ {
140
+ $ response = new StreamedResponse ();
141
+
142
+ $ event = new FilterResponseEvent (
143
+ $ this ->getKernelMock (),
144
+ $ this ->getRequestMock (),
145
+ HttpKernelInterface::MASTER_REQUEST ,
146
+ $ response
147
+ );
148
+
149
+ $ listener = new JsErrorToAlertListener ();
150
+ $ listener ->onKernelResponse ($ event );
151
+
152
+ $ this ->assertFalse ($ response ->getContent ());
153
+ }
154
+
137
155
public function testScriptIsNotInjectedOnSubRequest (): void
138
156
{
139
157
$ response = new Response (self ::BASIC_HTML );
You can’t perform that action at this time.
0 commit comments