Re: [RFC] Base Conversion Clowniness

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

« previous php.internals (#70840) next »