Skip to content

Conversation

jurgisl
Copy link

@jurgisl jurgisl commented Dec 26, 2016

Fixes #7904. Always convert SKU to string.

Without the quotes SKU field on the left is being converted to numeric so it drops trailing characters. Then the numeric comparison sees the 13020663105 and 13020663105SL as the same numbers.

This happens because earlier SKUs are being used as array keys, and array keys, if it is possible, are converted to integer by PHP http://php.net/manual/en/language.types.array.php:

Strings containing valid integers will be cast to the integer type. E.g. the key "8" will actually be stored under 8. On the other hand "08" will not be cast, as it isn't a valid decimal integer.

So if the function is using these keys, they must be manually cast to string (because all SKUs should always be treated as string?).

Fixes magento#7904. Always convert SKU to string.
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Dec 26, 2016

CLA assistant check
All committers have signed the CLA.

@wert2all wert2all self-assigned this Dec 27, 2016
@wert2all wert2all self-requested a review December 27, 2016 07:43
@driskell
Copy link
Contributor

driskell commented Feb 3, 2017

I can see this conflicts as it is now fixed in develop:

c2c8abb

@maghamed maghamed self-requested a review February 16, 2017 14:03
@maghamed maghamed self-assigned this Feb 16, 2017
@maghamed
Copy link
Contributor

Closed as fix for this issue already delivered into mainline

@tkn98
Copy link
Contributor

tkn98 commented Mar 27, 2017

Ack.

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

Successfully merging this pull request may close these issues.

7 participants