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

Christian Futterlieb christian at futterlieb.ch
Sun Oct 3 23:45:21 CEST 2010


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).

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

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

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.

Regards Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getIniValueNumber.php
Type: application/x-httpd-php
Size: 715 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20101003/6a370080/attachment.php>


More information about the TYPO3-team-core mailing list