PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar aboarken
aboarken
26 Sep 2026

Pull Request resolves #

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Updated the username validation in libraries/src/Table/User.php to reject whitespace characters anywhere in the username.

Previously, Joomla could accept usernames containing spaces, such as Ahmad Moussa. The validation now also checks for whitespace between characters, while keeping the existing validation for leading and trailing whitespace.

Examples:
"AhmadMoussa" → accepted
"Ahmad Moussa" → rejected
" AhmadMoussa" → rejected
"AhmadMoussa " → rejected

Testing Instructions

Create or edit a Joomla user and test the following usernames:

"AhmadMoussa"
"Ahmad Moussa"
" AhmadMoussa"
"AhmadMoussa "

Verify that usernames without whitespace are accepted and usernames containing whitespace are rejected.

Actual result BEFORE applying this Pull Request

Joomla allowed usernames containing spaces between words, such as "Ahmad Moussa".

Expected result AFTER applying this Pull Request

Joomla rejects usernames containing whitespace characters, including spaces between words and leading or trailing whitespace.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:
  • No documentation changes for guide.joomla.org needed
  • Pull Request link for manual.joomla.org:
  • No documentation changes for manual.joomla.org needed
avatar aboarken aboarken - open - 26 Sep 2026
avatar aboarken aboarken - change - 26 Sep 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Sep 2026
Category ⇒ Libraries
avatar brianteeman
brianteeman - comment - 26 Sep 2026

There is an open issue from me with more username issues and examples. Not at my pc right now to check but please take a look

avatar aboarken
aboarken - comment - 26 Sep 2026

There is an open issue from me with more username issues and examples. Not at my pc right now to check but please take a look

Hello @brianteeman, I have found this issue: #36814 related to accepted characters. Actually this is my first Pull Request. Please tell me if I did something wrong.

avatar aboarken
aboarken - comment - 26 Sep 2026

There is an open issue from me with more username issues and examples. Not at my pc right now to check but please take a look

We can update this Validate message:

From : Save failed with the following error: Please enter a valid username. No space at beginning or end, at least 2 characters, must not have the following characters: \ " ' % ; ( ) & and be less than 150 characters long.

to

Save failed with the following error: Please enter a valid username. No space at beginning or end, at least 2 characters, must not have the following characters: \ " ' % ; ( ) & < > and be less than 150 characters long.

What do you think @brianteeman ?

avatar aboarken
aboarken - comment - 26 Sep 2026

There is an open issue from me with more username issues and examples. Not at my pc right now to check but please take a look

We can update this Validate message knowing that < > are also not permitted to be used:

From : Save failed with the following error: Please enter a valid username. No space at beginning or end, at least 2 characters, must not have the following characters: \ " ' % ; ( ) & and be less than 150 characters long.

to

Save failed with the following error: Please enter a valid username. No space at beginning or end, at least 2 characters, must not have the following characters: \ " ' % ; ( ) & < > and be less than 150 characters long.

What do you think @brianteeman ?

avatar aboarken aboarken - change - 26 Sep 2026
The description was changed
avatar aboarken aboarken - edited - 26 Sep 2026
avatar aboarken aboarken - change - 26 Sep 2026
Title
…
Fix regex pattern for username validation
[5.4] Fix regex pattern for username validation
avatar aboarken aboarken - edited - 26 Sep 2026
avatar github-actions[bot]
github-actions[bot] - comment - 26 Sep 2026

This pull request has conflicts, please resolve those before we can evaluate the pull request.

avatar aboarken aboarken - change - 26 Sep 2026
Labels Added: Conflicting Files PR-5.4-dev
avatar github-actions[bot] github-actions[bot] - change - 26 Sep 2026
Labels Removed: Conflicting Files
avatar aboarken
aboarken - comment - 26 Sep 2026

please use modern code

Hello @alikon , sorry if I missed something. This is my first Request Pull. I just wanted to change in this file: libraries/src/Table/User.php

preg_match('#[<>"'%;()&\\]|\.\./#', $this->username)

to

preg_match('#[\s<>"'%;()&\\]|\.\./#', $this->username)

Sorry for this mess, please tell me what I have to do? Close this pull request and do another one?

avatar alikon
alikon - comment - 26 Sep 2026

@aboarken you have changed a lot code that is not in the scope of your pull request,
just chage only the regex

avatar aboarken
aboarken - comment - 26 Sep 2026

@aboarken you have changed a lot code that is not in the scope of your pull request, just chage only the regex

I am sorry, I will close this pull and create a new one targeting version 6.1.

avatar aboarken aboarken - change - 26 Sep 2026
Status Pending ⇒ Closed
Closed_Date 0000-00-00 00:00:00 ⇒ 2026-09-26 16:05:09
Closed_By ⇒ aboarken
avatar aboarken aboarken - close - 26 Sep 2026
avatar aboarken aboarken - change - 26 Sep 2026
The description was changed
avatar aboarken aboarken - edited - 26 Sep 2026
avatar alikon
alikon - comment - 26 Sep 2026

@aboarken yes please,
looking forward to see you next pull request

Add a Comment

Login with GitHub to post a comment