Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68014 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57598 invoked from network); 29 Jun 2013 01:41:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jun 2013 01:41:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.46 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.46 mail-la0-f46.google.com Received: from [209.85.215.46] ([209.85.215.46:51792] helo=mail-la0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/A3-37409-16B3EC15 for ; Fri, 28 Jun 2013 21:41:54 -0400 Received: by mail-la0-f46.google.com with SMTP id eg20so2742401lab.5 for ; Fri, 28 Jun 2013 18:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=SVUAO1LctnqXMpa6MRUTKv1J6M0i2XOj2DqkdbVara8=; b=ocBIJcQTOD9cWQrf/AiHrn6uqtFUko+38SakeUXtGGLeFB+S/D9tRSdu2G+1NE4TAN wDXr134CDkF5vLZ1rFkz82JeEVqVATyWOZehrfkIHcU7ePLreDz2bpCDx6RV8an/Cb8l DC8d/sGzAdSpmVjLBUR6XPan9Radq2dxQKXeAJ1rkt+QyHeNAc4U7oQ1iW/s3haSqhWn Ocme8Vbyo8JXmzaSt+Bbs26I1id7itZZSBig8lQo1w1EZflI57c+afsl2lQvX36AV9+S ffNRcnihm3j/pX54J1tW0MF8oKZL1KJzwYkpZpQnm2zkFArvSesvwkdJyeZi9ZFXCqX+ ypAA== X-Received: by 10.112.14.33 with SMTP id m1mr7578761lbc.17.1372470111043; Fri, 28 Jun 2013 18:41:51 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.4.233 with HTTP; Fri, 28 Jun 2013 18:41:10 -0700 (PDT) In-Reply-To: References: <51CD5580.50103@gmail.com> Date: Sat, 29 Jun 2013 10:41:10 +0900 X-Google-Sender-Auth: wuA2cMQfD7tw8br63gaFYeLpf6o Message-ID: To: Sherif Ramadan Cc: =?ISO-8859-2?Q?Leszek_Krupi=F1ski?= , PHP Internals Content-Type: multipart/alternative; boundary=001a11c37b0a6f084504e0411917 Subject: Re: [PHP-DEV] Re: hex2bin: E_WARNING is too much for odd string? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c37b0a6f084504e0411917 Content-Type: text/plain; charset=ISO-8859-1 Hi Sherif, The problem is that current code 'returns false for invalid hex' while it 'returns false and E_WARNING for invalid length'. We may choose behavior for invalid inputs - return false always - return false and raise E_WARNING always Mixing them up is not good, especially in the same function. IMHO. PHP has enough inconsistency. We should try to remove inconsistency much as possible. Besides the change will not break code as long as it is used as it should be. Considering the use case of hex2bin(), it will not handle external inputs in most cases. Therefore, it's better to raise errors invalid inputs. Do you prefer not to raise errors? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c37b0a6f084504e0411917--