-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle extra arguments for internal overrideArgs (#2348)
* Handle extra arguments for internal overrideArgs Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com> * Fix possible leak in zai_call_function * Fix compilation Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com> * Fix scope in PDOIntegration Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com> --------- Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com> Co-authored-by: Gustavo Lopes <mail@geleia.net>
- Loading branch information
1 parent
b046038
commit a1f35f6
Showing
6 changed files
with
96 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/ext/sandbox/install_hook/replace_hook_args_internal.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--TEST-- | ||
Adding additional function arguments on internal functions via install_hook() | ||
--FILE-- | ||
<?php | ||
|
||
$hook = DDTrace\install_hook("preg_replace_callback_array", function($hook) { | ||
$args = $hook->args; | ||
$args[] = 2; | ||
$args[] = null; | ||
$hook->overrideArguments($args); | ||
}); | ||
|
||
var_dump(preg_replace_callback_array(["((a))" => function () { var_dump(func_get_args()); }], "ababab")); | ||
|
||
?> | ||
--EXPECT-- | ||
array(1) { | ||
[0]=> | ||
array(2) { | ||
[0]=> | ||
string(1) "a" | ||
[1]=> | ||
string(1) "a" | ||
} | ||
} | ||
array(1) { | ||
[0]=> | ||
array(2) { | ||
[0]=> | ||
string(1) "a" | ||
[1]=> | ||
string(1) "a" | ||
} | ||
} | ||
string(4) "bbab" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters