|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-09-23 07:28 UTC] sjoerd@php.net
[2009-09-24 10:41 UTC] hsu at jean-david dot com
[2009-10-01 11:35 UTC] sjoerd@php.net
[2009-10-02 10:51 UTC] hsu at jean-david dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 08:00:02 2025 UTC |
Description: ------------ PHP pack documentation: i signed integer (machine dependent size and byte order) PHP integer documentation: Integer size can be determined using the constant PHP_INT_SIZE On some systems, I believe that the word "integer" will refer to objects of different sizes, such that pack("i", _) could point to an object of size X bytes and PHP_INT_SIZE return value Y which is inconsistent. /main/main.c l.1796: REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", sizeof(long), CONST_PERSISTENT | CONST_CS); /ext/standard/pack.c l.402-403: php_pack(argv[currentarg++], sizeof(int), int_map, &output[outputpos]); outputpos += sizeof(int); Reproduce code: --------------- file_put_contents("test.bin",pack("I", 2)); var_dump(PHP_INT_SIZE === filesize("test.bin")); Expected result: ---------------- bool(true) Actual result: -------------- bool(false)