Skip to content
New issue

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

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

Already on GitHub? # to your account

Exit code 139 if exception thrown in callback since PHP 8.4 #17968

Closed
NiroDeveloper opened this issue Mar 4, 2025 · 8 comments
Closed

Exit code 139 if exception thrown in callback since PHP 8.4 #17968

NiroDeveloper opened this issue Mar 4, 2025 · 8 comments

Comments

@NiroDeveloper
Copy link

NiroDeveloper commented Mar 4, 2025

Description

The following code:

<?php

$collection = new Collection([fn() => throw new RuntimeException()]);

new HigherOrderCollectionProxy($collection, 'each')->__invoke();

Resulted in this output:

Process finished with exit code 139

But I expected a successful test.

I use Laravel 12 with PHP 8.4 (this problem does not occur with PHP 8.3)
I haven't been able to reproduce this without Laravel yet, i will post new information then.

Note: This problem does not occur while debugging using xdebug.

PHP Version

8.4.1 - 8.4.4

Operating System

Docker php:8.4-cli-alpine under Windows 11

@iluuu1994
Copy link
Member

This might be related to #17866. Please re-test with 8.4.5, which should be released in a week or so.

@NiroDeveloper
Copy link
Author

This problem also exists with PHP 8.4.1, so i think it has a different cause.

@iluuu1994
Copy link
Member

@NiroDeveloper Ah ok, I missed that part. We'll need a better reproducer then. You can try generating a backtrace from the core dump, or running PHP with Valgrind or address sanitizer (./configure --enable-address-sanitizer). Alternatively, a minimal reproducer repository would be helpful.

@nielsdos
Copy link
Member

nielsdos commented Mar 4, 2025

I tried your reproducer in laravel/framework#54875 (comment) by making a new Laravel 12 project, putting that in a Pest test file, and running PHP on it, but I got no crash.
I see you mentioned XDebug. Can you try with the XDebug extension unloaded ? Even if you do not use it activated, just having it loaded can alter behaviour.

@NiroDeveloper
Copy link
Author

@nielsdos Good point, i can confirm that.
The problem only occurs if xdebug is installed but not used.
If xdebug is used or not installed it is ok.

@NiroDeveloper
Copy link
Author

@iluuu1994 I have now created a reproducer repository: https://github.com/NiroDeveloper/php-issue-17968

  1. Start docker-compose.yaml
  2. Open shell in the php container
  3. Run php bug.php
  4. See output Segmentation fault

@iluuu1994
Copy link
Member

The problem only occurs if xdebug is installed but not used.

If that's the case, this should be reported over at https://bugs.xdebug.org, as it's almost certainly to blame. But your reproducer should still come in handy there. 🙂

@NiroDeveloper
Copy link
Author

Ok, I created this issue: https://bugs.xdebug.org/view.php?id=2327

@iluuu1994 iluuu1994 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 5, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants