Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ini_get results are not canonized #4249

Closed
rcubetrac opened this issue Jun 20, 2013 · 3 comments
Closed

ini_get results are not canonized #4249

rcubetrac opened this issue Jun 20, 2013 · 3 comments

Comments

@rcubetrac
Copy link

Reported by donnerhacke on 20 Jun 2013 12:09 UTC as Trac ticket #1489189

iniset.php compares the ini_get results directly to stored numbers.

 foreach ($crit_opts as $optname => $optval) {
    if ($optval != ini_get($optname)) {

ini_get is documented to return "0 or the empty string" or "1" for boolean values. But it is (in the meantime) also allowed to return the real configuration string "On", "off", "True", "false", "Yes", "no" ...

So the correct code needs to use filter_val explicitly

 foreach ($crit_opts as $optname => $optval) {
    if (filter_var($optval,FILTER_VALIDATE_BOOLEAN)
        !==
        filter_var(ini_get($optname),FILTER_VALIDATE_BOOLEAN)) {

Please to no add FILTER_NULL_ON_FAILURE, because a missing value (i.e. module does not exists) can be safely considered as "false".

Migrated-From: http://trac.roundcube.net/ticket/1489189

@rcubetrac
Copy link
Author

Comment by @alecpl on 20 Jun 2013 13:13 UTC

Fixed in 39b905b.

@rcubetrac
Copy link
Author

Status changed by @alecpl on 20 Jun 2013 13:13 UTC

new => closed

@rcubetrac
Copy link
Author

Milestone changed by @alecpl on 20 Jun 2013 13:13 UTC

later => 0.9.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant