• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

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

PukiWiki


Commit MetaInfo

修訂6ac4ecfdde6e5e5b1f0b85022c9c81b2c6a22c30 (tree)
時間2016-01-08 03:47:44
作者umorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack2/369 Follow PHP7 changes of internal array pointer

Backward incompatible change of PHP7:

foreach no longer changes the internal array pointer

We already don't use current() function for array to calculate prev/next.

http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.foreach.array-pointer
http://wiki.php.net/rfc/php7_foreach

Change Summary

差異

--- a/plugin/navi.inc.php
+++ b/plugin/navi.inc.php
@@ -97,13 +97,19 @@ function plugin_navi_convert()
9797 $pages = array_unique($pages);
9898 natcasesort($pages);
9999 if ($reverse) $pages = array_reverse($pages);
100-
100+ $pages = array_values($pages);
101101 $prev = $home;
102- foreach ($pages as $page) {
103- if ($page === $current) break;
102+ $next = '';
103+ foreach ($pages as $index=>$page) {
104+ if ($page === $current) {
105+ $next_key = $index + 1;
106+ if (array_key_exists($next_key, $pages)) {
107+ $next = $pages[$next_key];
108+ }
109+ break;
110+ }
104111 $prev = $page;
105112 }
106- $next = current($pages);
107113
108114 $pos = strrpos($current, '/');
109115 $up = '';