Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <1622055.H2T55JCus4@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Wed, 15 May 2013 22:20:22 +0200 User-Agent: KNode/4.10.2 Content-Transfer-Encoding: 7Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. <5190d3a0$0$15991$e4fe514c@news2.news.xs4all.nl> <9869380.OEKH2unXeN@PointedEars.de> <1934679.jXLOkI38UW@PointedEars.de> MIME-Version: 1.0 Lines: 51 NNTP-Posting-Date: 15 May 2013 22:20:23 CEST NNTP-Posting-Host: 7be2a8eb.newsspool4.arcor-online.net X-Trace: DXC=l=gV[MecK_d]BlmkiiU@Bi4IUK Thomas 'PointedEars' Lahn wrote: >> I would rather the former bug was an implementation bug instead of a >> documentation bug, because such a function should either work for all >> supported numeric representations of the programming language, or there >> should be a parameter specifying which representations are supported for >> the specific call [like ECMAScripts parseInt(number : String, base : >> Number) : Number]. > > ACK. However, the usefulness of is_numeric() returning true for strings > in binary notation is somewhat doubtful, as there is no simple way to > actually convert such strings to a number: > > >>> (int) '0b1010' > 0 > >>> intval('0b1010') > 0 > >>> intval('0b1010', 2) > 0 > >>> 0 + '0b1010' > 0 > > So the issue *might* as well be regarded as documentation bug. ISTM to be strong indication that it is an implementation bug, where the bug would be that the conversion from string to int is incomplete: $ php -r 'var_dump(+"0x2A");' int(42) (as expected) $ php -r 'var_dump(+"010");' int(10) (expected: 8) A possibility for conversion is: $ php -r 'var_dump(eval("return " . "0b1110" . ";"));' int(14) > BTW: I can confirm the same behavior in PHP 5.2.17 (Windows VC6 build). Bogus because binary numeric literals were introduced in PHP 5.4. PointedEars -- When all you know is jQuery, every problem looks $(olvable).