Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Invoke destructors during bailout #19080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
danog wants to merge 5 commits into php:master
base: master
Choose a base branch
Loading
from danog:invoke_destructors_after_bailout

Conversation

Copy link
Contributor

@danog danog commented Jul 9, 2025

Closes #18418.

@danog danog changed the title (削除) Invoke destructors after bailout (削除ここまで) (追記) Invoke destructors during bailout (追記ここまで) Jul 9, 2025
@danog danog marked this pull request as ready for review July 9, 2025 15:36
@danog danog requested a review from bukka as a code owner July 9, 2025 15:36
@@ -28,3 +28,4 @@ int(2)
Deprecated: Passing E_USER_ERROR to trigger_error() is deprecated since 8.4, throw an exception or call exit with a string message instead in %s on line %d

Fatal error: Fatal error in fiber in %sfatal-error-with-multiple-fibers.php on line %d
executed
Copy link
Member

@DanielEScherzer DanielEScherzer Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep the trailing newline

</{closure:%s:%d}>
<!-- switching from fiber %s to %s -->
<destroyed '%s'>
<!-- destroy: %s -->
Copy link
Member

@DanielEScherzer DanielEScherzer Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep a trailing newline

--FILE--
<?php

final class StatCounter {
Copy link
Member

@DanielEScherzer DanielEScherzer Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems more complicated than you need

<?php
class StatCounter {
 public function __construct(private array $stats) {}
 public function __destruct() {
 echo "Sending stats: ".json_encode($this->stats)."\n";
 }
}
$stats = new StatCounter(['test' => 1, 'test2' => 1]);
set_time_limit(1);
while (1);

should do the same thing

Invoke destructors after bailout
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
Copy link
Member

@DanielEScherzer DanielEScherzer Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test is limited to one second, I don't think that counts as slow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@DanielEScherzer DanielEScherzer DanielEScherzer left review comments

@bukka bukka Awaiting requested review from bukka bukka is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Destructors not invoked after a fatal error

AltStyle によって変換されたページ (->オリジナル) /