Re: Patch for OnUpdateBool in zend_ini.c
| From: | Zeev Suraski | Date: | Mon, 12 May 2003 13:35:33 +0000 |
| Subject: | Re: Patch for OnUpdateBool in zend_ini.c | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1448@lists.php.net to get a copy of this message | ||
At 16:27 12/05/2003, Moriyoshi Koizumi wrote:
Hi, I just found OnUpdateBool ini handler is not working properly at the moment. <quote> ZEND_API ZEND_INI_MH(OnUpdateBool) {Why? Does strncasecmp("on", "o", 2) return 0 on your system? Either way, I can't think of any reason not to simply replace strncasecmp with strcasecmp. The lengths should be identical either way. Zeevzend_bool *p;#ifndef ZTSchar *base = (char *) mh_arg2;#elsechar *base;base = (char *) ts_resource(*((int *) mh_arg2));#endifp = (zend_bool *) (base+(size_t) mh_arg1);if (strncasecmp("on", new_value, sizeof("on"))) { *p = (zend_bool) atoi(new_value); } else { *p = (zend_bool) 1; } return SUCCESS;} </quote> IMO, this partif (strncasecmp("on", new_value, sizeof("on"))) { *p = (zend_bool) atoi(new_value); } else { *p = (zend_bool) 1; }should beif (new_value_length == sizeof("on") -1 && strcasecmp("on", new_value) == 0) { *p = (zend_bool) 1; } else { *p = (zend_bool) atoi(new_value); }Otherwise you can set the corresponding entry to 1 if you specify a single letter "o" for it.