Skip to content

array_walk callback storing a string through &$v over an int array that is a function parameter reads back int(0) #68

Closed

Description

@blacktrs

Summary

array_walk callback storing a string through &$v over an int array that is a function parameter reads back int(0).

Repro

<?php
// item: 13
function w(array $x) {
    array_walk($x, function (&$v) { $v = "z"; });
    var_dump($x);
}
w([1, 2]);

Expected (php)

array(2) {
  [0]=>
  string(1) "z"
  [1]=>
  string(1) "z"
}

Actual (manticore 09cb49fb, Darwin arm64)

array(2) {
  [0]=>
  int(0)
  [1]=>
  int(0)
}

Tracking

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

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