Skip to content

City validation fails for valid real-world city names like "25 de Mayo" or "30 de Agosto" #40026

Closed as duplicate of#39854
@manuelcanepa

Description

@manuelcanepa

Preconditions and environment

  • Magento version: 2.4.x (confirmed on 963fe57)
  • PHP version: 8.1
  • Sample affected input: "25 de Mayo" or "30 de Agosto"
  • Affected class: \Magento\Customer\Model\Validator\City

Steps to reproduce

  1. Attempt to create or update a customer with a city name "25 de Mayo".
  2. Trigger validation using \Magento\Customer\Model\Validator\City::isValid
use Magento\Customer\Model\Customer;
use Magento\Customer\Model\Validator\City as CityValidator;

$customer = new Customer();
$customer->setCity("25 de Mayo");

$validator = new CityValidator();
$isValid = $validator->isValid($customer);
var_dump($isValid); // false

Expected result

The validator should accept "25 de Mayo" as a valid city name, since it is a legitimate and common city name (e.g., in Argentina).

Actual result

Validation fails. The error message returned is:

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

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions