[PR #7324] Fix XSD regex for fqcn and tablename patterns #10424

Closed
opened 2026-01-22 16:07:29 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/7324

State: closed
Merged: No


Follow-up to #6389's discussion. Mainly: "[u01-uff]" is just wrong (in any regex flavor, BTW).

Recap of the currently incorrect cases (and inconsistencies):

  • tablename:
    • rejects `foo-bar` [does not allow the hyphen even if quoted] (while accepting `foo;bar`)
    • accepts foo;bar [allows the semicolon although unquoted] (while rejecting foo-bar)
  • fqcn:
    • rejects C [requires at least 2 chars]
    • accepts Foo;Bar [allows the semicolon] (while rejecting Foo-Bar)
    • accepts 3lephant [allows digits for the first char]

Note: the pattern for fqcn is rather straightforward, but not so for tablename:

  • different SQL database vendors allow different extra characters for [un]quoted identifiers...
  • it seems that Doctrine supports the form "myschema.mytable", where mytable may be quoted whereas myschema may not but will become if mytable is (here -> here, then here -> there)...
  • cannot be merged into master as-is, because Doctrine 3.x will auto-quote everything...

Also, this adds many small XML test files (mostly because invalid cases have to be tested separately [and I split the valid cases a bit], but not all are strictly necessary)...

(But still, I think that at least those "u01-uff" should be fixed.)

Found related:

**Original Pull Request:** https://github.com/doctrine/orm/pull/7324 **State:** closed **Merged:** No --- Follow-up to #6389's discussion. Mainly: "`[u01-uff]`" is just *wrong* (in any regex flavor, BTW). Recap of the currently incorrect cases _(and inconsistencies)_: - `tablename`: - rejects `` `foo-bar` `` [does not allow the hyphen even if quoted] _(while accepting `` `foo;bar` ``)_ - accepts `foo;bar` [allows the semicolon although unquoted] _(while rejecting `foo-bar`)_ - `fqcn`: - rejects `C` [requires at least 2 chars] - accepts `Foo;Bar` [allows the semicolon] _(while rejecting `Foo-Bar`)_ - accepts `3lephant` [allows digits for the first char] --- Note: the pattern for `fqcn` is rather straightforward, but not so for `tablename`: - different SQL database vendors allow different extra characters for [un]quoted identifiers... - it seems that Doctrine supports the form "`myschema.mytable`", where `mytable` *may* be quoted whereas `myschema` may *not* but *will become* if `mytable` is ([here](https://github.com/doctrine/doctrine2/blob/96f166a7e90149adb1357c5db73c615407ea394e/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php#L80-L91) -> [here](https://github.com/doctrine/doctrine2/blob/96f166a7e90149adb1357c5db73c615407ea394e/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php#L2297-L2309), then [here](https://github.com/doctrine/doctrine2/blob/96f166a7e90149adb1357c5db73c615407ea394e/lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php#L49-L61) -> [there](https://github.com/doctrine/dbal/blob/a7dc38d87bc5b89704b7c3388b1438701a4dfb0a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php#L1922-L1925))... - cannot be merged into master *as-is*, because Doctrine 3.x will auto-quote everything... Also, this adds many small XML test files (mostly because invalid cases have to be tested separately [and I split the valid cases a bit], but not all are strictly necessary)... (But still, I think that at least those "`u01-uff`" should be fixed.) Found related: - #6728 - #6883 - #7001 - [#7085's second commit](https://github.com/doctrine/doctrine2/pull/7085/commits/0b04aa900063f3afe5a11e9697de01dd7c5a3987)
admin added the pull-request label 2026-01-22 16:07:29 +01:00
admin closed this issue 2026-01-22 16:07:29 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#10424