Skip to content

fix: accept null in User::setEMailAddress() and setDisplayName() - #41897

Open
openefaadmin wants to merge 2 commits into
owncloud:masterfrom
openefaadmin:fix/user-null-display-name-email
Open

openefaadmin wants to merge 2 commits into
owncloud:masterfrom
openefaadmin:fix/user-null-display-name-email

Conversation

@openefaadmin

Copy link
Copy Markdown

setEMailAddress() is documented as @param string|null (null removes the
address), but calls trim($mailAddress) directly, which raises
"Passing null to parameter #1 ($string) of type string is deprecated" on
PHP >= 8.1. Coalesce to '' before trimming - trim(null) already returned '' -
so behaviour is unchanged. setDisplayName() gets the same guard.

How this was tested

setEMailAddress(null) raised trim(): Passing null to parameter #1 ($string) of type string is deprecated; with the fix there is no deprecation and the stored value is still ''. tests/lib/User: 270 tests OK.

A changelog entry is included in changelog/unreleased/; it links pull/TBD and can be renamed to the PR number.

@openefaadmin
openefaadmin requested a review from a team as a code owner October 7, 2026 02:44
@CLAassistant

CLAassistant commented Oct 7, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

setEMailAddress() is documented as `@param string|null` (null removes the
address), but calls trim($mailAddress) directly, which raises
"Passing null to parameter owncloud#1 ($string) of type string is deprecated" on
PHP >= 8.1. Coalesce to '' before trimming - trim(null) already returned '' -
so behaviour is unchanged. setDisplayName() gets the same guard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Scott Barbour <[email protected]>
@openefaadmin
openefaadmin force-pushed the fix/user-null-display-name-email branch from 5a41b5f to d51d63a Compare October 7, 2026 17:05
Adjust changelog to have a shorter title and less detailed
text.

Signed-off-by: Phillip Davis <[email protected]>
@phil-davis

Copy link
Copy Markdown
Contributor

I adjust the changelog to have:

  • shorter title (so that it passes the changelog linter)
  • less detailed text (it will be system admins and users that read the changelog, so I think that developer detail is not required/relevant)

@openefaadmin

openefaadmin commented Oct 8, 2026 via email

Copy link
Copy Markdown
Author

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.

3 participants