mirror of
https://github.com/dunglas/frankenphp.git
synced 2025-12-24 13:38:11 +08:00
* 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>
33 lines
658 B
PHP
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";
|