1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

Fixed a bunch of PHP 7.4 syntax errors

- FIX: Removed pointless (and invalid) destructor in LinkedIn::__destruct()
- FIX: All files that trigger this deprecation notice in PHP 7.4:
       "Array and string offset access syntax with curly braces is deprecated"
This commit is contained in:
Nick Liu 2020-01-18 18:26:35 +01:00
parent d55fe8a77b
commit 524229ba0b
No known key found for this signature in database
GPG Key ID: 1167C5F9C9897637
9 changed files with 65 additions and 74 deletions

6
e107_handlers/e107_class.php Executable file → Normal file
View File

@ -4285,11 +4285,11 @@ class e107
}
//BC temporary fixes
if (!isset($this->e107_dirs['UPLOADS_SERVER']) && $this->e107_dirs['UPLOADS_DIRECTORY']{0} == "/")
if (!isset($this->e107_dirs['UPLOADS_SERVER']) && $this->e107_dirs['UPLOADS_DIRECTORY'][0] == "/")
{
$this->e107_dirs['UPLOADS_SERVER'] = $this->e107_dirs['UPLOADS_DIRECTORY'];
}
if (!isset($this->e107_dirs['DOWNLOADS_SERVER']) && $this->e107_dirs['DOWNLOADS_DIRECTORY']{0} == "/")
if (!isset($this->e107_dirs['DOWNLOADS_SERVER']) && $this->e107_dirs['DOWNLOADS_DIRECTORY'][0] == "/")
{
$this->e107_dirs['DOWNLOADS_SERVER'] = $this->e107_dirs['DOWNLOADS_DIRECTORY'];
}
@ -5115,7 +5115,7 @@ class e107
break;
}
$this->{$name} = $ret;
$this->$name = $ret;
return $ret;
}

View File

@ -1274,10 +1274,10 @@ class e_parse extends e_parser
$intag = FALSE;
while($curlen < $len && $curlen < strlen($text))
{
switch($text {$pos} )
switch($text [$pos] )
{
case "<":
if($text {$pos + 1} == "/")
if($text [$pos + 1] == "/")
{
$closing_tag = TRUE;
}
@ -1288,7 +1288,7 @@ class e_parse extends e_parser
case ">":
if($text {$pos - 1} == "/")
if($text [$pos - 1] == "/")
{
$closing_tag = TRUE;
}
@ -1303,7 +1303,7 @@ class e_parse extends e_parser
case "&":
if($text {$pos + 1} == "#")
if($text [$pos + 1] == "#")
{
$end = strpos(substr($text, $pos, 7), ";");
if($end !== FALSE)

View File

@ -169,15 +169,6 @@ class LinkedIn {
$this->setCallbackUrl($config['callbackUrl']);
}
/**
* The class destructor.
*
* Explicitly clears LinkedIn object from memory upon destruction.
*/
public function __destruct() {
unset($this);
}
/**
* Bookmark a job.
*

View File

@ -103,7 +103,7 @@ abstract class OAuthSignatureMethod {
// Avoid a timing leak with a (hopefully) time insensitive compare
$result = 0;
for ($i = 0; $i < strlen($signature); $i++) {
$result |= ord($built{$i}) ^ ord($signature{$i});
$result |= ord($built[$i]) ^ ord($signature[$i]);
}
return $result == 0;

View File

@ -151,7 +151,7 @@ class Services_JSON
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
switch(true) {
case ((0x7F & $bytes) == $bytes):
@ -204,17 +204,17 @@ class Services_JSON
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2))
. chr((0xC0 & (ord($utf8{0}) << 6))
| (0x3F & ord($utf8{1})));
return chr(0x07 & (ord($utf8[0]) >> 2))
. chr((0xC0 & (ord($utf8[0]) << 6))
| (0x3F & ord($utf8[1])));
case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4))
| (0x0F & (ord($utf8{1}) >> 2)))
. chr((0xC0 & (ord($utf8{1}) << 6))
| (0x7F & ord($utf8{2})));
return chr((0xF0 & (ord($utf8[0]) << 4))
| (0x0F & (ord($utf8[1]) >> 2)))
. chr((0xC0 & (ord($utf8[1]) << 6))
| (0x7F & ord($utf8[2])));
}
// ignoring UTF-32 for now, sorry
@ -259,7 +259,7 @@ class Services_JSON
*/
for ($c = 0; $c < $strlen_var; ++$c) {
$ord_var_c = ord($var{$c});
$ord_var_c = ord($var[$c]);
switch (true) {
case $ord_var_c == 0x08:
@ -282,18 +282,18 @@ class Services_JSON
case $ord_var_c == 0x2F:
case $ord_var_c == 0x5C:
// double quote, slash, slosh
$ascii .= '\\'.$var{$c};
$ascii .= '\\'.$var[$c];
break;
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
// characters U-00000000 - U-0000007F (same as ASCII)
$ascii .= $var{$c};
$ascii .= $var[$c];
break;
case (($ord_var_c & 0xE0) == 0xC0):
// characters U-00000080 - U-000007FF, mask 110XXXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
$char = pack('C*', $ord_var_c, ord($var[$c + 1]));
$c += 1;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@ -303,8 +303,8 @@ class Services_JSON
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}));
ord($var[$c + 1]),
ord($var[$c + 2]));
$c += 2;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@ -314,9 +314,9 @@ class Services_JSON
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}));
ord($var[$c + 1]),
ord($var[$c + 2]),
ord($var[$c + 3]));
$c += 3;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@ -326,10 +326,10 @@ class Services_JSON
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}));
ord($var[$c + 1]),
ord($var[$c + 2]),
ord($var[$c + 3]),
ord($var[$c + 4]));
$c += 4;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@ -339,11 +339,11 @@ class Services_JSON
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}),
ord($var{$c + 5}));
ord($var[$c + 1]),
ord($var[$c + 2]),
ord($var[$c + 3]),
ord($var[$c + 4]),
ord($var[$c + 5]));
$c += 5;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@ -518,7 +518,7 @@ class Services_JSON
for ($c = 0; $c < $strlen_chrs; ++$c) {
$substr_chrs_c_2 = substr($chrs, $c, 2);
$ord_chrs_c = ord($chrs{$c});
$ord_chrs_c = ord($chrs[$c]);
switch (true) {
case $substr_chrs_c_2 == '\b':
@ -548,7 +548,7 @@ class Services_JSON
case $substr_chrs_c_2 == '\\/':
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
$utf8 .= $chrs{++$c};
$utf8 .= $chrs[++$c];
}
break;
@ -561,7 +561,7 @@ class Services_JSON
break;
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
$utf8 .= $chrs{$c};
$utf8 .= $chrs[$c];
break;
case ($ord_chrs_c & 0xE0) == 0xC0:
@ -608,7 +608,7 @@ class Services_JSON
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
// array, or object notation
if ($str{0} == '[') {
if ($str[0] == '[') {
$stk = array(SERVICES_JSON_IN_ARR);
$arr = array();
} else {
@ -647,7 +647,7 @@ class Services_JSON
$top = end($stk);
$substr_chrs_c_2 = substr($chrs, $c, 2);
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
// found a comma that is not inside a string, array, etc.,
// OR we've reached the end of the character list
$slice = substr($chrs, $top['where'], ($c - $top['where']));
@ -689,12 +689,12 @@ class Services_JSON
}
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
} elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
// found a quote, and we are not inside a string
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c]));
//print("Found start of string at {$c}\n");
} elseif (($chrs{$c} == $top['delim']) &&
} elseif (($chrs[$c] == $top['delim']) &&
($top['what'] == SERVICES_JSON_IN_STR) &&
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
// found a quote, we're in a string, and it's not escaped
@ -703,24 +703,24 @@ class Services_JSON
array_pop($stk);
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
} elseif (($chrs{$c} == '[') &&
} elseif (($chrs[$c] == '[') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-bracket, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
//print("Found start of array at {$c}\n");
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
} elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
// found a right-bracket, and we're in an array
array_pop($stk);
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
} elseif (($chrs{$c} == '{') &&
} elseif (($chrs[$c] == '{') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-brace, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
//print("Found start of object at {$c}\n");
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
} elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
// found a right-brace, and we're in an object
array_pop($stk);
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");

View File

@ -383,7 +383,7 @@ if (!defined("PCL_TAR"))
}
// ----- Call the extracting fct
if (($v_result = PclTarHandleExtract($p_tarname, 0, &$p_list, "complete", $p_path, $v_tar_mode, $p_remove_path)) != 1)
if (($v_result = PclTarHandleExtract($p_tarname, 0, $p_list, "complete", $p_path, $v_tar_mode, $p_remove_path)) != 1)
{
TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
return(0);
@ -445,7 +445,7 @@ if (!defined("PCL_TAR"))
if (is_array($p_filelist))
{
// ----- Call the extracting fct
if (($v_result = PclTarHandleExtract($p_tarname, $p_filelist, &$p_list, "partial", $p_path, $v_tar_mode, $p_remove_path)) != 1)
if (($v_result = PclTarHandleExtract($p_tarname, $p_filelist, $p_list, "partial", $p_path, $v_tar_mode, $p_remove_path)) != 1)
{
TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
return(0);
@ -459,7 +459,7 @@ if (!defined("PCL_TAR"))
$v_list = explode(" ", $p_filelist);
// ----- Call the extracting fct
if (($v_result = PclTarHandleExtract($p_tarname, $v_list, &$p_list, "partial", $p_path, $v_tar_mode, $p_remove_path)) != 1)
if (($v_result = PclTarHandleExtract($p_tarname, $v_list, $p_list, "partial", $p_path, $v_tar_mode, $p_remove_path)) != 1)
{
TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
return(0);
@ -534,7 +534,7 @@ if (!defined("PCL_TAR"))
if (is_integer($p_index))
{
// ----- Call the extracting fct
if (($v_result = PclTarHandleExtractByIndexList($p_tarname, $p_index, &$p_list, $p_path, $p_remove_path, $v_tar_mode)) != 1)
if (($v_result = PclTarHandleExtractByIndexList($p_tarname, $p_index, $p_list, $p_path, $p_remove_path, $v_tar_mode)) != 1)
{
TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
return(0);
@ -545,7 +545,7 @@ if (!defined("PCL_TAR"))
else if (is_string($p_index))
{
// ----- Call the extracting fct
if (($v_result = PclTarHandleExtractByIndexList($p_tarname, $p_index, &$p_list, $p_path, $p_remove_path, $v_tar_mode)) != 1)
if (($v_result = PclTarHandleExtractByIndexList($p_tarname, $p_index, $p_list, $p_path, $p_remove_path, $v_tar_mode)) != 1)
{
TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
return(0);
@ -603,7 +603,7 @@ if (!defined("PCL_TAR"))
if (is_array($p_filelist))
{
// ----- Call the extracting fct
if (($v_result = PclTarHandleDelete($p_tarname, $p_filelist, &$p_list, $p_mode)) != 1)
if (($v_result = PclTarHandleDelete($p_tarname, $p_filelist, $p_list, $p_mode)) != 1)
{
TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
return(0);
@ -617,7 +617,7 @@ if (!defined("PCL_TAR"))
$v_list = explode(" ", $p_filelist);
// ----- Call the extracting fct
if (($v_result = PclTarHandleDelete($p_tarname, $v_list, &$p_list, $p_mode)) != 1)
if (($v_result = PclTarHandleDelete($p_tarname, $v_list, $p_list, $p_mode)) != 1)
{
TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
return(0);
@ -676,7 +676,7 @@ if (!defined("PCL_TAR"))
if (is_array($p_filelist))
{
// ----- Call the extracting fct
if (($v_result = PclTarHandleUpdate($p_tarname, $p_filelist, &$p_list, $p_mode, $p_add_dir, $p_remove_dir)) != 1)
if (($v_result = PclTarHandleUpdate($p_tarname, $p_filelist, $p_list, $p_mode, $p_add_dir, $p_remove_dir)) != 1)
{
TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
return(0);
@ -690,7 +690,7 @@ if (!defined("PCL_TAR"))
$v_list = explode(" ", $p_filelist);
// ----- Call the extracting fct
if (($v_result = PclTarHandleUpdate($p_tarname, $v_list, &$p_list, $p_mode, $p_add_dir, $p_remove_dir)) != 1)
if (($v_result = PclTarHandleUpdate($p_tarname, $v_list, $p_list, $p_mode, $p_add_dir, $p_remove_dir)) != 1)
{
TrFctEnd(__FILE__, __LINE__, 0, PclErrorString());
return(0);
@ -2719,7 +2719,7 @@ if (!defined("PCL_TAR"))
$v_binary_data = gzread($v_tar, 512);
// ----- Read the header properties
if (($v_result = PclTarHandleReadHeader($v_binary_data, &$v_header)) != 1)
if (($v_result = PclTarHandleReadHeader($v_binary_data, $v_header)) != 1)
{
// ----- Close the archive file
if ($p_tar_mode == "tar")
@ -3011,7 +3011,7 @@ if (!defined("PCL_TAR"))
$v_binary_data = gzread($v_tar, 512);
// ----- Read the header properties
if (($v_result = PclTarHandleReadHeader($v_binary_data, &$v_header)) != 1)
if (($v_result = PclTarHandleReadHeader($v_binary_data, $v_header)) != 1)
{
// ----- Close the archive file
if ($p_tar_mode == "tar")
@ -3556,4 +3556,4 @@ if (!defined("PCL_TAR"))
// ----- End of double include look
}
?>
?>

View File

@ -56,16 +56,16 @@ class e_search
foreach ($this -> keywords['split'] as $k_key => $key)
{
if (!$this -> stopword($key)) {
if ($key{($tp->ustrlen($key) - 1)} == '*') {
if ($key[($tp->ustrlen($key) - 1)] == '*') {
$this -> keywords['wildcard'][$k_key] = TRUE;
$key = $tp->usubstr($key, 0, -1);
} else {
$this -> keywords['wildcard'][$k_key] = FALSE;
}
if ($key{0} == '+') {
if ($key[0] == '+') {
$this -> keywords['boolean'][$k_key] = '+';
$this -> keywords['match'][$k_key] = substr($key, 1);
} else if ($key{0} == '-') {
} else if ($key[0] == '-') {
$this -> keywords['boolean'][$k_key] = '-';
$this -> keywords['match'][$k_key] = substr($key, 1);
} else {
@ -451,10 +451,10 @@ class e_search
{
global $search_prefs;
$tp = e107::getParser();
if ($search_prefs['mysql_sort'] && ($key{0} == '+')) {
if ($search_prefs['mysql_sort'] && ($key[0] == '+')) {
$key = $tp->usubstr($key, 1);
}
if (($key{($tp->ustrlen($key) - 1)} != '*') && ($key{0} != '+')) {
if (($key[($tp->ustrlen($key) - 1)] != '*') && ($key[0] != '+')) {
if ($tp->ustrlen($key) > 2) {
if ($search_prefs['mysql_sort']) {
$stopword_list = $this -> stopwords_mysql;

View File

@ -46,7 +46,7 @@ function utf8_to_unicode($str) {
for($i = 0; $i < $len; $i++) {
$in = ord($str{$i});
$in = ord($str[$i]);
if ( $mState == 0) {

View File

@ -115,7 +115,7 @@ class list_forum
}
else
{
if($thread_lastuser{0} == "0")
if($thread_lastuser[0] == "0")
{
$LASTPOST = substr($thread_lastuser, 2);
}