Initial work to support PHP 7.2

This commit is contained in:
Rob Lensen
2018-01-17 23:40:27 +01:00
parent 9671454e75
commit 6a3f8f3e76
5 changed files with 10 additions and 8 deletions
+1 -1
View File
@@ -402,7 +402,7 @@ CREATE TABLE '.$temporary_tablename.'
if ($flags & MASS_UPDATES_SKIP_EMPTY)
$func_set = create_function('$s', 'return "t1.$s = IFNULL(t2.$s, t1.$s)";');
else
$func_set = create_function('$s', 'return "t1.$s = t2.$s";');
$func_set = function($s) { return "t1.$s = t2.$s"; };
// update of table by joining with temporary table
$query = '
+5 -3
View File
@@ -1399,11 +1399,13 @@ function safe_json_decode($value)
*/
function prepend_append_array_items($array, $prepend_str, $append_str)
{
array_walk(
/* array_walk(
$array,
create_function('&$s', '$s = "'.$prepend_str.'".$s."'.$append_str.'";')
);
*/
//New PHP 7.2 code
array_walk($array, function(&$value, $key) use($prepend_str,$append_str) { $value = "$prepend_str$value$append_str"; } );
return $array;
}
@@ -2162,7 +2164,7 @@ SELECT COUNT(DISTINCT(com.id))
*/
function safe_version_compare($a, $b, $op=null)
{
$replace_chars = create_function('$m', 'return ord(strtolower($m[1]));');
$replace_chars = function($m) { return ord(strtolower($m[1])); };
// add dot before groups of letters (version_compare does the same thing)
$a = preg_replace('#([0-9]+)([a-z]+)#i', '$1.$2', $a);
+1 -1
View File
@@ -290,7 +290,7 @@ class Template
return false;
}
reset($filename_array);
while(list($handle, $filename) = each($filename_array))
foreach ($filename_array as $handle => $filename)
{
if (is_null($filename))
{
+1 -1
View File
@@ -617,7 +617,7 @@ Request format: ".@$this->_requestFormat." Response format: ".@$this->_responseF
static function ws_getMethodList($params, &$service)
{
$methods = array_filter($service->_methods,
create_function('$m', 'return empty($m["options"]["hidden"]) || !$m["options"]["hidden"];'));
function($m) { return empty($m["options"]["hidden"]) || !$m["options"]["hidden"];} );
return array('methods' => new PwgNamedArray( array_keys($methods),'method' ) );
}