diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bad511..99c496e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## [NOT RELEASED] +## 0.2.2 + +### Fixed + +- Make sure to restart process if there is an uncaught exception + ## 0.2.1 ### Added @@ -12,12 +18,12 @@ ### Added -- `vendor/bin/bref-local-handler.php` to invoke PSR-11 handlers locally. +- `vendor/bin/bref-local-handler.php` to invoke PSR-11 handlers locally - Invocation and request context to the Request ServerBag ### Fixed -- Session handling for Symfony 5.4 and up. +- Session handling for Symfony 5.4 and up - Error handling on invalid `_HANDLER` string ## 0.1.1 diff --git a/composer.json b/composer.json index ba5fb11..626beb6 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "ext-json": "*", - "bref/bref": "^1.2", + "bref/bref": "^1.3", "clue/arguments": "^2.1", "psr/http-server-handler": "^1.0", "riverline/multipart-parser": "^2.0", diff --git a/src/BrefRunner.php b/src/BrefRunner.php index 65452ed..5152921 100644 --- a/src/BrefRunner.php +++ b/src/BrefRunner.php @@ -31,7 +31,15 @@ public function run(): int if (++$loops > $this->loopMax) { return 0; } - $lambda->processNextEvent($this->handler); + + /** + * In case the execution failed, we force starting a new process regardless + * of $this->loopMax. This is because an uncaught exception could have + * left the application in a non-clean state. + */ + if (!$lambda->processNextEvent($this->handler)) { + return 0; + } } } }