Commit 456d3e96 authored by ChaseOnTheWeb's avatar ChaseOnTheWeb Committed by joseph.olstad

Issue #2998097 by mr.les, ChaseOnTheWeb: Ensuring full php 7.1.x compatibility...

Issue #2998097 by mr.les, ChaseOnTheWeb: Ensuring full php 7.1.x compatibility and Recommended server configuration to avoid PHP 7+ Internal Server Error
parent 798c0966
...@@ -668,12 +668,20 @@ function media_parse_to_file($url, $params = array()) { ...@@ -668,12 +668,20 @@ function media_parse_to_file($url, $params = array()) {
} }
/** /**
* Utility function to recursively run check_plain on an array. * Custom implementation of array_walk_recursive() that works around a crash
* some users have been experiencing with that function in PHP 7.
* *
* @todo There is probably something in core I am not aware of that does this. * @see https://www.drupal.org/project/media/issues/2998097
*/ */
function media_recursive_check_plain(&$value, $key) { function media_array_walk_recursive(&$array) {
$value = check_plain($value); foreach ($array as $key => $value) {
if (is_array($array[$key])) {
media_array_walk_recursive($array[$key]);
}
else {
$array[$key] = check_plain($array[$key]);
}
}
} }
/** /**
...@@ -1263,7 +1271,7 @@ function media_set_browser_params() { ...@@ -1263,7 +1271,7 @@ function media_set_browser_params() {
} }
} }
array_walk_recursive($params, 'media_recursive_check_plain'); media_array_walk_recursive($params);
// Provide some default parameters. // Provide some default parameters.
$params += array( $params += array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment