Skip to content

Commit 91ef1ec

Browse files
authored
Fix rshutdown deprecated warning (swoole#4026)
When throw Exception, do not show the info
1 parent 0009098 commit 91ef1ec

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

ext-src/swoole_event.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,10 @@ static PHP_FUNCTION(swoole_event_rshutdown) {
735735
if (!sw_reactor()) {
736736
return;
737737
}
738-
php_swoole_fatal_error(E_DEPRECATED, "Event::wait() in shutdown function is deprecated");
738+
// when throw Exception, do not show the info
739+
if (!sw_reactor()->bailout) {
740+
php_swoole_fatal_error(E_DEPRECATED, "Event::wait() in shutdown function is deprecated");
741+
}
739742
php_swoole_event_wait();
740743
}
741744
zend_end_try();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
swoole_event: deprecated_event_wait
3+
--SKIPIF--
4+
<?php
5+
6+
use SebastianBergmann\CodeCoverage\Report\PHP;
7+
8+
use function Swoole\Coroutine\run;
9+
10+
require __DIR__ . '/../include/skipif.inc'; ?>
11+
--FILE--
12+
<?php
13+
require __DIR__ . '/../include/bootstrap.php';
14+
15+
error_reporting(E_ALL & E_DEPRECATED);
16+
17+
run(function () {
18+
throw new Exception("Error Processing Request", 1);
19+
});
20+
21+
?>
22+
--EXPECT--

0 commit comments

Comments
 (0)