Numbers in a string using underscore naming strategy #6325

Closed
opened 2026-01-22 15:30:56 +01:00 by admin · 12 comments
Owner

Originally created by @vuras on GitHub (Oct 8, 2019).

Originally assigned to: @lcobucci on GitHub.

Bug Report

Q A
BC Break no
Version 2.6.4

Summary

If a string has numbers the naming strategy fails to convert the property name.

Current behavior

base64Encoded converts to base64encoded

How to reproduce

Add a property to entity that has a number in camelcased property name.

Expected behavior

base64Encoded converts to base64_encoded

Originally created by @vuras on GitHub (Oct 8, 2019). Originally assigned to: @lcobucci on GitHub. ### Bug Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | no | Version | 2.6.4 #### Summary If a string has numbers the naming strategy fails to convert the property name. #### Current behavior base64Encoded converts to base64encoded #### How to reproduce Add a property to entity that has a number in camelcased property name. #### Expected behavior base64Encoded converts to base64_encoded
admin added the Bug label 2026-01-22 15:30:56 +01:00
admin closed this issue 2026-01-22 15:30:56 +01:00
Author
Owner

@Ocramius commented on GitHub (Oct 8, 2019):

Possibly a bug in https://github.com/doctrine/inflector?

@Ocramius commented on GitHub (Oct 8, 2019): Possibly a bug in https://github.com/doctrine/inflector?
Author
Owner

@lcobucci commented on GitHub (Oct 8, 2019):

Not really:

a36809db72/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php (L136-L145)

@lcobucci commented on GitHub (Oct 8, 2019): Not really: https://github.com/doctrine/orm/blob/a36809db72124000edb2b93171b330ac1ec09f7b/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php#L136-L145
Author
Owner

@lcobucci commented on GitHub (Oct 8, 2019):

Seems an easy pick, though

@lcobucci commented on GitHub (Oct 8, 2019): Seems an easy pick, though
Author
Owner

@Ocramius commented on GitHub (Oct 8, 2019):

Was totally convinced it would be using the inflector there :D

@vuras feel free to send a patch (and test) for UnderscoreNamingStrategy

@Ocramius commented on GitHub (Oct 8, 2019): Was totally convinced it would be using the inflector there :D @vuras feel free to send a patch (and test) for `UnderscoreNamingStrategy`
Author
Owner

@lcobucci commented on GitHub (Oct 8, 2019):

Sorry, I got the patch already 😬

There's just one problem, though: it affects table names like DDC1476EntityWithDefaultFieldType (which gets converted to DDC1476_ENTITY_WITH_DEFAULT_FIELD_TYPE instead of DDC1476ENTITY_WITH_DEFAULT_FIELD_TYPE).

Possible BC break, then, so I'll force it to only work for properties.

@lcobucci commented on GitHub (Oct 8, 2019): Sorry, I got the patch already :grimacing: There's just one problem, though: it affects table names like `DDC1476EntityWithDefaultFieldType` (which gets converted to `DDC1476_ENTITY_WITH_DEFAULT_FIELD_TYPE` instead of `DDC1476ENTITY_WITH_DEFAULT_FIELD_TYPE`). Possible BC break, then, so I'll force it to only work for properties.
Author
Owner

@lcobucci commented on GitHub (Oct 8, 2019):

Handled by #7856, thanks for reporting it @vuras!

@lcobucci commented on GitHub (Oct 8, 2019): Handled by #7856, thanks for reporting it @vuras!
Author
Owner

@vuras commented on GitHub (Oct 8, 2019):

Thank you! When should I expect the 2.6.5 released?

@vuras commented on GitHub (Oct 8, 2019): Thank you! When should I expect the 2.6.5 released?
Author
Owner

@lcobucci commented on GitHub (Oct 8, 2019):

I'd like to say "really soon" but, realistically speaking, it should take us a few weeks since there're some bugs that should be included IMHO.

@lcobucci commented on GitHub (Oct 8, 2019): I'd like to say "really soon" but, realistically speaking, it should take us a few weeks since there're some bugs that should be included IMHO.
Author
Owner

@igoel commented on GitHub (Nov 18, 2019):

Sorry, I got the patch already

There's just one problem, though: it affects table names like DDC1476EntityWithDefaultFieldType (which gets converted to DDC1476_ENTITY_WITH_DEFAULT_FIELD_TYPE instead of DDC1476ENTITY_WITH_DEFAULT_FIELD_TYPE).

Possible BC break, then, so I'll force it to only work for properties.

Even this, is breaking everything, so why do this in a minor version?

@igoel commented on GitHub (Nov 18, 2019): > Sorry, I got the patch already > > There's just one problem, though: it affects table names like `DDC1476EntityWithDefaultFieldType` (which gets converted to `DDC1476_ENTITY_WITH_DEFAULT_FIELD_TYPE` instead of `DDC1476ENTITY_WITH_DEFAULT_FIELD_TYPE`). > > Possible BC break, then, so I'll force it to only work for properties. Even this, is breaking everything, so why do this in a minor version?
Author
Owner

@lcobucci commented on GitHub (Nov 18, 2019):

@igoel @cobyl @sGy1980de we overlooked things and this is indeed a BC break. I'll rework it and send a new patch version 2.6.6 to address that.

I'm sorry for affecting your app and thank you for letting us know of this error.

@lcobucci commented on GitHub (Nov 18, 2019): @igoel @cobyl @sGy1980de we overlooked things and this is indeed a BC break. I'll rework it and send a new patch version `2.6.6` to address that. I'm sorry for affecting your app and thank you for letting us know of this error.
Author
Owner

@lcobucci commented on GitHub (Nov 18, 2019):

@igoel @cobyl @sGy1980de new release made to address the BC break. We apologise, again, for the inconvenience.

@lcobucci commented on GitHub (Nov 18, 2019): @igoel @cobyl @sGy1980de new release made to address the BC break. We apologise, again, for the inconvenience.
Author
Owner

@igoel commented on GitHub (Nov 19, 2019):

Thx, for the fast response and action 👍

@igoel commented on GitHub (Nov 19, 2019): Thx, for the fast response and action :+1:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6325