Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70846 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91672 invoked from network); 23 Dec 2013 08:30:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Dec 2013 08:30:09 -0000 X-Host-Fingerprint: 80.4.21.210 cpc22-asfd3-2-0-cust209.1-2.cable.virginm.net Received: from [80.4.21.210] ([80.4.21.210:17313] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 39/E1-08405-F84F7B25 for ; Mon, 23 Dec 2013 03:30:08 -0500 To: internals@lists.php.net,Sara Golemon Message-ID: <52B7F48C.4020204@php.net> Date: Mon, 23 Dec 2013 08:30:04 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 References: <52B76720.4030403@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 80.4.21.210 Subject: Re: [PHP-DEV] [RFC] Base Conversion Clowniness From: krakjoe@php.net (Joe Watkins) On 12/22/2013 11:10 PM, Sara Golemon wrote: >> Just a little note - I don't think any option that adds warnings where >> there were not warnings is acceptable in this case for any stable >> version. There are dozens of ways extra warning could break an existing >> app. >> > I can see the argument for that, though anything depending on buggy > conversion is probably broken. > >> Also, wouldn't simple regexp or filter or is_numeric check solve this >> issue while allowing much more flexible reaction to wrong data? I'm not >> sure that more warnings is better than more data checking. >> > Sure, one could validate before conversion with something like: > > if (strcmp($val, base_convert($val, $base, $base))) { > /* $val isn't purely in base $base */ > } else { > $newval = base_convert($val, $base, $newbase); > } > > And a proper app *should* have logic like that regardless. > > However I do think that when apps don't apply such forward-thinking > logic, we should be prepared to be noisy about it (as we do with an > fopen() call which wasn't preceeded by an is_readable()/is_writable() > check) > > -Sara > You can only reasonably prepare for that if you are aware of how the implementation works, so that's about 30 of us ... before yesterday was probably less than 10 ... I'm with you, it's crap, fix it ... Cheers Joe