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

Fix ContextErrorException due to long2ip() #71

Merged
merged 4 commits into from
Mar 26, 2020

Conversation

davidglezz
Copy link
Contributor

Fix https://github.com/PrestaShop/psgdpr/issues/61
long2ip() expects parameter 1 to be integer, string given

Fix https://github.com/PrestaShop/psgdpr/issues/61
long2ip() expects parameter 1 to be integer, string given
psgdpr.php Outdated Show resolved Hide resolved
@davidglezz
Copy link
Contributor Author

davidglezz commented Jan 13, 2020

ip_addres column is varchar 16, only ipv4

IPv4 long: -2 147 483 648 -> 11 chars✅
IPv4 text: 255.255.255.255 -> 15 chars✅
IPv6 long: 3.4028237e+38 -> 40 chars❌
IPv6 text: FE80:CD00:0000:0CDE:1257:0000:211E:729C -> 39 chars❌

😐 Maybe I should open an issue to propose changing this.

In my database I only see that it stores the ip as long

@PierreRambaud
Copy link
Contributor

I think there are some issues with the ip_address field 😅

Although the column is varchar, the model class validates the content with the isIp2Long function, so the content is a number
@davidglezz
Copy link
Contributor Author

Updated:
Although the column is varchar, the model class https://github.com/PrestaShop/PrestaShop/blob/develop/classes/CustomerMessage.php#L72 validates the content with the isIp2Long function, so the content is a number.

Co-Authored-By: GoT <PierreRambaud@users.noreply.github.com>
@sarahdib
Copy link

@davidglezz

Thank you for the PR. Can you give us a test case ?

@Matt75
Copy link
Contributor

Matt75 commented Mar 26, 2020

This is required since a change on PHP long2ip : https://www.php.net/manual/en/function.long2ip.php

Changelog
7.1.0 | The parameter type of proper_address has been changed from string to integer.

To reproduce, you should have PHP 7.1 or higher and debug mode activated on PrestaShop
Go to FO > My Account > My Personal Data > Get my data to PDF

@sarahdib sarahdib self-assigned this Mar 26, 2020
@Progi1984 Progi1984 merged commit 2a11532 into PrestaShop:dev Mar 26, 2020
@Progi1984
Copy link
Member

Thanks @davidglezz

@Matt75 Matt75 changed the title Fix long2ip() parameter type Fix ContextErrorException due to long2ip() Apr 2, 2020
@Matt75 Matt75 added the bug Something isn't working label Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working QA ✔️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants