File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
liens-morts-detector-jlg/includes Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -247,7 +247,11 @@ function blc_dashboard_links_page() {
247247 }
248248 }
249249
250- if (isset ($ _REQUEST ['page ' ]) && (!isset ($ current_get_params ['page ' ]) || !is_scalar ($ current_get_params ['page ' ]))) {
250+ if (
251+ isset ($ _REQUEST ['page ' ])
252+ && is_scalar ($ _REQUEST ['page ' ])
253+ && (!isset ($ current_get_params ['page ' ]) || !is_scalar ($ current_get_params ['page ' ]))
254+ ) {
251255 printf (
252256 '<input type="hidden" name="page" value="%s" /> ' ,
253257 esc_attr ((string ) $ _REQUEST ['page ' ])
Original file line number Diff line number Diff line change @@ -341,6 +341,28 @@ public function test_views_include_additional_filters(): void
341341 $ this ->assertStringContainsString ("À revérifier <span class='count'>(2)</span> " , $ output );
342342 }
343343
344+ public function test_hidden_page_field_not_rendered_for_non_scalar_request (): void
345+ {
346+ $ _REQUEST ['page ' ] = ['foo ' ];
347+
348+ $ errors = [];
349+ set_error_handler (static function ($ severity , $ message ) use (&$ errors ) {
350+ $ errors [] = $ message ;
351+
352+ return true ;
353+ });
354+
355+ ob_start ();
356+ blc_dashboard_links_page ();
357+ $ output = (string ) ob_get_clean ();
358+
359+ restore_error_handler ();
360+ unset($ _REQUEST ['page ' ]);
361+
362+ $ this ->assertSame ([], $ errors );
363+ $ this ->assertStringNotContainsString ('<input type="hidden" name="page" ' , $ output );
364+ }
365+
344366 /**
345367 * @return array<string, array{0: string, 1: string}>
346368 */
You can’t perform that action at this time.
0 commit comments