Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix preg_replace_callback_array() pattern validation
Closes GH-11301
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 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
15 changes: 15 additions & 0 deletions
15
ext/pcre/tests/preg_replace_callback_array_numeric_index_error.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,15 @@ | ||
--TEST-- | ||
preg_replace_callback_array() invalid pattern | ||
--FILE-- | ||
<?php | ||
preg_replace_callback_array( | ||
[42 => function () {}], | ||
'a', | ||
); | ||
?> | ||
--EXPECTF-- | ||
Fatal error: Uncaught TypeError: preg_replace_callback_array(): Argument #1 ($pattern) must contain only string patterns as keys in %s:%d | ||
Stack trace: | ||
#0 %s(%d): preg_replace_callback_array(Array, 'a') | ||
#1 {main} | ||
thrown in %s on line %d |