php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30033 unpack('n') never returns negative values
Submitted: 2004-09-09 06:21 UTC Modified: 2004-09-14 14:15 UTC
From: jsgoupil at lookstrike dot com Assigned: yannick (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.0.1 OS: WinXP - Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jsgoupil at lookstrike dot com
New email:
PHP Version: OS:

 

 [2004-09-09 06:21 UTC] jsgoupil at lookstrike dot com
Description:
------------
With the following code, i receive the max positive value.
Same error in PHP4.3.7.

Reproduce code:
---------------
<?php
$val = -1;
$val2 = pack('n',$val);
$val3 = unpack('nint',$val2);
echo $val3['int'];
?>

Expected result:
----------------
-1

Actual result:
--------------
65535

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-09 08:04 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

http://php.net/pack:

n	unsigned short (always 16 bit, big endian byte order)
 [2004-09-09 08:26 UTC] jsgoupil at lookstrike dot com
OMG, i saw your message and I was angry ! but i check and in French it is written "entier court sign?"
so it means "signed short"
It means that there is a doc error.
 [2004-09-14 13:50 UTC] vrana@php.net
We usually state translation bugs as bogus but I hope French translation team close this soon.
 [2004-09-14 14:15 UTC] yannick@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 10:01:32 2024 UTC