UPSTREAM FIX

magento2-39859: Orders are rejected for city names with digits, periods, & or parentheses

Community fix magento2-39859 merged into magento/magento2 on 2025-08-13, released in 2.4.9; applies cleanly to 6 releases from 2.4.8 to 2.4.8-p5.

Orders are rejected for city names with digits, periods, & or parentheses edited

Pull request title
[2.4.8] Cannot place orders where City has digits 0-9, Ampersand, full stop or parenthesis in the City Name
Pull request
magento/magento2#39859
Issues
#39854 human
Author
@bhushan-cs
Merged
2025-08-13
Fixed in
2.4.9
Reported on
2.4.8
Categories
Order/Checkout
Components
magento/module-customer

Labels

Area
Cart & Checkout
Component
Checkout
Priority
P1
Severity
—
Reported on (labels)
2.4.8

Issue

Title and steps come from the upstream issue and pull request.

Description

Order is not placed.

Steps to reproduce

Place an order using any of the following City Names

- St. Moritz
- St. Petersburg
- Brighton & Hove
- St. Davids
- 29 Palms
- Anywhere (North)

Expected result

Order is placed

Actual result

Order is not placed.

"Invalid City. Please use A-Z, a-z, 0-9, -, ', spaces"

1. The error message doesn't match the regex.
2. The regex is too restrictive
3. These all pass frontend validation of the city field

Taken from the upstream issue.

Code match per tag

Each tag was checked with git apply --check against that tag's files. A clean match means the change applies; it is not a test result. Tags that already contain the fix are marked.

LineCode match per tagTests
2.4.6
2.4.6 file-missing 2.4.6-p1 file-missing 2.4.6-p2 file-missing 2.4.6-p3 file-missing 2.4.6-p4 file-missing 2.4.6-p5 file-missing 2.4.6-p6 file-missing 2.4.6-p7 file-missing 2.4.6-p8 file-missing 2.4.6-p9 file-missing 2.4.6-p10 file-missing 2.4.6-p11 file-missing 2.4.6-p12 file-missing 2.4.6-p13 file-missing 2.4.6-p14 file-missing 2.4.6-p15 file-missing
2.4.6: no test data 2.4.6-p1: no test data 2.4.6-p2: no test data 2.4.6-p3: no test data 2.4.6-p4: no test data 2.4.6-p5: no test data 2.4.6-p6: no test data 2.4.6-p7: no test data 2.4.6-p8: no test data 2.4.6-p9: no test data 2.4.6-p10: no test data 2.4.6-p11: no test data 2.4.6-p12: no test data 2.4.6-p13: no test data 2.4.6-p14: no test data 2.4.6-p15: no test data
2.4.7
2.4.7 file-missing 2.4.7-p1 file-missing 2.4.7-p2 file-missing 2.4.7-p3 file-missing 2.4.7-p4 file-missing 2.4.7-p5 file-missing 2.4.7-p6 file-missing 2.4.7-p7 file-missing 2.4.7-p8 file-missing 2.4.7-p9 file-missing 2.4.7-p10 file-missing
2.4.7: no test data 2.4.7-p1: no test data 2.4.7-p2: no test data 2.4.7-p3: no test data 2.4.7-p4: no test data 2.4.7-p5: no test data 2.4.7-p6: no test data 2.4.7-p7: no test data 2.4.7-p8: no test data 2.4.7-p9: no test data 2.4.7-p10: no test data
2.4.8
2.4.8 clean 2.4.8-p1 clean 2.4.8-p2 clean 2.4.8-p3 clean 2.4.8-p4 clean 2.4.8-p5 clean
2.4.8: no test data 2.4.8-p1: no test data 2.4.8-p2: no test data 2.4.8-p3: no test data 2.4.8-p4: no test data 2.4.8-p5: fails before, passes afterunit: fails before, passes after
2.4.9
2.4.9 conflictcontains the fix
2.4.9: no test data

Triage

Model @cf/cloudflare/clef. Probability this is a bug fix: 98.6%. Probability it is security relevant: 3.3%.

Show the model's answers and probabilities
QuestionAnswerProbabilitiesConfidence
Change kindbugfixbugfix 95.6%, refactor 1.4%, tests_only 1.0%, feature 0.8%, dependency 0.6%, docs_only 0.5%89.8%
Areacheckoutcheckout 55.1%, customer 39.2%, framework 1.4%38.0%
Reported version2.4.82.4.8 57.7%, 2.4.8-p2 2.5%, 2.4.8-p1 2.1%32.9%
Scope0.59 of 20 53.1%, 1 34.8%, 2 12.0%12.7%
Risk0.82 of 20 52.4%, 2 34.1%, 1 13.5%11.4%
Worth backporting1.63 of 22 69.5%, 1 24.3%, 0 6.2%31.9%

Download

For cweagans/composer-patches, choose a version below and download the bundle. Copy its magento2-39859/ folder into patches/composer/, merge composer.patches.json into composer.json, then run composer install. Test files are always removed; paths are relative to each package root, using the default -p1 level.

Packages (1): magento/module-customer
Bundle README (what the ZIP ships)
# magento2-39859

Community fix merged upstream into magento/magento2, adapted by magento.watch.
This is not a patch published by Adobe.

Pull request: https://github.com/magento/magento2/pull/39859
Issue: https://github.com/magento/magento2/issues/39854
Author: @bhushan-cs
Source commit: 622621e37b38584252fba05b7ddc222c983dc55f
Modifications: test files and documentation removed, paths rewritten relative to each Composer package.
Licence: OSL-3.0 / AFL-3.0, as the original Magento Open Source code.
Maintainer: Łukasz Bajsarowicz (@lbajsarowicz)

Licence: Magento Open Source code under OSL-3.0 and AFL-3.0. The bundle carries the original author, source commit and the list of modifications.

Sources

Łukasz Bajsarowicz
Built by

Łukasz Bajsarowicz, e-commerce architect

Magento and Adobe Commerce architecture, upgrades, performance and audits for merchants and agencies since 2015; magento.watch is the tooling I use on those projects.

Open source, maintained on weekends.