WordPress.org

Make WordPress Core

Ticket #20365: 0001-fix-getnumchmodfromh.patch

File 0001-fix-getnumchmodfromh.patch, 1.3 KB (added by Keruspe, 6 years ago)

Patch to fix getnumchmodfromh (strpad on the left to replace "d" or "l" bits)

  • wp-admin/includes/class-wp-filesystem-base.php

    From 00556d81ae383c015fb33d2838bc06c23526ce06 Mon Sep 17 00:00:00 2001
    From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
    Date: Thu, 5 Apr 2012 11:43:46 +0200
    Subject: [PATCH] fix getnumchmodfromh
    
    Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
    ---
     wp-admin/includes/class-wp-filesystem-base.php |   10 +++++-----
     1 file changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php
    index 1f22f24..ca049dc 100644
    a b class WP_Filesystem_Base { 
    304304                   if ($key = array_search($attarray[$i], $legal))
    305305                           $realmode .= $legal[$key];
    306306
    307                 $mode = str_pad($realmode, 9, '-');
     307                $mode = str_pad($realmode, 10, '-', STR_PAD_LEFT);
    308308                $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
    309309                $mode = strtr($mode,$trans);
    310310
    311                 $newmode = '';
    312                 $newmode .= $mode[0] + $mode[1] + $mode[2];
    313                 $newmode .= $mode[3] + $mode[4] + $mode[5];
    314                 $newmode .= $mode[6] + $mode[7] + $mode[8];
     311                $newmode = $mode[0];
     312                $newmode .= $mode[1] + $mode[2] + $mode[3];
     313                $newmode .= $mode[4] + $mode[5] + $mode[6];
     314                $newmode .= $mode[7] + $mode[8] + $mode[9];
    315315                return $newmode;
    316316        }
    317317