[TYPO3-core] RFC #4272: Inconsistent return values of ini_get() produce false positives for safe_mode detection
Christian Futterlieb
christian at futterlieb.ch
Mon Oct 4 10:39:47 CEST 2010
Hi!
> Strange! What makes you believe it's not working in your environment?
> (Errors, unexpected results?)
Sorry for my not-explained objection.
The method getIniValueBoolean() does not return correct values (as
expected). ini_get() could return empty strings, when a option has a
null value. In this case filter_var() returns NULL instead of FALSE.
// without save_mode set in php.ini
var_dump(ini_get('safe_mode'));
var_dump(filter_var(ini_get('safe_mode'), FILTER_VALIDATE_BOOLEAN,
FILTER_REQUIRE_SCALAR | FILTER_NULL_ON_FAILURE));
string(0) ""
NULL
Of course this return value could be used in conditions (read: the patch
does what it looks like). But due to the method name I'd expect FALSE,
except when ini_get() returns "1", "true", "on" or "yes".
Sorry again for the angry 'It does not work'. Maybe it's nitpicking, but
I like it to count on clear return values.
Regards, Christian
More information about the TYPO3-team-core
mailing list