Edit report at https://bugs.php.net/bug.php?id=61095&edit=1
ID: 61095
Comment by: balthasar dot reuter at cs dot fau dot de
Reported by: tomek at przeslij dot pl
Summary: PHP can't add hex numbers
Status: Assigned
Type: Bug
Package: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.3.10
Assigned To: colder
Block user comment: N
Private report: N
New Comment:
Behavior reproduced:
$ php -r 'echo (0x00+2);echo "\n";'
4
$ php -r 'echo (0x00+ 2);echo "\n";'
2
$ php -r 'echo (0x00 + 2);echo "\n";'
2
$ php -r 'echo (0x00 +2);echo "\n";'
4
$ php -v
PHP 5.3.8 (cli) (built: Dec 5 2011 21:24:09)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
Mac OS X 10.6.8
Previous Comments:
------------------------------------------------------------------------
[2012-02-23 20:14:37] phpbug at vincent dot sh
Lexer level ? Russian. http://goo.gl/eqxZ8
------------------------------------------------------------------------
[2012-02-23 15:56:59] lepidosteus+phpbug at gmail dot com
Sorry, forget my previous comment, I misunderstood the issue
------------------------------------------------------------------------
[2012-02-23 15:55:00] lepidosteus+phpbug at gmail dot com
Correct behavior for me in 5.3.3-7+squeeze3
$ php -r "var_dump(0x02+0x00);"
int(2)
$ php -r "var_dump(0x02+0);"
int(2)
$ php -r "var_dump('0x02'+0);"
int(2)
------------------------------------------------------------------------
[2012-02-20 18:28:55] colder@php.net
Automatic comment from SVN on behalf of colder
Revision: http://svn.php.net/viewvc/?view=revision&revision=323394
Log: Fix #61095 (Lexing 0x0*+<NUM> incorrectly)
------------------------------------------------------------------------
[2012-02-15 16:24:03] nikic@php.net
Nice catch!
This can be fixed by adding a len == 0 check after the while loop in http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_language_scanner.l#1515
(and returning 0 in that case).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=61095--
Edit this bug report at https://bugs.php.net/bug.php?id=61095&edit=1