OSDN Git Service

BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5 (Patch from...
authorhenoheno <henoheno>
Sun, 2 Oct 2005 16:15:06 +0000 (01:15 +0900)
committerhenoheno <henoheno>
Sun, 2 Oct 2005 16:15:06 +0000 (01:15 +0900)
lib/file.php
lib/html.php
plugin/recent.inc.php
plugin/rss.inc.php
rules.ini.php

index ecd3c50..d44c459 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: file.php,v 1.38 2005/08/01 15:38:26 henoheno Exp $
+// $Id: file.php,v 1.39 2005/10/02 16:15:05 henoheno Exp $
 // Copyright (C)
 //   2002-2005 PukiWiki Developers Team
 //   2001-2002 Originally written by yu-ji
@@ -296,7 +296,11 @@ function put_lastmodified()
        set_file_buffer($fp, 0);
        flock($fp, LOCK_EX);
        rewind($fp);
-       foreach (array_splice(array_keys($recent_pages), 0, $maxshow) as $page) {
+
+       // Only variables can be passed by reference from PHP 5.0.5
+       $tmp_array = array_keys($recent_pages); // with array_splice()
+
+       foreach (array_splice($tmp_array, 0, $maxshow) as $page) {
                $time      = $recent_pages[$page];
                $s_lastmod = htmlspecialchars(format_date($time));
                $s_page    = htmlspecialchars($page);
index 05d475f..df5d162 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: html.php,v 1.42 2005/08/22 14:35:47 henoheno Exp $
+// $Id: html.php,v 1.43 2005/10/02 16:15:05 henoheno Exp $
 // Copyright (C)
 //   2002-2005 PukiWiki Developers Team
 //   2001-2002 Originally written by yu-ji
@@ -119,9 +119,12 @@ function catbody($title, $page, $body)
        if ($search_word_color && isset($vars['word'])) {
                $body = '<div class="small">' . $_msg_word . htmlspecialchars($vars['word']) .
                        '</div>' . $hr . "\n" . $body;
-               $words = array_flip(array_splice(
-                       preg_split('/\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY),
-                       0, 10));
+
+               // Only variables can be passed by reference from PHP 5.0.5
+               // with array_splice()
+               $tmp_array = preg_split('/\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY);
+
+               $words = array_flip(array_splice($tmp_array, 0, 10));
                $keys = array();
                foreach ($words as $word=>$id) $keys[$word] = strlen($word);
                arsort($keys, SORT_NUMERIC);
index e41709a..075122d 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// $Id: recent.inc.php,v 1.16 2005/07/17 10:55:28 henoheno Exp $
+// $Id: recent.inc.php,v 1.17 2005/10/02 16:15:06 henoheno Exp $
 // Copyright (C)
 //   2002-2005 PukiWiki Developers Team
 //   2002      Y.MASUI http://masui.net/pukiwiki/ masui@masui.net
@@ -46,7 +46,9 @@ function plugin_recent_convert()
 
        // Get latest N changes
        if (file_exists(PLUGIN_RECENT_CACHE)) {
-               $lines = array_splice(file(PLUGIN_RECENT_CACHE), 0, $recent_lines);
+               // Only variables can be passed by reference from PHP 5.0.5
+               $file_array = file(PLUGIN_RECENT_CACHE); // with array_splice()
+               $lines      = array_splice($file_array, 0, $recent_lines);
        } else {
                return '#recent(): Cache file of RecentChanges not found' . '<br />';
        }
index 5bacc5c..2f63a7a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone
-// $Id: rss.inc.php,v 1.15 2005/02/05 03:11:13 henoheno Exp $
+// $Id: rss.inc.php,v 1.16 2005/10/02 16:15:06 henoheno Exp $
 //
 // RSS plugin: Publishing RSS of RecentChanges
 //
@@ -35,7 +35,11 @@ function plugin_rss_action()
 
        // Creating <item>
        $items = $rdf_li = '';
-       foreach (array_splice(file($recent), 0, $rss_max) as $line) {
+
+       // Only variables can be passed by reference from PHP 5.0.5
+       $file_array = file($recent); // with array_splice()
+
+       foreach (array_splice($file_array, 0, $rss_max) as $line) {
                list($time, $page) = explode("\t", rtrim($line));
                $r_page = rawurlencode($page);
                $title  = mb_convert_encoding($page, 'UTF-8', SOURCE_ENCODING);
index ea6eecc..ba42de7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: rules.ini.php,v 1.7 2005/04/30 11:35:43 henoheno Exp $
+// $Id: rules.ini.php,v 1.8 2005/10/02 16:15:05 henoheno Exp $
 // Copyright (C)
 //   2003-2005 PukiWiki Developers Team
 //   2001-2002 Originally written by yu-ji
@@ -25,6 +25,10 @@ $datetime_rules = array(
 //  Á°¸å¤Ëɬ¤º / ¤ò´Þ¤á¤Æ¤¯¤À¤µ¤¤¡£¹ÔƬ»ØÄê¤Ï ^ ¤òƬ¤Ë¡£
 //  ¹ÔËö»ØÄê¤Ï $ ¤ò¸å¤í¤Ë¡£
 //
+
+// Only variables can be passed by reference from PHP 5.0.5
+$page_array = explode('/', $vars['page']); // with array_pop()
+
 $str_rules = array(
        'now\?'         => format_date(UTIME),
        'date\?'        => get_date($date_format),
@@ -32,9 +36,10 @@ $str_rules = array(
        '&now;'         => format_date(UTIME),
        '&date;'        => get_date($date_format),
        '&time;'        => get_date($time_format),
-       '&page;'        => array_pop(explode('/', $vars['page'])),
+       '&page;'        => array_pop($page_array),
        '&fpage;'       => $vars['page'],
        '&t;'           => "\t",
 );
+unset($page_array);
 
 ?>