• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Printed config value log_file_permissions equal to 420?

#1
Hello

when I run the code below the output is 420, while my permissions are 0644 in config.php.

PHP Code:
print $this->config->item('log_file_permissions'); 

I looked through the code but can't get to understand how this works.

Context: I'm creating an ini file to save my config settings there and I just encountered this. When I change to 0700 for example it outputs 448. I need to save it as 0644. I'm convinced there's just something I don't know about or understand.

Thank you
Reply

#2
The leading 0 causes PHP to interpret the value as an octal number.
0700 octal is 448 decimal
0644 octal is 420 decimal
Reply

#3
0644 is simply written using octal notation.
420 is the same value, only presented as decimal.

It doesn't matter which one you write, unless you're saving it as a string (which would be wrong to begin with).

https://secure.php.net/integer
Reply

#4
Great thanks, I used decoct() to make it visually correct.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.