Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9363

Re: bug in is_numeric

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> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <php@PointedEars.de>
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+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: bug in is_numeric
Newsgroups comp.lang.php
References <MPG.2bf9b5f139f7cb7d9896aa@news.virginmedia.com> <kmocju$232o$1@yojimbo.hack> <MPG.2bf9e49c5e796889896ac@news.virginmedia.com> <5190d3a0$0$15991$e4fe514c@news2.news.xs4all.nl> <MPG.2bfb01d2b1e6b24f9896af@news.virginmedia.com> <kmqs3c$e3s$1@dont-email.me> <MPG.2bfb05badc66f3d69896b0@news.virginmedia.com> <jif4p8lqcjcin9inpluivhc8rcj96qn21d@4ax.com> <kmup14$3cp$2@dont-email.me> <kmutiq$ld3$1@dont-email.me> <kmvlet$o6o$1@dont-email.me> <9869380.OEKH2unXeN@PointedEars.de> <kn0jok$ebm$1@speranza.aioe.org> <1934679.jXLOkI38UW@PointedEars.de> <kn0pai$na$1@speranza.aioe.org>
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<Cl32<a4Fo<]lROoRa8kF<OcfhCOk?F<P;FJ26_bDZm8W4\YJNlb@mF9jNikdeIQbgJMhLo0gUm;;n5h:23j
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.php:9363

Show key headers only | View raw


Christoph Becker wrote:

> 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).

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

bug in  is_numeric fred <email@address.com> - 2013-05-12 15:22 +0100
  Re: bug in  is_numeric Salvatore <sal@yojimbo.hack.invalid> - 2013-05-12 15:31 +0000
    Re: bug in  is_numeric Luuk <luuk@invalid.lan> - 2013-05-12 17:55 +0200
    Re: bug in  is_numeric Luuk <luuk@invalid.lan> - 2013-05-12 17:58 +0200
    Re: bug in  is_numeric Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-05-12 18:06 +0200
    Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-12 16:24 +0000
    Re: bug in  is_numeric fred <email@address.com> - 2013-05-12 18:41 +0100
      Re: bug in  is_numeric Erwin Moller <erwinmollerusenet@xs4all.nl> - 2013-05-13 13:50 +0200
        Re: bug in  is_numeric fred <email@address.com> - 2013-05-13 14:58 +0100
          Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-13 10:11 -0400
            Re: bug in  is_numeric fred <email@address.com> - 2013-05-13 15:15 +0100
              Re: bug in  is_numeric Erwin Moller <erwinmollerusenet@xs4all.nl> - 2013-05-13 17:29 +0200
              Re: bug in  is_numeric "J.O. Aho" <user@example.net> - 2013-05-13 19:55 +0200
              Re: bug in  is_numeric Richard Yates <richard@yatesguitar.com> - 2013-05-14 06:41 -0700
                Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-14 21:43 -0400
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-14 23:01 -0400
                Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-15 05:48 -0400
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-15 06:11 -0400
                Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 18:36 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-15 15:19 +0200
                Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-15 20:23 +0200
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-15 20:49 +0200
                Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-15 21:58 +0200
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-15 22:20 +0200
                Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-15 22:42 +0200
                Re: bug in  is_numeric Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-05-15 23:53 +0200
                Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-16 00:29 +0200
                Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-16 00:40 +0200
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-16 05:00 +0200
                Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 18:16 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-17 00:45 +0200
                Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 22:52 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-17 18:33 +0200
                Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-17 20:39 +0200
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-17 23:45 +0200
                Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-18 14:47 +0200
                Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-15 20:57 -0400
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-16 00:09 -0400
                Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-17 01:17 +0200
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-16 20:30 -0400
                Re: bug in  is_numeric Christoph Becker <cmbecker69@gmx.de> - 2013-05-18 14:51 +0200
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 10:07 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-18 11:56 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 14:32 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-18 22:24 +0200
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 17:01 -0400
                Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-18 21:58 +0000
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 19:21 -0400
                Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-19 02:22 +0000
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 22:41 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 05:28 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 09:42 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:42 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 14:39 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-21 01:01 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-21 05:59 -0400
                Re: bug in  is_numeric The Natural Philosopher <tnp@invalid.invalid> - 2013-05-19 07:49 +0100
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 05:31 -0500
                Re: bug in  is_numeric The Natural Philosopher <tnp@invalid.invalid> - 2013-05-19 12:39 +0100
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 09:43 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:52 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 14:42 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-21 01:03 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-21 06:00 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:45 -0500
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 05:27 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 09:45 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:37 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 14:43 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-21 00:59 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-21 06:02 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-18 17:08 -0500
                Re: bug in  is_numeric The Natural Philosopher <tnp@invalid.invalid> - 2013-05-18 23:58 +0100
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 19:22 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-18 17:11 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 19:23 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 05:35 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 09:46 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:23 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-19 14:44 -0400
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-21 00:54 -0500
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-21 06:03 -0400
                Re: bug in  is_numeric fred <email@address.com> - 2013-05-23 15:38 +0100
                Re: bug in  is_numeric Arno Welzel <usenet@arnowelzel.de> - 2013-06-01 17:36 +0200
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-01 14:54 -0400
                Re: bug in  is_numeric Arno Welzel <usenet@arnowelzel.de> - 2013-06-05 15:25 +0200
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-05 10:34 -0400
                Re: bug in  is_numeric Arno Welzel <usenet@arnowelzel.de> - 2013-06-05 17:02 +0200
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-05 12:30 -0400
                OT: What you say is not always what you mean (was: Re: bug in  is_numeric) Arno Welzel <usenet@arnowelzel.de> - 2013-06-05 20:20 +0200
                Re: OT: What you say is not always what you mean Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-05 14:40 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-18 21:51 +0200
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-18 17:13 -0500
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-19 00:49 +0200
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 05:24 -0500
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-19 12:40 +0200
                Re: bug in  is_numeric The Natural Philosopher <tnp@invalid.invalid> - 2013-05-19 12:43 +0100
                Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-19 11:29 -0500
                Re: bug in  is_numeric Norman Peelman <npeelman@cfl.rr.com> - 2013-05-18 14:53 -0400
                Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 18:41 -0400
          Re: bug in  is_numeric Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-13 08:35 -0700
          Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-13 20:26 +0000
      Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-13 20:15 +0000
    Re: bug in  is_numeric Robert Heller <heller@deepsoft.com> - 2013-05-12 13:03 -0500
  Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-12 18:03 +0200
    Re: bug in  is_numeric fred <email@address.com> - 2013-05-12 18:34 +0100
      Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-12 19:40 +0200
        Re: bug in  is_numeric Luuk <luuk@invalid.lan> - 2013-05-12 21:51 +0200
  Re: bug in  is_numeric "Sanders Kaufman" <bucky@kaufman.net> - 2013-05-12 11:47 -0500
    Re: bug in  is_numeric Luuk <luuk@invalid.lan> - 2013-05-12 18:56 +0200
    Re: bug in  is_numeric Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-05-12 19:05 +0200
      Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-12 19:38 +0200
        Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-12 19:46 +0200
        Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-12 14:11 -0400
          Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-12 20:39 +0200
            Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-12 16:51 -0400
              Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-13 01:27 +0200
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-12 20:35 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-13 11:07 +0200
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-13 09:02 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-13 16:57 +0200
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-13 17:10 +0200
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-13 13:52 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-13 20:28 +0200
                Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 18:28 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-17 00:33 +0200
                Re: bug in  is_numeric SwissCheese <swisscheese@cfl.rr.com> - 2013-05-16 22:34 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-18 10:28 +0200
                Re: bug in  is_numeric Norman Peelman <npeelman@cfl.rr.com> - 2013-05-18 08:00 -0400
                Re: bug in  is_numeric Luuk <luuk@invalid.lan> - 2013-05-18 14:18 +0200
                Re: bug in  is_numeric Tim Streater <timstreater@greenbee.net> - 2013-05-18 13:20 +0100
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 08:47 -0400
                Re: bug in  is_numeric The Natural Philosopher <tnp@invalid.invalid> - 2013-05-18 14:05 +0100
                Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-18 10:16 -0400
                Re: bug in  is_numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-18 16:14 +0200
  Re: bug in  is_numeric Sandman <mr@sandman.net> - 2013-05-14 10:34 +0200
    Re: bug in  is_numeric fred <email@address.com> - 2013-05-14 14:47 +0100
      Re: bug in  is_numeric Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-14 14:54 +0000
      Re: bug in  is_numeric Sandman <mr@sandman.net> - 2013-05-15 08:05 +0200
        Re: bug in  is_numeric Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-15 06:27 -0400
          Re: bug in  is_numeric Erwin Moller <erwinmollerusenet@xs4all.nl> - 2013-05-15 13:11 +0200

csiph-web