[TYPO3-core] RFC #4272: Inconsistent return values of ini_get() produce false positives for safe_mode detection

Marcus Krause marcus#exp2010 at t3sec.info
Mon Oct 4 08:34:55 CEST 2010


Hi!

Christian Futterlieb schrieb am 10/03/2010 11:45 PM Uhr:
> Hi!
> 
>> Example:
>> public static function isSafeModeEnabled() {
>>     return filter_var(ini_get('safe_mode'), FILTER_VALIDATE_BOOLEAN,
>> FILTER_REQUIRE_SCALAR | FILTER_NULL_ON_FAILURE);
>> }
> 
> This does not work for me (Ubuntu 10.04 LTS).

Strange! What makes you believe it's not working in your environment?
(Errors, unexpected results?)


> I got it working with AND disjunction:
> filter_var(ini_get('save_mode'), FILTER_VALIDATE_BOOLEAN,
> FILTER_REQUIRE_SCALAR & FILTER_NULL_ON_FAILURE)

This does not have the intended meaning!


> Or passing the options as array:
> filter_var(ini_get('save_mode'), FILTER_VALIDATE_BOOLEAN,
> array(FILTER_REQUIRE_SCALAR, FILTER_NULL_ON_FAILURE))

Passing the flags as array is a valid alternative. So if initial patch
does not work in all cases (see Christian's problem), we should use this
one.


> And: in the last patch the 'save_mode' remained in the function
> 'getIniValueBoolean()' ;)


> I would also suggest having a method getIniValueNumber(), that is able
> to return integer values definend like '32M'. See attached file for the
> code idea.

Nice idea. But please focus on the current patch for now! Your patch
needs to be a separate issue.


Marcus.


More information about the TYPO3-team-core mailing list