Skip to content

Commit

Permalink
Fix more of #99
Browse files Browse the repository at this point in the history
  • Loading branch information
antecedent committed Dec 22, 2019
1 parent a7f0e53 commit b98e046
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/CallRerouting.php
Expand Up @@ -477,7 +477,7 @@ function connectDefaultInternals()
$offsets[] = $offset;
}
}
connect($function, function() use ($offsets) {
connect($function, function() use ($function, $offsets) {
# This is the argument-inspecting patch.
$args = Stack\top('args');
$caller = Stack\all()[1];
Expand Down Expand Up @@ -534,8 +534,10 @@ function connectDefaultInternals()
}
}
}
# Give the inspected arguments back to the callback-taking function
return relay($args);
# Give the inspected arguments back to the *original* definition of the
# callback-taking function, e.g. \array_map(). This works given that the
# present patch is the innermost.
return call_user_func_array($function, $args);
});
}
}
Expand Down

0 comments on commit b98e046

Please sign in to comment.