Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with accents for my columns #307

Open
samuelboudetfmm opened this issue May 4, 2024 · 2 comments
Open

Bug with accents for my columns #307

samuelboudetfmm opened this issue May 4, 2024 · 2 comments
Labels
Bug Something isn't working

Comments

@samuelboudetfmm
Copy link

samuelboudetfmm commented May 4, 2024

Bug Report

I am using grocery crud which use laminas-db v2.20. I have bugs when I have accents in my columns that I can correct if I made a change in laminas db and I think it's a bug of laminas db.

The bug come from
laminas-db/src/Adapter/Platform/AbstractPlatform.php function quoteIdentifierInFragment
Line 45:
$parts = preg_split(
$this->quoteIdentifierFragmentPattern,
$identifier,
-1,
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
);

If $identifier has accent since $quoteIdentifierFragmentPattern = '/([^0-9,a-z,A-Z$_:])/i';
$identifer is broken done and particularly 2 bytes character are broken down in two.

To correct this it should be $quoteIdentifierFragmentPattern = /([^\p{L}0-9$_\-:])/iu' to include all accentued characters

This correction has also to be made in MySQL.php and i guess in some other files.

@samuelboudetfmm samuelboudetfmm added the Bug Something isn't working label May 4, 2024
@Ocramius
Copy link
Member

Ocramius commented May 5, 2024

when I have accents in my columns

This may sound harsh, but "play stupid games, win stupid prizes". Who the hell added accents to a column name in a DB schema?!

My endorsement here would be to throw an exception on any non-ASCII sequence passed in.

@Ocramius
Copy link
Member

Ocramius commented May 5, 2024

throw an exception on any non-ASCII sequence passed in.

BTW, this leads to DoS attacks when user input is passed to these methods, so more reasoning needed around this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants