php_flag and php_value does not work properly
| Bug #60179 | php_flag and php_value does not work properly | ||||
|---|---|---|---|---|---|
| Submitted: | 2011-10-31 08:43 UTC | Modified: | 2011-11-03 15:48 UTC | ||
| From: | dbetz at df dot eu | Assigned: | fat (profile) | ||
| Status: | Closed | Package: | FPM related | ||
| PHP Version: | 5.3.8 | OS: | Gentoo Linux | ||
| Private report: | No | CVE-ID: | None | ||
[2011-10-31 08:43 UTC] dbetz at df dot eu
Description:
------------
Hello,
when setting php_flag to Off or false, then PHP FPM sets it to the string "Off" rather than 0 or NULL.
In fpm.conf
php_flag["session.auto_start"] = Off
or
php_flag["session.auto_start"] = false
It seems that the failure is on all boolean flags.
Test script:
---------------
<?
echo "session.auto_start is : " . ini_get('session.auto_start') . "\n";
if (ini_get('session.auto_start')) {
echo "Some code here .....\n";
}
?>
Expected result:
----------------
session.auto_start is : 0
Actual result:
--------------
session.auto_start is : Off
Patches
fpm-bug60179-v2.patch (last revision 2011-11-03 15:07 UTC by fat@php.net)fpm-bug60179.patch (last revision 2011-10-31 13:00 UTC by fat@php.net)
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2011-10-31 13:02 UTC] fat@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: fat
[2011-10-31 13:02 UTC] fat@php.net
[2011-10-31 13:11 UTC] dbetz at df dot eu
-Status: Feedback +Status: Assigned
[2011-10-31 13:11 UTC] dbetz at df dot eu
[2011-10-31 13:18 UTC] fat@php.net
[2011-10-31 13:18 UTC] fat@php.net
-Status: Assigned +Status: Feedback
[2011-10-31 13:52 UTC] dbetz at df dot eu
-Status: Feedback +Status: Assigned
[2011-10-31 13:52 UTC] dbetz at df dot eu
Hi fat, i have tested the latest snapshot with the patch and have changed the config to php_flag[session.auto_start] = Off But the problem is still here. Looking into fpm_conf.c at: static char *fpm_conf_set_array(... : if (convert_to_bool) { char *err = fpm_conf_set_boolean(value, &subconf, 0); if (err) return err; kv->value = strdup(b ? "On" : "Off"); } It looks like kv->value is either string "On" or "Off" or am i wrong ?[2011-10-31 14:22 UTC] fat@php.net
hum ... not sure to understand your problem afterall :) without the patch: If I set php_flag[session.auto_start]=On ini_get("session.auto_start") returns "On" and session are created for each page (auto start is on as asked) If I set php_flag[session.auto_start]=Off ini_get("session.auto_start") returns "Off" and session are NOT created for each page (auto start is off as asked) For me this works as expected. Do you have the same behavior ?[2011-10-31 14:34 UTC] dbetz at df dot eu
Hello, yes, the option is set correct, but the return value of ini_get() is different than whith php-cgi. Most apps like typo3, joomla, wordpress, eg. are checking in the installer, if php.ini settings are correct. These setting are checked thru ini_get. When ini_get(session.auto_start) is not 0 but "Off", then the check fails. Here is the sample code from typo3 installer: if (ini_get('session.auto_start')) { $sessionCreationError = 'Error: session.auto-start is enabled.<br />'; $sessionCreationError .= 'The PHP option session.auto-start is enabled. Disable this option in php.ini or .htaccess:<br />'; I hope you understand now my problem.[2011-10-31 14:44 UTC] dbetz at df dot eu
[2011-11-03 15:08 UTC] fat@php.net
-Status: Assigned +Status: Feedback
[2011-11-03 15:08 UTC] fat@php.net
[2011-11-03 15:13 UTC] dbetz at df dot eu
[2011-11-03 15:13 UTC] dbetz at df dot eu
-Status: Feedback +Status: Assigned
[2011-11-03 15:44 UTC] fat@php.net
-Summary: wrong output with php_flag boolean +Summary: php_flag and php_value does not work properly
[2011-11-03 15:48 UTC] fat@php.net
[2011-11-03 15:48 UTC] fat@php.net
-Status: Assigned +Status: Closed