Skip to content

fix: catch variable shadows closure parameter causing "Undefined variable $exception" on PHP 8.0+#8

Open
aasimsajjad22 wants to merge 1 commit into
flowmailer:mainfrom
aasimsajjad22:patch-1
Open

fix: catch variable shadows closure parameter causing "Undefined variable $exception" on PHP 8.0+#8
aasimsajjad22 wants to merge 1 commit into
flowmailer:mainfrom
aasimsajjad22:patch-1

Conversation

@aasimsajjad22
Copy link
Copy Markdown

Fixes #7

The catch variable $exception shadows the closure parameter of the same name. In PHP 8.0+, catch clause variables are unset after the catch block exits — this destroys the closure parameter too. The throw $exception on the line after the catch block then fails with Error: Undefined variable $exception.

Fix is to rename the catch variable to $caughtError so it doesn't shadow the closure parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

PHP 8.0+ bug: catch variable shadows closure parameter causing "Undefined variable $exception" in submitMessages rejection handler

1 participant