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

SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value #29

Open
kocheskid opened this issue Jan 4, 2019 · 0 comments

Comments

@kocheskid
Copy link

First I want to mention that I'm on PHP 7.2.13, now the problem:

  • I have webstore that logged users and guest users are allowed to add items to cart. I'm using DatabaseStorage, when logged in user adds item in the cart, the module creates record in the cart table with sessionId : {logged_in_user_id} Ex: 1, and when Guest user adds item in the cart, the module creates record in the cart table with sessionId : {session_id} Ex: 77g9t9t5u5qdvrogoi4j0muiam , ONLY when both of these record types exists in the Cart Table, when you try to delete the last item in the cart from the LOGGED User (sessionId: 1), it throws the error:

SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: '77g9t9t5u5qdvrogoi4j0muiam'
The SQL being executed was: DELETE FROM cart WHERE sessionId=1

I resolve this by chaning this: (DatabaseStorage.php Line:132)
$command->delete($this->table, [$this->idField => $identifier]);

to this:
$command->delete($this->table, [$this->idField => (string)$identifier]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant