PHP 8.x Fixes
This commit is contained in:
parent
1224aa7aed
commit
bfe8271e6e
8 changed files with 31 additions and 25 deletions
|
@ -680,7 +680,9 @@ order by constraint_name, referenced_table_name, keyno";
|
|||
$arr = $args;
|
||||
}
|
||||
|
||||
array_walk($arr, create_function('&$v', '$v = "CAST(" . $v . " AS VARCHAR(255))";'));
|
||||
array_walk($arr, function(&$v){
|
||||
$v = "CAST(" . $v . " AS VARCHAR(255))";
|
||||
});
|
||||
$s = implode('+',$arr);
|
||||
if (sizeof($arr) > 0) return "$s";
|
||||
|
||||
|
|
|
@ -530,7 +530,9 @@ class ADODB_mssqlnative extends ADOConnection {
|
|||
$arr = $args;
|
||||
}
|
||||
|
||||
array_walk($arr, create_function('&$v', '$v = "CAST(" . $v . " AS VARCHAR(255))";'));
|
||||
array_walk($arr, function(&$v){
|
||||
$v = "CAST(" . $v . " AS VARCHAR(255))";
|
||||
});
|
||||
$s = implode('+',$arr);
|
||||
if (sizeof($arr) > 0) return "$s";
|
||||
|
||||
|
|
|
@ -13693,7 +13693,7 @@ function syncDomains($file='',$domainname='') {
|
|||
if(isset($sslInfo["lets_enc_additional_hosts"]) && !empty($sslInfo["lets_enc_additional_hosts"])){
|
||||
$subdoms=$this->getSubDomains("domainname = '" . $dom['domainname'] . "'");
|
||||
if(is_array($subdoms) && count($subdoms) > 0){
|
||||
$subdomsDomain = array_map(create_function('$ar', 'return $ar["subdomain"];'), $subdoms);
|
||||
$subdomsDomain = array_map(function($ar){ return $ar["subdomain"]; }, $subdoms);
|
||||
}else{
|
||||
$subdomsDomain = array();
|
||||
}
|
||||
|
|
|
@ -4568,18 +4568,12 @@ class GeSHi {
|
|||
if (!$recursed) {
|
||||
// do some optimizations
|
||||
// common trailing strings
|
||||
// BUGGY!
|
||||
//$list = preg_replace_callback('#(?<=^|\:|\|)\w+?(\w+)(?:\|.+\1)+(?=\|)#', create_function(
|
||||
// '$matches', 'return "(?:" . preg_replace("#" . preg_quote($matches[1], "#") . "(?=\||$)#", "", $matches[0]) . ")" . $matches[1];'), $list);
|
||||
// (?:p)? => p?
|
||||
$list = preg_replace('#\(\?\:(.)\)\?#', '\1?', $list);
|
||||
// (?:a|b|c|d|...)? => [abcd...]?
|
||||
// TODO: a|bb|c => [ac]|bb
|
||||
static $callback_2;
|
||||
if (!isset($callback_2)) {
|
||||
$callback_2 = create_function('$matches', 'return "[" . str_replace("|", "", $matches[1]) . "]";');
|
||||
}
|
||||
$list = preg_replace_callback('#\(\?\:((?:.\|)+.)\)#', $callback_2, $list);
|
||||
$list = preg_replace_callback('#\(\?\:((?:.\|)+.)\)#', function($matches){
|
||||
return "[" . str_replace("|", "", $matches[1]) . "]";
|
||||
}, $list);
|
||||
}
|
||||
// return $list without trailing pipe
|
||||
return substr($list, 0, -1);
|
||||
|
@ -4616,4 +4610,4 @@ if (!function_exists('geshi_highlight')) {
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -45,8 +45,7 @@ class LuminousBNFScanner extends LuminousStatefulScanner {
|
|||
// table, but here we are anyway
|
||||
$all = array('COMMENT', 'OPTION', 'REPETITION', 'GROUP', 'SPECIAL',
|
||||
'STRING', 'IDENT', 'OPERATOR');
|
||||
$almost_all = array_filter($all, create_function('$x',
|
||||
'return $x !== "SPECIAL";'));
|
||||
$almost_all = array_filter($all, function($x){ return $x !== "SPECIAL";});
|
||||
$this->transitions = array(
|
||||
'initial' => array_merge(array('RULE'), $all),
|
||||
'OPTION' => $all,
|
||||
|
|
|
@ -134,8 +134,7 @@ class LuminousRubyScanner extends LuminousScanner {
|
|||
// don't want this.
|
||||
$this->remove_filter('comment-to-doc');
|
||||
|
||||
$this->add_filter('REGEX', create_function('$tok',
|
||||
'return LuminousFilters::pcre($tok, (isset($tok[1][0]) && $tok[1][0] === "/"));'));
|
||||
$this->add_filter('REGEX', function($tok){return LuminousFilters::pcre($tok, (isset($tok[1][0]) && $tok[1][0] === "/"));});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -179,11 +179,10 @@ class LuminousFormatterHTML extends LuminousFormatter {
|
|||
$code_block = preg_replace('/(?<=<\/)[A-Z_0-9]+(?=>)/S', 'span',
|
||||
$code_block);
|
||||
// convert <ABC> to <span class=ABC>
|
||||
$cb = create_function('$matches',
|
||||
'$m1 = strtolower($matches[1]);
|
||||
return "<span class=\'" . $m1 . "\'>";
|
||||
');
|
||||
$code_block = preg_replace_callback('/<([A-Z_0-9]+)>/', $cb, $code_block);
|
||||
$code_block = preg_replace_callback('/<([A-Z_0-9]+)>/', function($matches){
|
||||
$m1 = strtolower($matches[1]);
|
||||
return "<span class=\'" . $m1 . "\'>";
|
||||
}, $code_block);
|
||||
|
||||
$format_data = array(
|
||||
'language' => ($this->language === null)? '' : htmlentities($this->language),
|
||||
|
|
|
@ -125,23 +125,34 @@ EOF;
|
|||
$str_ = preg_split('/(<[^>]+>)/', $str, -1,
|
||||
PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
// orig code that no longer works in php 8+...
|
||||
// Not sure if I converted it properly to anonymous functions or not...
|
||||
/*
|
||||
$f1 = create_function('$matches', '
|
||||
return "\\\lms" . str_replace("_", "", $matches[1]) . "{"; ');
|
||||
$f2 = create_function('$matches', '
|
||||
if ($matches[0][0] == "\\\")
|
||||
return "{\\\textbackslash}";
|
||||
return "\\\" . $matches[0];');
|
||||
*/
|
||||
|
||||
foreach($str_ as $s_) {
|
||||
if ($s_[0] === '<') {
|
||||
$s_ = preg_replace('%</[^>]+>%', '}', $s_);
|
||||
$s_ = preg_replace_callback('%<([^>]+)>%', $f1
|
||||
,$s_);
|
||||
$s_ = preg_replace_callback('%<([^>]+)>%', function($matches){
|
||||
return '\\\lms' . str_replace("_", "", $matches[1]) . "{";
|
||||
}, $s_);
|
||||
|
||||
} else {
|
||||
$s_ = str_replace('>', '>', $s_);
|
||||
$s_ = str_replace('<', '<', $s_);
|
||||
$s_ = str_replace('&', '&', $s_);
|
||||
$s_ = preg_replace_callback('/[#{}_$\\\&]|&(?=amp;)/', $f2, $s_);
|
||||
$s_ = preg_replace_callback('/[#{}_$\\\&]|&(?=amp;)/', function($matches){
|
||||
if ($matches[0][0] == "\\\\"){
|
||||
return '{\\\textbackslash}';
|
||||
}
|
||||
return "\\\\" . $matches[0];
|
||||
}, $s_);
|
||||
}
|
||||
|
||||
$s .= $s_;
|
||||
|
|
Loading…
Reference in a new issue