View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002350 | Xdebug | Stacktraces | public | 2025-05-20 07:47 | 2025-05-22 13:07 |
Reporter | f.bosch@genkgo.nl | Assigned To | derick | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | assigned | Resolution | open | ||
Platform | Docker | OS | Alpine | OS Version | 3.20.6 |
Product Version | 3.4.2 | ||||
Summary | 0002350: [3.4.3] Crash when a certain page generates an exception | ||||
Description | A certain page generates an exception and that causes Xdebug to crash, resulting in a 502 Bad Gateway. I am on Xdebug 3.4.3 by the way, could only pick 3.4.2 from the list. This is the stacktrace.
| ||||
Additional Information | PHP 8.3.21 (cli) (built: May 19 2025 14:17:50) (NTS) | ||||
Tags | No tags attached. | ||||
Operating System | Ubuntu + Docker Alpine | ||||
PHP Version | 8.3.10-8.3.19 | ||||
|
Can you please provide steps on how I can reproduce this? I have seen this reported a few times not, but never with an example that shows the issue — not even with a generally too large example. |
|
Derick, I wish I could do that, but once I extract the bits of code, it doesn't crash anymore. I can share my minimal example that does not crash though. <?php
$placeholders = (new Placeholders()) class Resolver {
} $resolver = new Resolver(); echo "end"; |
|
Now as attachment. But again, it does not crash. I was not able to create a reproducible crashing example. test.php (2,124 bytes)
<?php class Placeholders { /** * @var \Closure(): (self)|null */ private ?\Closure $value = null; public function __construct(private array $collection = [], private array $scopedCollection = []) { } public function withCallbackScope(string $scope, \Closure $callback): Placeholders { $clone = clone $this; $clone->scopedCollection[$scope] = new self(); $clone->scopedCollection[$scope]->value = $callback; return $clone; } public function getScope(string $scope): Placeholders { if (!isset($this->scopedCollection[$scope])) { throw new \InvalidArgumentException('Cannot find key ' . $scope); } return $this->scopedCollection[$scope]; } public function get(string $key): string { if ($this->value !== null) { $value = \call_user_func($this->value); $this->collection = $value->collection; $this->value = null; } if (!isset($this->collection[$key])) { // return ''; // <- solves the crash throw new \InvalidArgumentException('Cannot find key ' . $key); // <- here is the crash } return $this->collection[$key]; } } $placeholders = (new Placeholders()) ->withCallbackScope('x', fn () => new Placeholders([ 'letterhead' => 'letterhead', 'street' => 'street', 'postalcode' => 'postalcode', 'city' => 'city', ])); class Resolver { public function resolve(Placeholders $placeholders) { $result = ''; try { $result .= $placeholders->getScope('x')->get('letterhead'); $result .= $placeholders->getScope('x')->get('street'); $result .= $placeholders->getScope('x')->get('postalcode'); $result .= $placeholders->getScope('x')->get('city'); $result .= $placeholders->getScope('x')->get('country'); } catch (\InvalidArgumentException) { } return $result; } } $resolver = new Resolver(); echo $resolver->resolve($placeholders); echo "end"; |
|
I confirm the crash. |
Date Modified | Username | Field | Change |
---|---|---|---|
2025-05-20 07:47 | f.bosch@genkgo.nl | New Issue | |
2025-05-20 18:19 | derick | Assigned To | => derick |
2025-05-20 18:19 | derick | Status | new => feedback |
2025-05-20 18:19 | derick | Note Added: 0007289 | |
2025-05-20 19:48 | f.bosch@genkgo.nl | Note Added: 0007290 | |
2025-05-20 19:48 | f.bosch@genkgo.nl | Status | feedback => assigned |
2025-05-20 19:53 | f.bosch@genkgo.nl | Note Added: 0007291 | |
2025-05-20 19:53 | f.bosch@genkgo.nl | File Added: test.php | |
2025-05-22 13:07 | SR | Note Added: 0007292 |