PHP Classes

chmod

Recommend this page to a friend!

      TAR/GZIP/BZIP2/ZIP Archives  >  All threads  >  chmod  >  (Un) Subscribe thread alerts  
Subject:chmod
Summary:It appears that php 5.2.3 chmod is broken
Messages:1
Author:Mark Richards
Date:2007-09-14 15:24:23
 

  1. chmod   Reply   Report abuse  
Picture of Mark Richards Mark Richards - 2007-09-14 15:24:23
Extracting a file from a tar.gz that has permissions 0600 yielded a file with permission way different. At least they were consistent.

After some experimentation I found that passing a *string* to represent the decimal attribute value will not work. The function seems to only work if the attribute is hard-coded into the function call:
chmod($cFile,0600);

I ended up doing this:

$cStat=substr($file['stat'][2],4);
system("chmod $cStat ".$file['name']);

The full value of $file['stat'][2] is also quite strange. In my case it is 0100600. php's chmod accepts only 3 octal digits in decimal integer form (0+nnn). Anything beyond this seems to create all sorts of weird results.