mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[critical] The toIterable() method causes an unexpected behaviour (segfault ...) #7579
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @acantepie on GitHub (Dec 15, 2025).
Doctrine version : 3.5.3
Php version : 8.4.15
I’m running into an incomprehensible problem with Doctrine’s QueryBuilder
toIterable()function.I can’t catch exceptions anymore, or I get segfaults after using toIterable().
Example of code (in symfony command) :
The exception "EXCEPTION" is not caught by the try-catch block in execute function. I don't get this problem if exception is earlier on code or if i used getResult() method instead.
In the original script, I get a segfault (
624 segmentation fault (core dumped)) after throwing the exception.@greg0ire commented on GitHub (Dec 15, 2025):
What are you referring to? The code you included does not contain this.
@acantepie commented on GitHub (Dec 15, 2025):
@greg0ire I have edited my post, i mean that the exception
new \InvalidArgumentException('EXCEPTION');is not caught in theexecutefunction by the try-catch block.I have created a small app in symfony to reproduce this issue : https://github.com/acantepie/issue-php8-4-15
@greg0ire commented on GitHub (Dec 15, 2025):
If you get a segmentation fault, then your issue is with PHP, not with Doctrine I'm afraid.
@greg0ire commented on GitHub (Dec 15, 2025):
Anyway, I've tried your reproducer, and I don't get a segfault 🤔
I've also tried adding a
finallyblock, it's not executed either. Maybe the issue is with the exception handler.@greg0ire commented on GitHub (Dec 15, 2025):
I've tried reproducing it with a simple generator, to no avail. So it could be related to Doctrine and PHP.
@greg0ire commented on GitHub (Dec 15, 2025):
I've managed to reproduce the issue with PHPUnit (no Symfony involved): https://github.com/doctrine/orm/pull/12324
@greg0ire commented on GitHub (Dec 15, 2025):
I've asked my LLM to look into this, and it found this is in fact a PHP bug. Here is the minimal reproducer it came up with:
I've tried simplifying it but couldn't. It seems to affect PHP 8.4.15 but not PHP 8.4.14, so it's a regression.
@greg0ire commented on GitHub (Dec 15, 2025):
Reported as https://github.com/php/php-src/issues/20714