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

Handle locales where <? (string) 1.32 // 1,32 ?> #90

Merged
merged 1 commit into from
Nov 17, 2017
Merged

Handle locales where <? (string) 1.32 // 1,32 ?> #90

merged 1 commit into from
Nov 17, 2017

Conversation

FelixMalfait
Copy link
Contributor

@FelixMalfait FelixMalfait commented Nov 16, 2017

setlocale(LC_ALL,'fr_FR.utf8');
(string) 1.32; // return 1,32

PHP's __toString on floats converts it to the user's locale.
The comma will then cause a database error.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 84.639% when pulling ebc8cea on FelixMalfait:patch-1 into 65ae484 on njbarrett:master.

@njbarrett njbarrett merged commit defae81 into mstaack:master Nov 17, 2017
@njbarrett
Copy link
Collaborator

Thanks for this

@njbarrett
Copy link
Collaborator

Actually this seems to have broken the tests, are you able to update the tests to pass?

@FelixMalfait
Copy link
Contributor Author

FelixMalfait commented Nov 17, 2017

Yes I saw this sorry, will have a look today :)
(test broken not because it breaks anything but rather because of the way tests were written)

@FelixMalfait
Copy link
Contributor Author

In the end this is actually much more work than I thought.
The underlying issue is that you're converting the arguments to string instead of using the argument replace feature of the sql driver. This probably has some other side effects like making users of this package vulnerable to SQL injections.
@challet is trying to work on this now, we'll keep you updated :)
Many thanks for your work on this package, not trying to come and criticise your work ;), just opening a discussion

@FelixMalfait FelixMalfait deleted the patch-1 branch November 17, 2017 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants