File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -429,6 +429,7 @@ public function getStyleNonce(): string
429429 {
430430 if (! $ this ->enableStyleNonce ) {
431431 $ this ->styleNonce = null ;
432+
432433 return '' ;
433434 }
434435
@@ -451,6 +452,7 @@ public function getScriptNonce(): string
451452 {
452453 if (! $ this ->enableScriptNonce ) {
453454 $ this ->scriptNonce = null ;
455+
454456 return '' ;
455457 }
456458
@@ -997,7 +999,7 @@ protected function generateNonces(ResponseInterface $response)
997999 $ nonce = $ this ->getScriptNonce ();
9981000 }
9991001
1000- $ attr = 'nonce=" ' . $ nonce . '" ' ;
1002+ $ attr = 'nonce=" ' . $ nonce . '" ' ;
10011003
10021004 return $ jsonEscape ? str_replace ('" ' , '\\" ' , $ attr ) : $ attr ;
10031005 }, $ body );
Original file line number Diff line number Diff line change @@ -742,7 +742,7 @@ public function testDisabledScriptNonce(): void
742742 $ this ->assertTrue ($ this ->work ('<script {csp-script-nonce}></script> ' ));
743743
744744 $ header = $ this ->response ->getHeaderLine ('Content-Security-Policy ' );
745- $ body = $ this ->response ->getBody ();
745+ $ body = $ this ->response ->getBody ();
746746
747747 $ this ->assertStringNotContainsString ('nonce= ' , $ body );
748748
@@ -837,10 +837,10 @@ public function testDisabledStyleNonce(): void
837837 $ this ->csp ->addStyleSrc ('self ' );
838838 $ this ->csp ->addStyleSrc ('cdn.cloudy.com ' );
839839
840- $ this ->assertTrue ($ this ->work (" <style {csp-style-nonce}></style> " ));
840+ $ this ->assertTrue ($ this ->work (' <style {csp-style-nonce}></style> ' ));
841841
842842 $ header = $ this ->response ->getHeaderLine ('Content-Security-Policy ' );
843- $ body = $ this ->response ->getBody ();
843+ $ body = $ this ->response ->getBody ();
844844
845845 $ this ->assertStringNotContainsString ('nonce= ' , $ body );
846846
You can’t perform that action at this time.
0 commit comments