|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-11-21 08:53 UTC] martynas at venck dot us
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
Description: ------------ Htscanner should be a drop-in replacement for mod_php Apache scanner; however currently php_flag behavior is incompatible. I.e., Apache uses the following code to parse php_flag (see sapi/apache/mod_php5.c): static CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode) { char bool_val[2]; if (!strcasecmp(arg2, "On") || (arg2[0] == '1' && arg2[1] == '\0')) { bool_val[0] = '1'; } else { bool_val[0] = '0'; } bool_val[1] = 0; return php_apache_value_handler_ex(cmd, conf, arg1, bool_val, mode); } Htscanner currently accepts On or Off; otherwise--it returns failure. Yes, the docs specify php_flag on|off. However many applications still use directives like php_flag foo 1 or similar--there's no reason at all to break them. The patch below makes htscanner's php_flag act consistently with Apache. Index: htscanner.c ============================================================ ======= --- htscanner.c (revision 304374) +++ htscanner.c (working copy) @@ -103,19 +103,11 @@ if (flag) { /* it's a flag */ - - /* - * check only for valid boolean values. - * Boris HUISGEN <bhuisgen@hbis.fr> - */ - if (!strcasecmp(value, "on")) { + if (!strcasecmp(value, "on") || (value[0] == '1' && value[1] == '\0')) { value = "1"; - } else if (!strcasecmp(value, "off")) { - value = "0"; } else { - return FAILURE; + value = "0"; } - value_len = 1; } else { /* it's a value */ Reproduce code: --------------- php_flag foo !(on|off) Expected result: ---------------- Consistent with mod_php Apache scanner. Actual result: -------------- Failure.