Skip to content

[3.0] Imports the UserDataset enum that PM.php has been using without it - #9342

Merged
jdarwood007 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/pm-userdataset-import
Aug 2, 2026
Merged

[3.0] Imports the UserDataset enum that PM.php has been using without it#9342
jdarwood007 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/pm-userdataset-import

Conversation

@albertlast

@albertlast albertlast commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Description

Sending a personal message fails outright on current release-3.0:

Class "SMF\PersonalMessage\UserDataset" not found

Sources/PersonalMessage/PM.php uses UserDataset::Minimal and UserDataset::None at lines 1607, 1670 and 1917, but the file never imports the enum. Its own namespace is SMF\PersonalMessage, so an unqualified name resolves there rather than to SMF\UserDataset.

PM::send() gets as far as User::load($all_to, dataset: UserDataset::Minimal) when it goes to load the recipients, and dies. The message is not stored and the sender lands on an error page. Nothing in the class is guarded against it, so it happens every time, on both databases and on every theme.

One line: use SMF\UserDataset;.

Testing

Docker environment, PostgreSQL 17. Before: composing a PM and pressing "Send message" produced the "Class not found" error page, smf_personal_messages unchanged, and a general row in log_errors. After: the PM is delivered, the sender is redirected to the inbox with done=sent, the row is in smf_personal_messages, and the error log stays empty.

vendor/bin/phpunit — 108 tests, 157 assertions, OK.

Found while checking what the PostgreSQL error reporting in #9341 exposed. This one is not a query failure and is unrelated to that change; it just turned up on the way past.

The report in #9308 also mentions that the recipient autocomplete does not complete the way 2.1 does. That part does not reproduce here: on the same tree, typing into the To field returns an auto_suggest_div populated from action=suggest as expected. Whatever is behind that half of the report is separate from this fix.

Issues References (Fixes|Related|Closes)

Fixes #9308
Related to #9341

PM.php names UserDataset::Minimal and UserDataset::None in three places but
never imports the enum, so PHP resolves it against the file's own namespace
and looks for SMF\PersonalMessage\UserDataset.

Sending a personal message therefore dies with "Class
SMF\PersonalMessage\UserDataset not found" the moment PM::send() gets as far
as loading the recipients. It happens on both databases and on every theme.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Aug 2, 2026
@jdarwood007
jdarwood007 merged commit 97e1fa0 into SimpleMachines:release-3.0 Aug 2, 2026
4 checks passed
@albertlast
albertlast deleted the 3.0/pm-userdataset-import branch August 2, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[3.0] Can not send PMs

2 participants