Issue #3084935 by kiamlaluno, Taran2L, mcdruid, atheia, Liam Morland: element_children() and DrupalRequestSanitizer::stripDangerousValues() should not use integers as an array

merge-requests/26/head
mcdruid 2020-03-14 16:01:16 +00:00
parent 97bd4f7203
commit edb77684bd
2 changed files with 2 additions and 2 deletions

View File

@ -6653,7 +6653,7 @@ function element_children(&$elements, $sort = FALSE) {
$children = array();
$sortable = FALSE;
foreach ($elements as $key => $value) {
if ($key === '' || $key[0] !== '#') {
if (is_int($key) || $key === '' || $key[0] !== '#') {
$children[$key] = $value;
if (is_array($value) && isset($value['#weight'])) {
$sortable = TRUE;

View File

@ -99,7 +99,7 @@ class DrupalRequestSanitizer {
protected static function stripDangerousValues($input, array $whitelist, array &$sanitized_keys) {
if (is_array($input)) {
foreach ($input as $key => $value) {
if ($key !== '' && $key[0] === '#' && !in_array($key, $whitelist, TRUE)) {
if ($key !== '' && ((string) $key)[0] === '#' && !in_array($key, $whitelist, TRUE)) {
unset($input[$key]);
$sanitized_keys[] = $key;
}