File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,37 @@ public function testPageUrl() : void
130130 self ::assertSame ('http://localhost/?page=15 ' , $ this ->pager ->getPageUrl (15 ));
131131 }
132132
133+ /**
134+ * @runInSeparateProcess
135+ */
136+ public function testPageUrlWithXss () : void
137+ {
138+ $ _SERVER ['HTTP_HOST ' ] = 'localhost ' ;
139+ $ _SERVER ['REQUEST_URI ' ] = '/?foo=<script>alert("xss")</script> ' ;
140+ $ this ->pager = new Pager (0 , 10 , 31 );
141+ self ::assertSame (
142+ 'http://localhost/?foo=%3Cscript%3Ealert%28%22xss%22%29%3C%2Fscript%3E&page=1 ' ,
143+ $ this ->pager ->getCurrentPageUrl ()
144+ );
145+ self ::assertNull ($ this ->pager ->getPreviousPageUrl ());
146+ self ::assertSame (
147+ 'http://localhost/?foo=%3Cscript%3Ealert%28%22xss%22%29%3C%2Fscript%3E&page=1 ' ,
148+ $ this ->pager ->getFirstPageUrl ()
149+ );
150+ self ::assertSame (
151+ 'http://localhost/?foo=%3Cscript%3Ealert%28%22xss%22%29%3C%2Fscript%3E&page=2 ' ,
152+ $ this ->pager ->getNextPageUrl ()
153+ );
154+ self ::assertSame (
155+ 'http://localhost/?foo=%3Cscript%3Ealert%28%22xss%22%29%3C%2Fscript%3E&page=4 ' ,
156+ $ this ->pager ->getLastPageUrl ()
157+ );
158+ self ::assertSame (
159+ 'http://localhost/?foo=%3Cscript%3Ealert%28%22xss%22%29%3C%2Fscript%3E&page=15 ' ,
160+ $ this ->pager ->getPageUrl (15 )
161+ );
162+ }
163+
133164 /**
134165 * @runInSeparateProcess
135166 */
You can’t perform that action at this time.
0 commit comments