Author: Jorg Sowa (jorgsowa)
Committer: Derick Rethans (derickr)
Date: 2026-11-30T14:51:17Z

Commit: 
https://github.com/php/web-wiki/commit/25b9fb4b2cf4f14cad134b5d140f00db315ce904
Raw diff: 
https://github.com/php/web-wiki/commit/25b9fb4b2cf4f14cad134b5d140f00db315ce904.diff

Prepare for PHP 8.4

- Apply Rector PHP 8.4 set to phpcvs, phplinks, phpreg and phpnet template
- phpcvs: declare $cnf (dynamic property), restrict unserialize() classes
- phpnet detail: use tpl_img_meta() and DetailMenu like the core template
- doodle: replace deprecated strftime() with dformat()
- httpd.conf: replace Order/Allow/Deny with Require

Changed paths:
  M  dokuwiki/lib/plugins/doodle/syntax.php
  M  dokuwiki/lib/plugins/phpcvs/auth.php
  M  dokuwiki/lib/plugins/phplinks/syntax.php
  M  dokuwiki/lib/plugins/phpreg/action.php
  M  dokuwiki/lib/tpl/phpnet/detail.php
  M  dokuwiki/lib/tpl/phpnet/images/pagetools-build.php
  M  dokuwiki/lib/tpl/phpnet/main.php
  M  dokuwiki/lib/tpl/phpnet/mediamanager.php
  M  httpd.conf


Diff:

diff --git a/dokuwiki/lib/plugins/doodle/syntax.php 
b/dokuwiki/lib/plugins/doodle/syntax.php
index e00898a4..6bff767c 100755
--- a/dokuwiki/lib/plugins/doodle/syntax.php
+++ b/dokuwiki/lib/plugins/doodle/syntax.php
@@ -303,7 +303,7 @@ function render($mode, Doku_Renderer $renderer, $data) {
                   $this->template['doodleData']["$fullname"]['username'] = 
$userData['username'];
                 }
                 if (in_array($col, $userData['choices'])) {
-                    $timeLoc = strftime($conf['dformat'], $userData['time']);  
// localized time of vote
+                    $timeLoc = dformat($userData['time']);  // localized time 
of vote
                     $this->template['doodleData']["$fullname"]['choice'][$col] 
=
                         '<td class="data_data" 
style="background-color:#AFA"><img src="'.DOKU_BASE.'lib/images/success.png" 
title="'.$timeLoc.'"></td>';
                     $this->template['count']["$col"]++;
diff --git a/dokuwiki/lib/plugins/phpcvs/auth.php 
b/dokuwiki/lib/plugins/phpcvs/auth.php
index c6d7c2a1..310bff86 100755
--- a/dokuwiki/lib/plugins/phpcvs/auth.php
+++ b/dokuwiki/lib/plugins/phpcvs/auth.php
@@ -12,6 +12,7 @@
 
 class auth_plugin_phpcvs extends auth_plugin_authplain {
 
+    protected $cnf;
 
     /**
      * Constructor.
@@ -37,7 +38,7 @@ public function __construct() {
 
 
     /* There is no magic cookie, so don't trust it ! */
-  function trustExternal($user,$pass,$sticky=false){
+  public function trustExternal($user,$pass,$sticky=false){
       return false;
     }
 
@@ -49,12 +50,12 @@ function trustExternal($user,$pass,$sticky=false){
      *
      * @return  bool true or int error code
      */
-    function _setCVSUser($user){
+    public function _setCVSUser($user){
       $this->loadUserData();
       $this->users[$user]['pass'] = null;
       $this->users[$user]['name'] = $user;
       $this->users[$user]['mail'] = $user.'@php.net';
-      $grps = array('phpcvs');
+      $grps = ['phpcvs'];
       if (in_array($user, $this->cnf['admins'])) {
         $grps[] = 'admin';
       }
@@ -69,30 +70,30 @@ function _setCVSUser($user){
      *
      * @return  bool true or int error code
      */
-    function _checkCVSPass($user, $pass = '')
+    public function _checkCVSPass($user, $pass = '')
     {
         static $userCache = [];
 
         if (!array_key_exists($user, $userCache)) {
             $post = http_build_query(
-                array(
+                [
                     "token" => getenv("dokuwikitoken"),
                     "username" => $user,
                     "password" => $pass,
-                ), '', '&'
+                ], '', '&'
             );
 
-            $opts = array(
+            $opts = [
                 "method" => "POST",
                 "header" => "Content-type: application/x-www-form-urlencoded",
                 "content" => $post,
-            );
+            ];
 
-            $ctx = stream_context_create(array("http" => $opts));
+            $ctx = stream_context_create(["http" => $opts]);
 
             $s = file_get_contents("https://main.php.net/fetch/cvsauth.php";, 
false, $ctx);
 
-            $a = unserialize($s);
+            $a = unserialize($s, ['allowed_classes' => false]);
             $userCache[$user] = $a;
         } else {
             $a = $userCache[$user];
@@ -122,7 +123,7 @@ function _checkCVSPass($user, $pass = '')
      *
      * @return  bool
      */
-    function checkPass($user,$pass){
+    public function checkPass($user,$pass){
       $cvs_reply = $this->_checkCVSPass($user,$pass);
 
       if ($cvs_reply === true) {
@@ -147,14 +148,14 @@ function checkPass($user,$pass){
      *
      * @author  Andreas Gohr <[email protected]>
      */
-    function getUserData($user, $requireGroups = true){
+    public function getUserData($user, $requireGroups = true){
       $cvs_reply = $this->_checkCVSPass($user);
       if ($cvs_reply === 2) {
         $this->_setCVSUser($user);
       }
 
       if($this->users === null) $this->loadUserData();
-      return isset($this->users[$user]) ? $this->users[$user] : false;
+      return $this->users[$user] ?? false;
     }
 
     /**
@@ -164,8 +165,8 @@ function getUserData($user, $requireGroups = true){
      *  @param   array  $users   array of users to be deleted
      *  @return  int             the number of users deleted
      */
-    function deleteUsers($users) {
-      $deleted = array();
+    public function deleteUsers($users) {
+      $deleted = [];
       foreach ($users as $key => $user) {
         $cvs_reply = $this->_checkCVSPass($user);
         // user exists because we got a password mismatch error
diff --git a/dokuwiki/lib/plugins/phplinks/syntax.php 
b/dokuwiki/lib/plugins/phplinks/syntax.php
index 04411db3..0cb5ae06 100644
--- a/dokuwiki/lib/plugins/phplinks/syntax.php
+++ b/dokuwiki/lib/plugins/phplinks/syntax.php
@@ -22,7 +22,7 @@ class syntax_plugin_phplinks extends DokuWiki_Syntax_Plugin
      *
      * @return string
      */
-    function getType()
+    public function getType()
     {
         return 'substition';
     }
@@ -34,7 +34,7 @@ function getType()
      *
      * @link https://www.dokuwiki.org/devel:parser:getsort_list
      */
-    function getSort()
+    public function getSort()
     {
         return 299;
     }
@@ -46,7 +46,7 @@ function getSort()
      *
      * @return void
      */
-    function connectTo($mode)
+    public function connectTo($mode)
     {
         $this->Lexer->addSpecialPattern(
             '\[\[[-a-z]+\@\d+[^\]]*\]\]', $mode, 'plugin_phplinks'
@@ -63,17 +63,17 @@ function connectTo($mode)
      *
      * @return void
      */
-    function handle($match, $state, $pos, Doku_Handler $handler)
+    public function handle($match, $state, $pos, Doku_Handler $handler)
     {
         preg_match('/\[\[([-a-z]+)\@(\d+)\|?([^\]]*)\]\]/', $match, $matches);
         if ($matches[1] == 'bugid') {
-            $name = $matches[3] ? $matches[3] : 'bug #' . $matches[2];
+            $name = $matches[3] ?: 'bug #' . $matches[2];
             $url = 'http://bugs.php.net/bug.php?id=' . $matches[2];
         } else {
-            $name = $matches[3] ? $matches[3] : 'ml#' . $matches[2];
+            $name = $matches[3] ?: 'ml#' . $matches[2];
             $url = 'http://marc.info/?l=' . $matches[1] . '&m=' . $matches[2];
         }
-        return array($name, $url);
+        return [$name, $url];
     }
 
     /**
@@ -85,7 +85,7 @@ function handle($match, $state, $pos, Doku_Handler $handler)
      *
      * @return void
      */
-    function render($mode, Doku_Renderer $renderer, $data)
+    public function render($mode, Doku_Renderer $renderer, $data)
     {
         if ($mode == 'xhtml') {
             $renderer->doc .= $this->_renderLink($renderer, $data[0], 
$data[1]);
@@ -109,7 +109,7 @@ private function _renderLink(Doku_Renderer $renderer, 
$name, $url)
     {
         global $conf;
 
-        $link = array(
+        $link = [
             'target' => $conf['target']['wiki'],
             'style'  => '',
             'pre'    => '',
@@ -119,7 +119,7 @@ private function _renderLink(Doku_Renderer $renderer, 
$name, $url)
             'url'    => $url,
             'name'   => $name,
             'title'  => $renderer->_xmlEntities($name)
-        );
+        ];
         return $renderer->_formatLink($link);
     }
 }
diff --git a/dokuwiki/lib/plugins/phpreg/action.php 
b/dokuwiki/lib/plugins/phpreg/action.php
index 0b10b297..588c1de3 100644
--- a/dokuwiki/lib/plugins/phpreg/action.php
+++ b/dokuwiki/lib/plugins/phpreg/action.php
@@ -39,7 +39,7 @@ public function register(Doku_Event_Handler $controller)
             'BEFORE',
             $this,
             'handle_act_preprocess',
-            array()
+            []
         );
     }
 
@@ -82,7 +82,7 @@ public function handle_act_preprocess(Doku_Event &$event, 
$param)
         if ($act != 'register' || !isset($_POST['save'])) {
             return;
         }
-        $spam = isset($_POST['spam']) ? $_POST['spam'] : '';
+        $spam = $_POST['spam'] ?? '';
         $spam = trim(preg_replace('/[\x00-\x1f:<>&%,;]+/', '', $spam));
         if ($spam != '[email protected]') {
             msg("That wasn't the answer we were expecting", -1);
diff --git a/dokuwiki/lib/tpl/phpnet/detail.php 
b/dokuwiki/lib/tpl/phpnet/detail.php
index ec846f6f..5423dbaf 100644
--- a/dokuwiki/lib/tpl/phpnet/detail.php
+++ b/dokuwiki/lib/tpl/phpnet/detail.php
@@ -22,7 +22,7 @@
     
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
     <?php tpl_metaheaders()?>
     <meta name="viewport" content="width=device-width,initial-scale=1" />
-    <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
+    <?php echo tpl_favicon(['favicon', 'mobile']) ?>
     <?php tpl_includeFile('meta.html') ?>
 </head>
 
@@ -55,37 +55,7 @@
                         <?php tpl_img(900,700); /* parameters: maximum width, 
maximum height (and more) */ ?>
 
                         <div class="img_detail">
-                            <dl>
-                                <?php
-                                    // @todo: logic should be transferred to 
backend
-                                    $config_files = 
getConfigFiles('mediameta');
-                                    foreach ($config_files as $config_file) {
-                                        if(@file_exists($config_file)) {
-                                            include($config_file);
-                                        }
-                                    }
-
-                                    foreach($fields as $key => $tag){
-                                        $t = array();
-                                        if (!empty($tag[0])) {
-                                            $t = array($tag[0]);
-                                        }
-                                        if(is_array($tag[3])) {
-                                            $t = array_merge($t,$tag[3]);
-                                        }
-                                        $value = tpl_img_getTag($t);
-                                        if ($value) {
-                                            echo 
'<dt>'.$lang[$tag[1]].':</dt><dd>';
-                                            if ($tag[2] == 'date') {
-                                                echo dformat($value);
-                                            } else {
-                                                echo hsc($value);
-                                            }
-                                            echo '</dd>';
-                                        }
-                                    }
-                                ?>
-                            </dl>
+                            <?php tpl_img_meta(); ?>
                         </div>
                         <?php //Comment in for Debug// 
dbg(tpl_img_getTag('Simple.Raw'));?>
                     <?php endif; ?>
@@ -108,30 +78,7 @@
                     <h3 class="a11y"><?php echo $lang['page_tools']; ?></h3>
                     <div class="tools">
                         <ul>
-                            <?php
-                                $data = array();
-                                $data['view'] = 'detail';
-
-                                // View in media manager; @todo: transfer 
logic to backend
-                                $imgNS = getNS($IMG);
-                                $authNS = auth_quickaclcheck("$imgNS:*");
-                                if (($authNS >= AUTH_UPLOAD) && 
function_exists('media_managerURL')) {
-                                    $mmURL = media_managerURL(array('ns' => 
$imgNS, 'image' => $IMG));
-                                    $data['items']['mediaManager'] = '<li><a 
href="'.$mmURL.'" 
class="mediaManager"><span>'.$lang['img_manager'].'</span></a></li>';
-                                }
-
-                                // Back to [ID]; @todo: transfer logic to 
backend
-                                $data['items']['img_backto'] = '<li><a 
href="'.wl($ID).'" class="back"><span>'.$lang['img_backto'].' 
'.$ID.'</span></a></li>';
-
-                                // the page tools can be amended through a 
custom plugin hook
-                                $evt = new 
Doku_Event('TEMPLATE_PAGETOOLS_DISPLAY', $data);
-                                if($evt->advise_before()){
-                                    foreach($evt->data['items'] as $k => 
$html) echo $html;
-                                }
-                                $evt->advise_after();
-                                unset($data);
-                                unset($evt);
-                            ?>
+                            <?php echo (new 
\dokuwiki\Menu\DetailMenu())->getListItems(); ?>
                         </ul>
                     </div>
                 </div>
diff --git a/dokuwiki/lib/tpl/phpnet/images/pagetools-build.php 
b/dokuwiki/lib/tpl/phpnet/images/pagetools-build.php
index 1b7262ad..283fd5e7 100644
--- a/dokuwiki/lib/tpl/phpnet/images/pagetools-build.php
+++ b/dokuwiki/lib/tpl/phpnet/images/pagetools-build.php
@@ -82,11 +82,11 @@ function hex2rgb($hex) {
     }
 
     // calc rgb
-    return array(
+    return [
        'r' => hexdec(substr($hex, 0, 2)),
        'g' => hexdec(substr($hex, 2, 2)),
        'b' => hexdec(substr($hex, 4, 2))
-    );
+    ];
 }
 
 /**
diff --git a/dokuwiki/lib/tpl/phpnet/main.php b/dokuwiki/lib/tpl/phpnet/main.php
index f52f9a2e..e2cfae8c 100644
--- a/dokuwiki/lib/tpl/phpnet/main.php
+++ b/dokuwiki/lib/tpl/phpnet/main.php
@@ -14,33 +14,33 @@
 $hasSidebar = page_findnearest($conf['sidebar']);
 $showSidebar = $hasSidebar && ($ACT=='show');
 $TITLE = tpl_pagetitle(null, true);
-$SEARCH    = array(
+$SEARCH    = [
  "method"      => "get",
  "action"      => "/start",
  "placeholder" => "Search",
  "name"        => "id",
- "hidden"      => array(array("name" => "do", "value" => "search")),
+ "hidden"      => [["name" => "do", "value" => "search"]],
 
-);
+];
 
 if (empty($_SERVER['REMOTE_USER'])) {
-    $LINKS = array(
-        array("href" => "?do=login",    "text" => "Login",),
-        array("href" => "?do=register", "text" => "Register", ),
-    );
+    $LINKS = [
+        ["href" => "?do=login",    "text" => "Login",],
+        ["href" => "?do=register", "text" => "Register", ],
+    ];
 } else {
     $name = hsc($INFO['userinfo']['name']).' ('.hsc($_SERVER['REMOTE_USER']). 
')';
-    $LINKS = array(
-        array("href" => "?do=edit",     "text" => "Edit this page",),
-        array("href" => "?do=admin",    "text" => "Admin",),
-        array("href" => "?do=logout&sectok=" . urlencode(getSecurityToken()), 
"text" => "Logout",),
-        array("href" => "?do=profile",  "text" => $name,),
-    );
+    $LINKS = [
+        ["href" => "?do=edit",     "text" => "Edit this page",],
+        ["href" => "?do=admin",    "text" => "Admin",],
+        ["href" => "?do=logout&sectok=" . urlencode(getSecurityToken()), 
"text" => "Logout",],
+        ["href" => "?do=profile",  "text" => $name,],
+    ];
 }
 ob_start();
 tpl_metaheaders();
 $HEAD_WIKI = ob_get_clean();
-$CSS = array("/styles/wiki.css");
+$CSS = ["/styles/wiki.css"];
 
 include __DIR__ . "/../../../shared/templates/header.inc";
 ?>
diff --git a/dokuwiki/lib/tpl/phpnet/mediamanager.php 
b/dokuwiki/lib/tpl/phpnet/mediamanager.php
index dadf2b10..20a3e36a 100644
--- a/dokuwiki/lib/tpl/phpnet/mediamanager.php
+++ b/dokuwiki/lib/tpl/phpnet/mediamanager.php
@@ -20,7 +20,7 @@
     
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
     <?php tpl_metaheaders()?>
     <meta name="viewport" content="width=device-width,initial-scale=1" />
-    <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
+    <?php echo tpl_favicon(['favicon', 'mobile']) ?>
     <?php tpl_includeFile('meta.html') ?>
 </head>
 
diff --git a/httpd.conf b/httpd.conf
index 5ab83b3a..a5e8efaa 100644
--- a/httpd.conf
+++ b/httpd.conf
@@ -13,8 +13,7 @@
        <Directory /var/www/html>
                Options +FollowSymLinks
                AllowOverride All
-               Order allow,deny
-               Allow from all
+               Require all granted
                RewriteEngine on
                RewriteBase /
                # For local development only
@@ -45,7 +44,6 @@
 
        # Forbid all dot files like .git or .svn
        <DirectoryMatch "^\.|\/\.">
-               Order allow,deny
-               Deny from all
+               Require all denied
        </DirectoryMatch>
 </VirtualHost>

Reply via email to