Skip to content

Commit

Permalink
Merge pull request #2875 from syntaxseed/fix-php-73-deprecations-part1
Browse files Browse the repository at this point in the history
Fix PHP 7.3 deprecations in lib/ directory (Part 1).
  • Loading branch information
splitbrain committed Oct 31, 2019
2 parents 96f9d7b + 5b52411 commit 1fd2aeb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/exe/css.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ public function replacements($match) {
if (preg_match('#^(/|data:|https?://)#', $match[3])) { // not a relative url? - no adjustment required
return $match[0];
} elseif (substr($match[3], -5) == '.less') { // a less file import? - requires a file system location
if ($match[3]{0} != '/') {
if ($match[3][0] != '/') {
$match[3] = $this->getRelativePath() . '/' . $match[3];
}
} else { // everything else requires a url adjustment
Expand Down
26 changes: 13 additions & 13 deletions lib/exe/js.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function js_load($file){
$loaded[$base] = true;
}

if($ifile{0} != '/') $ifile = dirname($file).'/'.$ifile;
if($ifile[0] != '/') $ifile = dirname($file).'/'.$ifile;

if(file_exists($ifile)){
$idata = io_readFile($ifile);
Expand Down Expand Up @@ -362,13 +362,13 @@ function js_compress($s){
// reserved word (e.g. "for", "else", "if") or a
// variable/object/method (e.g. "foo.color")
while ($i < $slen && (strpos($chars,$s[$i]) === false) ){
$result .= $s{$i};
$result .= $s[$i];
$i = $i + 1;
}

$ch = $s{$i};
$ch = $s[$i];
// multiline comments (keeping IE conditionals)
if($ch == '/' && $s{$i+1} == '*' && $s{$i+2} != '@'){
if($ch == '/' && $s[$i+1] == '*' && $s[$i+2] != '@'){
$endC = strpos($s,'*/',$i+2);
if($endC === false) trigger_error('Found invalid /*..*/ comment', E_USER_ERROR);

Expand All @@ -387,7 +387,7 @@ function js_compress($s){
}

// singleline
if($ch == '/' && $s{$i+1} == '/'){
if($ch == '/' && $s[$i+1] == '/'){
$endC = strpos($s,"\n",$i+2);
if($endC === false) trigger_error('Invalid comment', E_USER_ERROR);
$i = $endC;
Expand All @@ -398,15 +398,15 @@ function js_compress($s){
if($ch == '/'){
// rewind, skip white space
$j = 1;
while(in_array($s{$i-$j}, $whitespaces_chars)){
while(in_array($s[$i-$j], $whitespaces_chars)){
$j = $j + 1;
}
if( in_array($s{$i-$j}, $regex_starters) ){
if( in_array($s[$i-$j], $regex_starters) ){
// yes, this is an re
// now move forward and find the end of it
$j = 1;
while($s{$i+$j} != '/'){
if($s{$i+$j} == '\\') $j = $j + 2;
while($s[$i+$j] != '/'){
if($s[$i+$j] == '\\') $j = $j + 2;
else $j++;
}
$result .= substr($s,$i,$j+1);
Expand All @@ -418,8 +418,8 @@ function js_compress($s){
// double quote strings
if($ch == '"'){
$j = 1;
while( $s{$i+$j} != '"' && ($i+$j < $slen)){
if( $s{$i+$j} == '\\' && ($s{$i+$j+1} == '"' || $s{$i+$j+1} == '\\') ){
while( $s[$i+$j] != '"' && ($i+$j < $slen)){
if( $s[$i+$j] == '\\' && ($s[$i+$j+1] == '"' || $s[$i+$j+1] == '\\') ){
$j += 2;
}else{
$j += 1;
Expand All @@ -436,8 +436,8 @@ function js_compress($s){
// single quote strings
if($ch == "'"){
$j = 1;
while( $s{$i+$j} != "'" && ($i+$j < $slen)){
if( $s{$i+$j} == '\\' && ($s{$i+$j+1} == "'" || $s{$i+$j+1} == '\\') ){
while( $s[$i+$j] != "'" && ($i+$j < $slen)){
if( $s[$i+$j] == '\\' && ($s[$i+$j+1] == "'" || $s[$i+$j+1] == '\\') ){
$j += 2;
}else{
$j += 1;
Expand Down
12 changes: 6 additions & 6 deletions lib/plugins/acl/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function handle()
$lines = array();
// keep header
foreach ($AUTH_ACL as $line) {
if ($line{0} == '#') {
if ($line[0] == '#') {
$lines[] = $line;
} else {
break;
Expand Down Expand Up @@ -443,7 +443,7 @@ protected function printExplanation($current)
}

// prepare who to check
if ($who{0} == '@') {
if ($who[0] == '@') {
$user = '';
$groups = array(ltrim($who, '@'));
} else {
Expand Down Expand Up @@ -657,7 +657,7 @@ protected function printAclTable()
echo '</td>';

echo '<td>';
if ($who{0} == '@') {
if($who[0] == '@') {
echo '<span class="aclgroup">'.hsc($who).'</span>';
} else {
echo '<span class="acluser">'.hsc($who).'</span>';
Expand Down Expand Up @@ -804,7 +804,7 @@ protected function makeSelect()
if ($this->who &&
!in_array($this->who, $this->usersgroups) &&
!in_array($this->who, $this->specials)) {
if ($this->who{0} == '@') {
if ($this->who[0] == '@') {
$gsel = ' selected="selected"';
} else {
$usel = ' selected="selected"';
Expand All @@ -826,7 +826,7 @@ protected function makeSelect()
$sel = '';
}

if ($ug{0} == '@') {
if ($ug[0] == '@') {
echo ' <option value="'.hsc($ug).'" class="aclgroup"'.$sel.'>'.hsc($ug).'</option>'.NL;
} else {
echo ' <option value="'.hsc($ug).'" class="acluser"'.$sel.'>'.hsc($ug).'</option>'.NL;
Expand All @@ -844,7 +844,7 @@ protected function makeSelect()
$sel = '';
}

if ($ug{0} == '@') {
if ($ug[0] == '@') {
echo ' <option value="'.hsc($ug).'" class="aclgroup"'.$sel.'>'.hsc($ug).'</option>'.NL;
} else {
echo ' <option value="'.hsc($ug).'" class="acluser"'.$sel.'>'.hsc($ug).'</option>'.NL;
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/info/syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected function renderHelperMethods(Doku_Renderer_xhtml $renderer)
foreach ($method['params'] as $desc => $type) {
$params[] = hsc($desc).'</td><td>'.hsc($type);
}
$doc .= join($params, '</td></tr><tr><td>').'</td></tr>';
$doc .= join('</td></tr><tr><td>', $params).'</td></tr>';
}
if ($method['return']) {
$doc .= '<tr><th>Return value</th><td>'.hsc(key($method['return'])).
Expand Down

0 comments on commit 1fd2aeb

Please sign in to comment.