1

If you have Magento 1.9.2.4 (this may apply to other versions too), apply the SUPEE-10415 security patch, and then use Git to merge the result into a branch with Magento 1.9.3.7 in it, then your site will break if you use Git's default settings.

This is because the security patch and Magento 1.9.3.7 declare

Mage_Core_Helper_String::unserialize() and Mage_Customer_Model_Customer::MAXIMUM_PASSWORD_LENGTH

in different places in the same file, and when you merge with Git's default behavior, it keeps both declarations, which in principle is how you want it to behave - after all, git can't be expected to know very much about PHP syntax, and for all Git cares it's just two code hunks that got added to the same file.

I would add an answer to Security Patch SUPEE-10415 - Possible Issues? but I don't have enough reputation to do so. So I'm choosing to add a question and link to the original instead. I'll also add an answer on how best to fix the problem for those of us who find out about this issue the hard way.

1 Answer 1

1

unserialize

If you have this problem, there should be two declarations of unserialize in app/code/core/Mage/Core/Helper/String.php. Remove the top one, it should be on or near line 84. This way you keep the one that is in Magento 1.9.3.7.

MAXIMUM_PASSWORD_LENGTH

If you have this problem, there should be two declarations of MAXIMUM_PASSWORD_LENGTH in app/code/core/Mage/Customer/Model/Customer.php. Remove the top one, it should be on or near line 54. This way you keep the one that is in Magento 1.9.3.7.

How to prevent this problem

The way I found out about this was because where I work, we use a pre-commit hook that checks, among others, any staged PHP files before committing, so you can't commit if your commit introduces any PHP errors. I think we wrote it in house so I don't know if I can just share it, but I'm sure there are a few ready-made free ones you can find on Github.

Apart from that, AFAIK there really is not much you can do. As I mentioned in the question, Git's behavior in this instance is actually pretty much how you want it to behave, and the fault IMO lies squarely with Magento, although having said that, I can certainly see how an issue like this might slip by unnoticed.

You could try having Git prefer changes in the 1.9.3.7 branch with --ours or --theirs, but I have not tried this myself.

HTH!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.