Files
frankenphp/testdata/dd.php
Alexander Stecher bf6e6534f6 fix: exit() and dd() support in worker mode (#1946)
* Verifies exit behavior.

* formatting

* Checks for actual exit.

* Fixes test.

* Fixes test.

* Update testdata/dd.php

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

---------

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-10-28 10:57:50 +01:00

33 lines
658 B
PHP

<?php
// simulate Symfony's dd() behavior
// see https://github.com/symfony/http-kernel/blob/7.3/DataCollector/DumpDataCollector.php#L216
class Dumper
{
private string $message;
public function dump(string $message): void
{
http_response_code(500);
$this->message = $message;
}
public function __destruct()
{
if (isset($this->message)) {
echo $this->message;
}
}
}
$dumper = new Dumper();
while (frankenphp_handle_request(function () use ($dumper) {
$dumper->dump($_GET['output'] ?? '');
exit(1);
})) {
// keep handling requests
}
echo "we should never reach here\n";