Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1448 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69378 invoked from network); 12 May 2003 13:38:29 -0000 Received: from unknown (HELO ogi.bezeqint.net) (192.115.106.14) by pb1.pair.com with SMTP; 12 May 2003 13:38:29 -0000 Received: from mr2.bezeqint.net (pip-17.bezeqint.net [192.115.106.17]) by ogi.bezeqint.net (Bezeq International SMTP out Mail Server) with ESMTP id 8E31E75A2 for ; Mon, 12 May 2003 16:35:28 +0300 (IDT) Received: from mail.zend.com (bzq-117-235-230.cust.bezeqint.net [192.117.235.230]) by mr2.bezeqint.net (Mirapoint Messaging Server MOS 3.3.3-GR) with SMTP id AYU05541; Mon, 12 May 2003 16:38:05 +0300 (IDT) Received: (qmail 29257 invoked from network); 12 May 2003 13:38:01 -0000 Received: from localhost (HELO zeev-laptop.zend.com) (127.0.0.1) by localhost with SMTP; 12 May 2003 13:38:01 -0000 Reply-To: zeev@zend.com Message-ID: <5.1.0.14.2.20030512163422.05282da8@localhost> X-Sender: zeev@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Mon, 12 May 2003 16:35:33 +0300 To: Moriyoshi Koizumi Cc: php-internal In-Reply-To: <20030512222717w!4#MP@at.wakwak.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Patch for OnUpdateBool in zend_ini.c From: zeev@zend.com (Zeev Suraski) References: <20030512222717w!4#MP@at.wakwak.com> At 16:27 12/05/2003, Moriyoshi Koizumi wrote: >Hi, > >I just found OnUpdateBool ini handler is not working properly at the >moment. > > >ZEND_API ZEND_INI_MH(OnUpdateBool) >{ > zend_bool *p; >#ifndef ZTS > char *base = (char *) mh_arg2; >#else > char *base; > > base = (char *) ts_resource(*((int *) mh_arg2)); >#endif > > p = (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; >} > > >IMO, this part > > if (strncasecmp("on", new_value, sizeof("on"))) { > *p = (zend_bool) atoi(new_value); > } else { > *p = (zend_bool) 1; > } > >should be > > if (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. 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. Zeev