• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisiona6cac21c76c2e94d8b90a26a59764b7e0e4cfb81 (tree)
Zeit2021-03-13 15:14:30
Autorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2514 Support PHP 8

PHP8 - Backward Incompatible Changes

* Support for deprecated curly braces for offset access has been removed
* Fatal error: Inheritance errors due to incompatible method signatures
* get_magic_quotes_gpc() have been removed
* Fatal error: Undefined constant ( is_page )
* Nested ternaries now require explicit parentheses

Ändern Zusammenfassung

Diff

--- a/lib/config.php
+++ b/lib/config.php
@@ -1,7 +1,7 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone.
33 // config.php
4-// Copyright 2003-2016 PukiWiki Development Team
4+// Copyright 2003-2021 PukiWiki Development Team
55 // License: GPL v2 or (at your option) any later version
66 //
77 // Parse a PukiWiki page as a configuration page
@@ -49,7 +49,7 @@ class Config
4949 foreach (get_source($this->page) as $line) {
5050 if ($line == '') continue;
5151
52- $head = $line{0}; // The first letter
52+ $head = $line[0]; // The first letter
5353 $level = strspn($line, $head);
5454
5555 if ($level > 3) {
--- a/lib/convert_html.php
+++ b/lib/convert_html.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone
33 // convert_html.php
44 // Copyright
5-// 2002-2016 PukiWiki Development Team
5+// 2002-2021 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -64,7 +64,7 @@ class Element
6464 return $this->last = & $obj->last;
6565 }
6666
67- function canContain($obj)
67+ function canContain(& $obj)
6868 {
6969 return TRUE;
7070 }
@@ -186,7 +186,7 @@ class Inline extends Element
186186 return $this;
187187 }
188188
189- function canContain($obj)
189+ function canContain(& $obj)
190190 {
191191 return is_a($obj, 'Inline');
192192 }
@@ -226,7 +226,7 @@ class Paragraph extends Element
226226 $this->insert(Factory_Inline($text));
227227 }
228228
229- function canContain($obj)
229+ function canContain(& $obj)
230230 {
231231 return is_a($obj, 'Inline');
232232 }
@@ -531,7 +531,7 @@ class TableCell extends Element
531531 $name = $matches[2] ? 'background-color' : 'color';
532532 $this->style[$name] = $name . ':' . htmlsc($matches[3]) . ';';
533533 $text = $matches[5];
534- } else if ($matches[4]) {
534+ } else if (isset($matches[4])) {
535535 $this->style['size'] = 'font-size:' . htmlsc($matches[4]) . 'px;';
536536 $text = $matches[5];
537537 }
@@ -548,7 +548,7 @@ class TableCell extends Element
548548 $text = substr($text, 1);
549549 }
550550
551- if ($text != '' && $text{0} == '#') {
551+ if ($text != '' && $text[0] == '#') {
552552 // Try using Div class for this $text
553553 $obj = & Factory_Div($this, $text);
554554 if (is_a($obj, 'Paragraph'))
@@ -788,7 +788,7 @@ class Pre extends Element
788788 global $preformat_ltrim;
789789 parent::__construct();
790790 $this->elements[] = htmlsc(
791- (! $preformat_ltrim || $text == '' || $text{0} != ' ') ? $text : substr($text, 1));
791+ (! $preformat_ltrim || $text == '' || $text[0] != ' ') ? $text : substr($text, 1));
792792 }
793793
794794 function canContain(& $obj)
@@ -941,7 +941,7 @@ class Body extends Element
941941 }
942942
943943 // The first character
944- $head = $line{0};
944+ $head = $line[0];
945945
946946 // Heading
947947 if ($head == '*') {
--- a/lib/file.php
+++ b/lib/file.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone.
33 // file.php
44 // Copyright
5-// 2002-2020 PukiWiki Development Team
5+// 2002-2021 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -160,7 +160,7 @@ function make_str_rules($source)
160160 $line = & $lines[$i]; // Modify directly
161161
162162 // Ignore null string and preformatted texts
163- if ($line == '' || $line{0} == ' ' || $line{0} == "\t") continue;
163+ if ($line == '' || $line[0] == ' ' || $line[0] == "\t") continue;
164164
165165 // Modify this line?
166166 if ($modify) {
--- a/lib/func.php
+++ b/lib/func.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone.
33 // func.php
44 // Copyright
5-// 2002-2020 PukiWiki Development Team
5+// 2002-2021 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -1039,9 +1039,14 @@ function guess_script_absolute_uri()
10391039 function input_filter($param)
10401040 {
10411041 static $magic_quotes_gpc = NULL;
1042- if ($magic_quotes_gpc === NULL)
1043- $magic_quotes_gpc = get_magic_quotes_gpc();
1044-
1042+ if ($magic_quotes_gpc === NULL) {
1043+ if (function_exists('get_magic_quotes_gpc')) {
1044+ // No 'get_magic_quotes_gpc' function in PHP8
1045+ $magic_quotes_gpc = get_magic_quotes_gpc();
1046+ } else {
1047+ $magic_quotes_gpc = 0;
1048+ }
1049+ }
10451050 if (is_array($param)) {
10461051 return array_map('input_filter', $param);
10471052 } else {
@@ -1068,7 +1073,7 @@ function csv_explode($separator, $string)
10681073
10691074 foreach ($matches[1] as $str) {
10701075 $len = strlen($str);
1071- if ($len > 1 && $str{0} == '"' && $str{$len - 1} == '"')
1076+ if ($len > 1 && $str[0] == '"' && $str[$len - 1] == '"')
10721077 $str = str_replace('""', '"', substr($str, 1, -1));
10731078 $retval[] = $str;
10741079 }
@@ -1078,7 +1083,7 @@ function csv_explode($separator, $string)
10781083 // Implode an array with CSV data format (escape double quotes)
10791084 function csv_implode($glue, $pieces)
10801085 {
1081- $_glue = ($glue != '') ? '\\' . $glue{0} : '';
1086+ $_glue = ($glue != '') ? '\\' . $glue[0] : '';
10821087 $arr = array();
10831088 foreach ($pieces as $str) {
10841089 if (preg_match('/[' . '"' . "\n\r" . $_glue . ']/', $str))
--- a/lib/make_link.php
+++ b/lib/make_link.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone.
33 // make_link.php
44 // Copyright
5-// 2003-2020 PukiWiki Development Team
5+// 2003-2021 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -851,8 +851,9 @@ function make_pagelink($page, $alias = '', $anchor = '', $refer = '', $isautolin
851851
852852 $page_filetime = fast_get_filetime($page);
853853 $is_page = $page_filetime !== 0;
854- if (! isset($related[$page]) && $page !== $vars['page'] && is_page)
854+ if (! isset($related[$page]) && $page !== $vars['page'] && $is_page) {
855855 $related[$page] = $page_filetime;
856+ }
856857
857858 if ($isautolink || $is_page) {
858859 // Hyperlink to the page
@@ -905,7 +906,7 @@ function get_fullname($name, $refer)
905906 if ($name == '' || $name == './') return $refer;
906907
907908 // Absolute path
908- if ($name{0} == '/') {
909+ if ($name[0] == '/') {
909910 $name = substr($name, 1);
910911 return ($name == '') ? $defaultpage : $name;
911912 }
@@ -1024,7 +1025,7 @@ function get_ticketlink_jira_projects()
10241025 } else if (preg_match('/^--\s*([A-Z][A-Z0-9]{1,10}(?:_[A-Z0-9]{1,10}){0,2})(\s+(.+?))?\s*$/', $line, $m)) {
10251026 if ($active_jira_base_url) {
10261027 $project_key = $m[1];
1027- $title = $m[2];
1028+ $title = isset($m[2]) ? $m[2] : '';
10281029 array_push($jira_projects, array(
10291030 'key' => $m[1],
10301031 'title' => $title,
--- a/lib/plugin.php
+++ b/lib/plugin.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone.
33 // plugin.php
44 // Copyright
5-// 2002-2016 PukiWiki Development Team
5+// 2002-2021 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -51,20 +51,35 @@ function exist_plugin($name)
5151
5252 // Check if plugin API 'action' exists
5353 function exist_plugin_action($name) {
54- return function_exists('plugin_' . $name . '_action') ? TRUE : exist_plugin($name) ?
55- function_exists('plugin_' . $name . '_action') : FALSE;
54+ if (function_exists('plugin_' . $name . '_action')) {
55+ return TRUE;
56+ }
57+ if (exist_plugin($name)) {
58+ return function_exists('plugin_' . $name . '_action');
59+ }
60+ return FALSE;
5661 }
5762
5863 // Check if plugin API 'convert' exists
5964 function exist_plugin_convert($name) {
60- return function_exists('plugin_' . $name . '_convert') ? TRUE : exist_plugin($name) ?
61- function_exists('plugin_' . $name . '_convert') : FALSE;
65+ if (function_exists('plugin_' . $name . '_convert')) {
66+ return TRUE;
67+ }
68+ if (exist_plugin($name)) {
69+ return function_exists('plugin_' . $name . '_convert');
70+ }
71+ return FALSE;
6272 }
6373
6474 // Check if plugin API 'inline' exists
6575 function exist_plugin_inline($name) {
66- return function_exists('plugin_' . $name . '_inline') ? TRUE : exist_plugin($name) ?
67- function_exists('plugin_' . $name . '_inline') : FALSE;
76+ if (function_exists('plugin_' . $name . '_inline')) {
77+ return TRUE;
78+ }
79+ if (exist_plugin($name)) {
80+ return function_exists('plugin_' . $name . '_inline');
81+ }
82+ return FALSE;
6883 }
6984
7085 // Call 'init' function for the plugin
--- a/lib/proxy.php
+++ b/lib/proxy.php
@@ -1,7 +1,7 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone
33 // proxy.php
4-// Copyright: 2003-2017 PukiWiki Development Team
4+// Copyright: 2003-2021 PukiWiki Development Team
55 // License: GPL v2 or (at your option) any later version
66 //
77 // HTTP-Proxy related functions
@@ -130,7 +130,7 @@ function pkwk_http_request($url, $method = 'GET', $headers = '', $post = array()
130130 $url = trim($matches[1]);
131131 if (! preg_match('/^https?:\//', $url)) {
132132 // Relative path to Absolute
133- if ($url{0} != '/')
133+ if ($url[0] != '/')
134134 $url = substr($url_path, 0, strrpos($url_path, '/')) . '/' . $url;
135135 $url = $url_base . $url; // Add sheme, host
136136 }
--- a/plugin/dump.inc.php
+++ b/plugin/dump.inc.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone
33 // dump.inc.php
44 // Copyright
5-// 2004-2017 PukiWiki Development Team
5+// 2004-2021 PukiWiki Development Team
66 // 2004 teanan / Interfair Laboratory
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -488,7 +488,7 @@ class tarlib
488488 // ファイル名を保存
489489 for($i = 0; $i < strlen($filename); $i++ ) {
490490 if ($i < TARLIB_HDR_NAME_LEN) {
491- $tar_data[$i + TARLIB_HDR_NAME_OFFSET] = $filename{$i};
491+ $tar_data[$i + TARLIB_HDR_NAME_OFFSET] = $filename[$i];
492492 } else {
493493 break; // ファイル名が長すぎ
494494 }
@@ -497,32 +497,32 @@ class tarlib
497497 // mode
498498 $modeid = TARLIB_DATA_MODE;
499499 for($i = 0; $i < strlen($modeid); $i++ ) {
500- $tar_data[$i + TARLIB_HDR_MODE_OFFSET] = $modeid{$i};
500+ $tar_data[$i + TARLIB_HDR_MODE_OFFSET] = $modeid[$i];
501501 }
502502
503503 // uid / gid
504504 $ugid = TARLIB_DATA_UGID;
505505 for($i = 0; $i < strlen($ugid); $i++ ) {
506- $tar_data[$i + TARLIB_HDR_UID_OFFSET] = $ugid{$i};
507- $tar_data[$i + TARLIB_HDR_GID_OFFSET] = $ugid{$i};
506+ $tar_data[$i + TARLIB_HDR_UID_OFFSET] = $ugid[$i];
507+ $tar_data[$i + TARLIB_HDR_GID_OFFSET] = $ugid[$i];
508508 }
509509
510510 // サイズ
511511 $strsize = sprintf('%11o', $size);
512512 for($i = 0; $i < strlen($strsize); $i++ ) {
513- $tar_data[$i + TARLIB_HDR_SIZE_OFFSET] = $strsize{$i};
513+ $tar_data[$i + TARLIB_HDR_SIZE_OFFSET] = $strsize[$i];
514514 }
515515
516516 // 最終更新時刻
517517 $strmtime = sprintf('%o', $mtime);
518518 for($i = 0; $i < strlen($strmtime); $i++ ) {
519- $tar_data[$i + TARLIB_HDR_MTIME_OFFSET] = $strmtime{$i};
519+ $tar_data[$i + TARLIB_HDR_MTIME_OFFSET] = $strmtime[$i];
520520 }
521521
522522 // チェックサム計算用のブランクを設定
523523 $chkblanks = TARLIB_DATA_CHKBLANKS;
524524 for($i = 0; $i < strlen($chkblanks); $i++ ) {
525- $tar_data[$i + TARLIB_HDR_CHKSUM_OFFSET] = $chkblanks{$i};
525+ $tar_data[$i + TARLIB_HDR_CHKSUM_OFFSET] = $chkblanks[$i];
526526 }
527527
528528 // タイプフラグ
@@ -535,7 +535,7 @@ class tarlib
535535 }
536536 $strchksum = sprintf('%7o',$sum);
537537 for($i = 0; $i < strlen($strchksum); $i++ ) {
538- $tar_data[$i + TARLIB_HDR_CHKSUM_OFFSET] = $strchksum{$i};
538+ $tar_data[$i + TARLIB_HDR_CHKSUM_OFFSET] = $strchksum[$i];
539539 }
540540
541541 return $tar_data;
@@ -615,8 +615,8 @@ class tarlib
615615 $longname = '';
616616 } else {
617617 for ($i = 0; $i < TARLIB_HDR_NAME_LEN; $i++ ) {
618- if ($buff{$i + TARLIB_HDR_NAME_OFFSET} != "\0") {
619- $name .= $buff{$i + TARLIB_HDR_NAME_OFFSET};
618+ if ($buff[$i + TARLIB_HDR_NAME_OFFSET] != "\0") {
619+ $name .= $buff[$i + TARLIB_HDR_NAME_OFFSET];
620620 } else {
621621 break;
622622 }
@@ -630,22 +630,22 @@ class tarlib
630630 $checksum = '';
631631 $chkblanks = TARLIB_DATA_CHKBLANKS;
632632 for ($i = 0; $i < TARLIB_HDR_CHKSUM_LEN; $i++ ) {
633- $checksum .= $buff{$i + TARLIB_HDR_CHKSUM_OFFSET};
634- $buff{$i + TARLIB_HDR_CHKSUM_OFFSET} = $chkblanks{$i};
633+ $checksum .= $buff[$i + TARLIB_HDR_CHKSUM_OFFSET];
634+ $buff[$i + TARLIB_HDR_CHKSUM_OFFSET] = $chkblanks[$i];
635635 }
636636 list($checksum) = sscanf('0' . trim($checksum), '%i');
637637
638638 // Compute checksum
639639 $sum = 0;
640640 for($i = 0; $i < TARLIB_BLK_LEN; $i++ ) {
641- $sum += 0xff & ord($buff{$i});
641+ $sum += 0xff & ord($buff[$i]);
642642 }
643643 if ($sum != $checksum) break; // Error
644644
645645 // Size
646646 $size = '';
647647 for ($i = 0; $i < TARLIB_HDR_SIZE_LEN; $i++ ) {
648- $size .= $buff{$i + TARLIB_HDR_SIZE_OFFSET};
648+ $size .= $buff[$i + TARLIB_HDR_SIZE_OFFSET];
649649 }
650650 list($size) = sscanf('0' . trim($size), '%i');
651651
@@ -656,12 +656,12 @@ class tarlib
656656 // 最終更新時刻
657657 $strmtime = '';
658658 for ($i = 0; $i < TARLIB_HDR_MTIME_LEN; $i++ ) {
659- $strmtime .= $buff{$i + TARLIB_HDR_MTIME_OFFSET};
659+ $strmtime .= $buff[$i + TARLIB_HDR_MTIME_OFFSET];
660660 }
661661 list($mtime) = sscanf('0' . trim($strmtime), '%i');
662662
663663 // タイプフラグ
664-// $type = $buff{TARLIB_HDR_TYPE_OFFSET};
664+// $type = $buff[TARLIB_HDR_TYPE_OFFSET];
665665
666666 if ($name == TARLIB_DATA_LONGLINK) {
667667 // LongLink
--- a/plugin/tracker.inc.php
+++ b/plugin/tracker.inc.php
@@ -1,7 +1,7 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone
33 // tracker.inc.php
4-// Copyright 2003-2020 PukiWiki Development Team
4+// Copyright 2003-2021 PukiWiki Development Team
55 // License: GPL v2 or (at your option) any later version
66 //
77 // Issue tracker plugin (See Also bugtrack plugin)
@@ -1236,7 +1236,7 @@ class Tracker_list
12361236 // Ignore empty line
12371237 continue;
12381238 }
1239- $this->pipe = ($line{0} == '|' or $line{0} == ':');
1239+ $this->pipe = ($line[0] == '|' or $line[0] == ':');
12401240 $source .= preg_replace_callback('/\[([^\[\]]+)\]/',array(&$this,'replace_item'),$line);
12411241 }
12421242 }