Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix: Resetting forgotten password#3732

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

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

Conversation

@Vondry

@Vondry Vondry commented Jun 4, 2026
edited
Loading

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /