Re: [RFC] Base Conversion Clowniness

From: Date: Mon, 23 Dec 2013 08:30:04 +0000
Subject: Re: [RFC] Base Conversion Clowniness
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-70846@lists.php.net to get a copy of this message
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

« previous php.internals (#70846) next »