Skip to content

pack()/unpack() do not implement the float codes f, g, G, d, e, E: pack returns "" and unpack false #93

Closed

Description

@blacktrs

Summary

pack()/unpack() do not implement the float codes f, g, G, d, e, E: pack returns "" and unpack false.

Repro

<?php
echo bin2hex(pack('g', 0.1)), ' ', bin2hex(pack('G', 0.1)), "\n";
echo bin2hex(pack('e', 0.1)), ' ', bin2hex(pack('E', 0.1)), "\n";
var_dump(unpack('g', pack('g', 0.1))[1]);
var_dump(unpack('E', pack('E', -2.5))[1]);
var_dump(unpack('e2', pack('e2', 1.5, 3.25)));

Expected (php)

cdcccc3d 3dcccccd
9a9999999999b93f 3fb999999999999a
float(0.10000000149011612)
float(-2.5)
array(2) {
  [1]=>
  float(1.5)
  [2]=>
  float(3.25)
}

Actual (manticore 2714fbae, Darwin arm64)

 
 
float(0)
float(0)
bool(false)

Tracking

Known-bug repro: tests/aot/repro/wrong/pack_float_codes_unsupported.php — bash tests/aot/xfail.sh -k pack_float_codes_unsupported reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions