fuel / core

Fuel PHP Framework - The core of the Fuel v1 framework
http://fuelphp.com
813 stars 345 forks source link

Config::get/set behaving wrong when value has leading zero #848

Closed huglester closed 12 years ago

huglester commented 12 years ago

Hello everyone,

Playing with File class, I spotted that chmoded dir's/files have wrong permissions.

after searching around where the bug is, it seems that config class does not play nicely with values which has leading zeroes:

here are some tests:

    \Config::set('test_val', 0777);
    echo \Config::get('test_val');
    // returns 511

    \Config::set('test_val', 777);
    echo \Config::get('test_val');
    // returns 777

    \Config::set('test_val', '0777');
    echo \Config::get('test_val');
    // returns 0777 

It's a Linux machine. FuelPHP 1.1-dev

Thanks

frankdejonge commented 12 years ago

Hey huglester. I've done some testing, and when you normally var_dump(0777) it will print out in(511) as well. So this is not an issue with FuelPHP but with php itself.

jschreuder commented 12 years ago

This is not an issue at all: these values are octal (as they're prefixed with a zero) and the octal value 0777 equals 511 decimal. Which is fine.

Check out the explanation in http://nl.php.net/manual/en/function.chmod.php for the $mode argument.