php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12590 hex const (0xABCDEF01) parsing error
Submitted: 2001-08-06 07:35 UTC Modified: 2001-10-18 16:00 UTC
From: vda at port dot imtp dot ilyichevsk dot odessa dot ua Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vda at port dot imtp dot ilyichevsk dot odessa dot ua
New email:
PHP Version: OS:

 

 [2001-08-06 07:35 UTC] vda at port dot imtp dot ilyichevsk dot odessa dot ua
Looks like there's some trouble with parsing big hex consts
(those with sign bit set). Try this:
...
echo (0x7FFF00FF & 0xFFFF); //echoes 255
echo (0x800000FF & 0xFFFF); //echoes 0!!!
...
0x800000FF apparently is mis-parsed.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-18 15:45 UTC] sander@php.net
What would you expect to get? On my machine, it prints out 255 twice.
 [2001-10-18 16:00 UTC] jeroen@php.net
On most platforms (including i386), PHP does not support integers of 2**31 (0x80 00 00 00) and higher.

See the manual on integers. So the result of the second expression is unknown. (0x800000FF is converted to float because of integer-overflow, and you cannot use bitwise fucntions on floats)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 17:01:30 2025 UTC