From: cf0hay at gmail dot com Operating system: Irrelevant PHP version: Irrelevant Package: Strings related Bug Type: Feature/Change Request Bug description:32bit signed littleendian (machine independent) support for pack() and unpack()
Description: ------------ pack() and unpack() are very useful functions, but would be nice to have a machine independent support for signed numbers, especially signed 32-bit little endian. If there are code alread for this, then they only missing from the documentation. Test script: --------------- // Let's say, "E" would mean 32-bit signed little endian echo unpack("E","A\xE2\x82\xAC")[1]."\n"; //PHP 5.4 syntax, would give back always -1400708543, regardless of architecture endianness (same az "l" on little endian system). echo pack("E",-1400708543)."\n"; //would give back A⬠on a UTF-8 terminal, same as "l" on a little endian system Expected result: ---------------- -1400708543 A⬠Actual result: -------------- unknown format code -- Edit bug report at https://bugs.php.net/bug.php?id=63630&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63630&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63630&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63630&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63630&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63630&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63630&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63630&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63630&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63630&r=support Expected behavior: https://bugs.php.net/fix.php?id=63630&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63630&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63630&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63630&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63630&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63630&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63630&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63630&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63630&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63630&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63630&r=mysqlcfg