-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
header_register_callback
builtin support (#1101)
* Add header_register_callback builtin support Signed-off-by: Petr Shumilov <[email protected]>
- Loading branch information
1 parent
02d3786
commit 2206f5e
Showing
16 changed files
with
228 additions
and
24 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@kphp_should_fail k2_skip | ||
/header_register_callback should not throw exceptions/ | ||
<?php | ||
|
||
/** @kphp-required */ | ||
function throwing_func() { | ||
throw new Exception('BAD'); | ||
} | ||
|
||
header_register_callback('throwing_func'); |
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,7 @@ | ||
@kphp_should_fail k2_skip | ||
/header_register_callback should not throw exceptions/ | ||
<?php | ||
|
||
header_register_callback(function () { | ||
throw new Exception('BAD'); | ||
}); |
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,13 @@ | ||
@kphp_should_fail k2_skip | ||
/header_register_callback should not throw exceptions/ | ||
<?php | ||
|
||
function may_throw(bool $cond) { | ||
if ($cond) { | ||
throw new Exception('BAD'); | ||
} | ||
} | ||
|
||
header_register_callback(function () { | ||
may_throw(false); | ||
}); |
8 changes: 8 additions & 0 deletions
8
tests/phpt/pk/030_header_register_callback_unreachable_in_cli.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,8 @@ | ||
@ok | ||
<?php | ||
|
||
echo "Zero"; | ||
header_register_callback(function () { | ||
echo "In CLI is unreachable"; | ||
}); | ||
echo "One"; |
9 changes: 9 additions & 0 deletions
9
tests/phpt/pk/031_header_register_callback_no_invoked_by_flush.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,9 @@ | ||
@ok | ||
<?php | ||
|
||
echo "Zero"; | ||
header_register_callback(function () { | ||
echo "In CLI is unreachable, even via flush"; | ||
}); | ||
flush(); | ||
echo "One"; |
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
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
Oops, something went wrong.