Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68002 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88698 invoked from network); 28 Jun 2013 09:21:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jun 2013 09:21:12 -0000 Authentication-Results: pb1.pair.com header.from=leafnode@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=leafnode@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) X-PHP-List-Original-Sender: leafnode@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ea0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:53706] helo=mail-ea0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/DC-34034-6855DC15 for ; Fri, 28 Jun 2013 05:21:11 -0400 Received: by mail-ea0-f170.google.com with SMTP id h10so917524eaj.29 for ; Fri, 28 Jun 2013 02:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=lf5vtZJaiUD9k2pQz6P5YaKyPFqv9KVEvRai9mt9FCM=; b=uVosJi5l4H4DEC4WQ4i8zhxWDyhVnaJpNNJ6VAb3ESlcf4Tcuda+eUEHdfvFCqg04O zn/AyH2QI8Pa+BwVapnckqI10lG1Tb9yZGi97f6cUd7RNJsRROHBl/ifFKVYxMby7jER QxnCzxsV3FKTedaoYZzogLMM1yqCj3Zmk+iH7uDxZQIXzW5Q8D5+CDbCFBSC02PUqkIR SD4FW9txnfr+drMgB/V34cZ6OCIUls3fVSxvsMCL2uQe1yQMZXfd8fPwVgsWd+eLZPwh 1u9BJ421WUPopFdUjWp/66FcxSFRDkUkfzQfdyLNTqa8It/CWBqu23Ti8DINpZ4ldeKC 9n/w== X-Received: by 10.14.109.195 with SMTP id s43mr12783007eeg.132.1372411268388; Fri, 28 Jun 2013 02:21:08 -0700 (PDT) Received: from [10.0.20.40] (81-18-213-39.static.chello.pl. [81.18.213.39]) by mx.google.com with ESMTPSA id ci50sm9246279eeb.12.2013.06.28.02.21.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Jun 2013 02:21:07 -0700 (PDT) Message-ID: <51CD5580.50103@gmail.com> Date: Fri, 28 Jun 2013 11:21:04 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string? From: leafnode@gmail.com (=?UTF-8?B?TGVzemVrIEtydXBpxYRza2k=?=) On 2013-06-27 03:33, Sherif Ramadan wrote: > On Wed, Jun 26, 2013 at 9:05 PM, Yasuo Ohgaki wrote: > >> Hi all, >> >> I've sent pull request for PHP-5.5 branch. >> https://github.com/php/php-src/pull/369 >> >> It's simple 1 liner removes E_WARNING for invalid length. >> >> Are there any objections? >> > Yes, I object to removing the error in the same breath we're arguing for > consistency. 5.4.0 through 5.4.3 (no error), 5.4.4 through 5.4.16 (error), > 5.5.0 (error), 5.5.1 (no error)??? What kind of consistency is this? > > I thought you wanted to add an extra error for malformed hex, which I would > have been fine with, but removing the error entirely? The error is useful. > It informs the user that they may have buggy code since the function is > clearly documented to expect even length hex encoded strings. In my opinion generating E_WARNING is too severe. Passing improper string to hex2bin does not necessary mean "buggy code". If the string is eg. from external input, why should I check if it's a well formed hex string if the function does this anyway? I think E_NOTICE + returning false is enough. And about consistency... I don't know the rationale behind adding E_ERROR in recent versions, but if the situation is bad, it should be fixed, not proliferated to next versions. Yes, it'd better if the change was better thought, but the milk has spilled. --Leszek