Conversation
install() set the three merchant notification flags and then wrote the shop email into MA_MERCHANT_MAILS, the 1.6 era key. Since 2.4.0 the configuration form reads and writes one key per notification, and upgrade-2.4.0.php migrates the old value into them - but a fresh install never runs that upgrade. So the module installs with New order, Out of stock and Return slip all enabled and no address in any of the fields the form uses, and the first save answers with three "Please enter one (or more) email address" errors before the merchant has touched anything. The three keys are now seeded from PS_SHOP_EMAIL alongside the legacy one, and uninstall() removes them - it dropped only the legacy key, leaving the three behind on every uninstall. Fixes PrestaShop/PrestaShop#34784
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
install()turns on the three merchant notifications and then writes the shop email intoMA_MERCHANT_MAILS, the 1.6 era key. Since 2.4.0 the configuration form reads and writes one key per notification —MA_MERCHANT_ORDER_EMAILS,MA_MERCHANT_OOS_EMAILS,MA_RETURN_SLIP_EMAILS— andupgrade/upgrade-2.4.0.phpmigrates the old value into them. A fresh install never runs that upgrade, so the module lands with all three notifications enabled and no address in any field the form uses, and the very first save answers with three "Please enter one (or more) email address" errors before the merchant has touched anything. The three keys are now seeded fromPS_SHOP_EMAILalongside the legacy one, anduninstall()removes them: it dropped only the legacy key and left the three behind on every uninstall.ps_configuration— noMA_*row should remain.Measured
On a shop where the module was installed from upstream, before touching anything:
Three notifications on, and the three keys
postProcess()validates and saves do not exist.postProcess()reportsPlease enter one (or more) email address …for each flag that is on with an empty field, which is why the first save fails on a untouched install.Real install cycle with the patched module (
bin/console prestashop:module uninstalltheninstall):The uninstall half was checked against a control, with the keys present in both runs:
PHPStan through the core config, comparing
upstream/devagainst the branch: 22 errors both ways, so the change adds none.Not changed
Existing installs are left alone. Their three fields are whatever the merchant last saved, and re-seeding them on upgrade would silently restore an address a merchant may have removed on purpose. The error message already tells them which notification is missing an address.
The workaround circulating on the issue — adding a trailing comma — is unrelated: the delimiter is
,andexplode(',', 'a@b.com')already yields one valid address, so a single email without a comma saves fine once the field is not empty.