From 4b5ea1850433f764302cf62879a2deaaf6a24674 Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Sat, 19 Jan 2019 23:59:41 +0100 Subject: [PATCH 1/3] Web: fix deprecated php stuff The `ereg` function is deprecated since 5.3 and was removed in 7.0. Using `break;` outside a loop was working unintentionally before 7.0 but now throws a compile error. Using s call-time pass-by-reference throws an error since 5.4. The `&` is only needed in the function declaration not when calling the function. --- html/inc/bolt_ex.inc | 2 +- html/ops/mass_email_script.php | 6 +++--- html/user/bolt_sched.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/html/inc/bolt_ex.inc b/html/inc/bolt_ex.inc index 78cd5622d55..e3fede5f5f3 100644 --- a/html/inc/bolt_ex.inc +++ b/html/inc/bolt_ex.inc @@ -323,7 +323,7 @@ function fitb() { } break; case 1: - if (ereg($answer->ans, $response)) { + if (preg_match('/'.$answer->ans.'/', $response)) { $bolt_ex->score = 1; } break; diff --git a/html/ops/mass_email_script.php b/html/ops/mass_email_script.php index 01c10c85201..6087d609660 100755 --- a/html/ops/mass_email_script.php +++ b/html/ops/mass_email_script.php @@ -267,7 +267,7 @@ function read_log() { exit(); } $startid = 0; - while (fscanf($f, '%d', &$startid)) { + while (fscanf($f, '%d', $startid)) { // read to the last entry in the file } fclose($f); @@ -287,13 +287,13 @@ function main() { $startid = $new_startid; } } else { - $fid = fopen($id_file, 'r'); + $fid = fopen($id_file, 'r'); if (!$fid) { echo $id_file . ' not found - create ID list and run again\n'; exit(); } $thisid = 0; - while (fscanf($fid, '%d', &$thisid)) { + while (fscanf($fid, '%d', $thisid)) { if ($thisid > $startid) { do_one($thisid, $f); } diff --git a/html/user/bolt_sched.php b/html/user/bolt_sched.php index 93055c32612..940ecbf75a5 100644 --- a/html/user/bolt_sched.php +++ b/html/user/bolt_sched.php @@ -326,7 +326,7 @@ function show_next($iter, $view) { // show_refresh_finished(); $refresh->update('count=count+1'); - break; + return; } } From d82c588133acd0dabf55ab6f0ed520df598a24ce Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Wed, 23 Jan 2019 21:05:01 +0100 Subject: [PATCH 2/3] Web: fix performance issues found by scrutinizer --- html/inc/translation.inc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/html/inc/translation.inc b/html/inc/translation.inc index 39d33dc2c65..b8794c2bdd5 100644 --- a/html/inc/translation.inc +++ b/html/inc/translation.inc @@ -119,8 +119,9 @@ function parse_po_file($file) { $current_token =""; $parsing_token = false; $parsing_text = false; + $size = sizeof($translation_file); $output = array(); - for ($i=0; $i2) && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") ){ From 83af843d4cf45dc5e54ba97b7a3cc68fcab8f6ee Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Wed, 23 Jan 2019 21:05:57 +0100 Subject: [PATCH 3/3] Web: simplify unneeded variable assignment --- html/inc/translation.inc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/html/inc/translation.inc b/html/inc/translation.inc index b8794c2bdd5..b3b1ffa2c04 100644 --- a/html/inc/translation.inc +++ b/html/inc/translation.inc @@ -196,9 +196,8 @@ function tra($text /* ...arglist... */) { for ($i=1; $i