Skip to content

Fix: Resetting forgotten password#3732

Open
Vondry wants to merge 2 commits into
bolt:6.2from
Vondry:fix/reset-password-config-type
Open

Fix: Resetting forgotten password#3732
Vondry wants to merge 2 commits into
bolt:6.2from
Vondry:fix/reset-password-config-type

Conversation

@Vondry

@Vondry Vondry commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Bug

Requesting a password reset at /bolt/reset-password returned HTTP 500 with a TypeError: buildResetEmail() declared an array $config parameter, but config->get('general/reset_password_settings') returns a Bolt\Collection\DeepCollection. Under strict_types=1 PHP refuses the object→array coercion.

image

Fix

1. Primary fix

Fixed by changing the parameter type hint to DeepCollection, which extends Laravel's Collection and implements ArrayAccess, so the existing $config['mail_from'] lookups still work unchanged.

2. Test Environment Configuration

  • Added MAILER_DSN=null://null to phpunit.xml.dist to prevent mailer configuration errors during tests.
  • Hardened URL parsing in src/Canonical.php to safely handle malformed URLs and incomplete parse_url() results.

3. Test Coverage

Added ResetPasswordControllerTest.php to verify that:

  • The password reset page loads successfully

  • The reset form renders correctly

  • Requests are handled without triggering TypeError exceptions

    Testing

Screen.Recording.2026-06-04.at.15.03.04.mov

config->get() returns a DeepCollection, not an array. With strict_types
enabled this caused a TypeError on the array type hint. Accept
DeepCollection, which supports ArrayAccess for the key lookups used.
@Vondry Vondry changed the title Fix TypeError in ResetPasswordController buildResetEmail Fix: Resetting forgotten password Jun 4, 2026
@Vondry Vondry force-pushed the fix/reset-password-config-type branch from 7624a99 to 9edebaf Compare June 8, 2026 09:09
- Add MAILER_DSN environment variable to phpunit.xml.dist for test environment
- Add defensive handling in Canonical.php for malformed URLs in test environment
- Add comprehensive test coverage for ResetPasswordController
@Vondry Vondry force-pushed the fix/reset-password-config-type branch from 9edebaf to 2a53d3e Compare June 8, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant