1
0
Fork 0

Merge pull request #30 from chrisknerr/php72-count-fixes

Fixed some issues with PHP >= 7.2 count() behavior
Dieser Commit ist enthalten in:
Daniel Schlichtholz 2018-03-08 07:18:35 +01:00 committet von GitHub
Commit 671f0bdaeb
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 8 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -18,7 +18,7 @@ function ReadSQL()
fclose($fp); fclose($fp);
@chmod($sf,0777); @chmod($sf,0777);
} }
if (count($SQL_ARRAY) == 0 && filesize($sf) > 0) if ((!is_array($SQL_ARRAY) || count($SQL_ARRAY) == 0) && filesize($sf) > 0)
{ {
$SQL_ARRAY=file($sf); $SQL_ARRAY=file($sf);
} }
@ -63,7 +63,7 @@ function SQL_ComboBox()
{ {
global $SQL_ARRAY,$tablename,$nl; global $SQL_ARRAY,$tablename,$nl;
$s=''; $s='';
if (count($SQL_ARRAY) > 0) if (is_array($SQL_ARRAY) && count($SQL_ARRAY) > 0)
{ {
$s=$nl . $nl . '<select class="SQLCombo" name="sqlcombo" onchange="this.form.sqltextarea.value=this.options[this.selectedIndex].value;">' . $nl; $s=$nl . $nl . '<select class="SQLCombo" name="sqlcombo" onchange="this.form.sqltextarea.value=this.options[this.selectedIndex].value;">' . $nl;
$s.='<option value="" selected>---</option>' . $nl; $s.='<option value="" selected>---</option>' . $nl;
@ -533,7 +533,7 @@ function correct_post_index($index)
function ComboCommandDump($when, $index, $disabled = '') function ComboCommandDump($when, $index, $disabled = '')
{ {
global $SQL_ARRAY,$nl,$databases,$lang; global $SQL_ARRAY,$nl,$databases,$lang;
if (count($SQL_ARRAY) == 0) if (!is_array($SQL_ARRAY) || count($SQL_ARRAY) == 0)
{ {
$r='<a href="sql.php?context=1" class="uls">' . $lang['L_SQL_BEFEHLE'] . '</a>'; $r='<a href="sql.php?context=1" class="uls">' . $lang['L_SQL_BEFEHLE'] . '</a>';
if ($when == 0) $r.='<input type="hidden" name="command_before_' . $index . '" value="">'; if ($when == 0) $r.='<input type="hidden" name="command_before_' . $index . '" value="">';

Datei anzeigen

@ -7,12 +7,12 @@ function nl2null($string)
return trim(str_replace($search,$replace,$string)); return trim(str_replace($search,$replace,$string));
} }
//SQL-Strings //SQL-Strings
echo $aus.='<h4>' . $lang['L_SQL_BEFEHLE'] . ' (' . count($SQL_ARRAY) . ')</h4>'; echo $aus.='<h4>' . $lang['L_SQL_BEFEHLE'] . ' (' . (is_array($SQL_ARRAY)? count($SQL_ARRAY) : 0) . ')</h4>';
echo '<a href="' . $params . '&amp;sqlconfig=1&amp;new=1">' . $lang['L_SQL_BEFEHLNEU'] . '</a><br><br>'; echo '<a href="' . $params . '&amp;sqlconfig=1&amp;new=1">' . $lang['L_SQL_BEFEHLNEU'] . '</a><br><br>';
if (isset($_POST['sqlnewupdate'])) if (isset($_POST['sqlnewupdate']))
{ {
$ind=count($SQL_ARRAY); $ind=(is_array($SQL_ARRAY))? count($SQL_ARRAY) : 0;
if (count($SQL_ARRAY) > 0) array_push($SQL_ARRAY,$_POST['sqlname' . $ind] . "|" . $_POST['sqlstring' . $ind]); if ($ind > 0) array_push($SQL_ARRAY,$_POST['sqlname' . $ind] . "|" . $_POST['sqlstring' . $ind]);
else $SQL_ARRAY[0]=htmlspecialchars($_POST['sqlname0'],ENT_COMPAT ,'UTF-8') . '|' . $_POST['sqlstring0']; else $SQL_ARRAY[0]=htmlspecialchars($_POST['sqlname0'],ENT_COMPAT ,'UTF-8') . '|' . $_POST['sqlstring0'];
WriteSQL(); WriteSQL();
echo '<p>' . $lang['L_SQL_BEFEHLSAVED1'] . ' \'' . $_POST['sqlname' . $ind] . '\' ' . $lang['L_SQL_BEFEHLSAVED2'] . '</p>'; echo '<p>' . $lang['L_SQL_BEFEHLSAVED1'] . ' \'' . $_POST['sqlname' . $ind] . '\' ' . $lang['L_SQL_BEFEHLSAVED2'] . '</p>';
@ -24,7 +24,7 @@ echo '<form name="sqlform" action="sql.php" method="post">
<input type="hidden" name="dbid" value="' . $dbid . '">'; <input type="hidden" name="dbid" value="' . $dbid . '">';
echo '<table class="bdr" style="width:100%"><tr class="thead"><th>#</th><th>' . $lang['L_NAME'] . '</th><th>SQL</th><th>' . $lang['L_COMMAND'] . '</th></tr>'; echo '<table class="bdr" style="width:100%"><tr class="thead"><th>#</th><th>' . $lang['L_NAME'] . '</th><th>SQL</th><th>' . $lang['L_COMMAND'] . '</th></tr>';
$i=0; $i=0;
if (count($SQL_ARRAY) > 0) if (is_array($SQL_ARRAY) && count($SQL_ARRAY) > 0)
{ {
for ($i=0; $i < count($SQL_ARRAY); $i++) for ($i=0; $i < count($SQL_ARRAY); $i++)
{ {

Datei anzeigen

@ -120,7 +120,7 @@ if ($restore['filehandle'])
{ {
@mysqli_query($config['dbconnection'], '/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;'); @mysqli_query($config['dbconnection'], '/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;');
} }
elseif (sizeof($restore['tables_to_restore'])==0&&($restore['actual_table']>''&&$restore['actual_table']!='unbekannt')) @mysqli_query($config['dbconnection'], '/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;'); elseif ((!is_array($restore['tables_to_restore'])||sizeof($restore['tables_to_restore'])==0)&&($restore['actual_table']>''&&$restore['actual_table']!='unbekannt')) @mysqli_query($config['dbconnection'], '/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;');
WHILE (($a<$restore['anzahl_zeilen'])&&(!$restore['fileEOF'])&&($dauer<$restore['max_zeit'])&&!$restore['EOB']) WHILE (($a<$restore['anzahl_zeilen'])&&(!$restore['fileEOF'])&&($dauer<$restore['max_zeit'])&&!$restore['EOB'])
{ {