-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
21842: don't cache absolute file paths in validator factory #21856
21842: don't cache absolute file paths in validator factory #21856
Conversation
Github issue: magento#21842 In customer and customer_address validation context the validator factory no longer caches absolute file paths for the validation.xml files (currently two file) as the file content is evaluated later in the filesystem directly and the file paths may not be correct in a multi server setup with shared cache (id_prefix)
- adapt unit test
Hi @david-fuehr. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
- refactoring of static method use should be in a separate pull request
Hi @larsroettig, thank you for the review. |
class Factory | ||
{ | ||
/** cache key */ | ||
const CACHE_KEY = __CLASS__; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, we are not allowed to remove the constants according to our Backward Compatible Development Guide. Just mark it as deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback. I addressed this in my latest commit.
*/ | ||
protected $_configFiles = null; | ||
protected $_configFiles; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't change the default value of public/protected properties according to our Backward Compatible Development Guide. Just mark it as deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback. I addressed this in my latest commit.
*/ | ||
public function __construct( | ||
\Magento\Framework\ObjectManagerInterface $objectManager, | ||
\Magento\Framework\Module\Dir\Reader $moduleReader, | ||
FrontendInterface $cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, leave FrontendInterface as constructor parameter and mark it as deprecated, otherwise it's backward incompatible change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback. I addressed this in my latest commit.
Hi @sivaschenko, thank you for the review. |
✔️ QA passed |
…dont-cache-absolute-file-paths
Hi @david-fuehr, thank you for your contribution! |
Description
This issue comes from
Magento\Framework\Validator\Factory::_initializeConfigList
where absolute file paths are cached. The actual file content is evaluated using the local file system.The method is used in
\Magento\Customer\Model\ResourceModel\Address::_validate
,\Magento\Quote\Model\CustomerManagement::validateAddresses
and\Magento\Customer\Model\ResourceModel\Customer::_validate
and thus an error (The "/<abs_instance_path>/app/code/Magento/Eav/etc/validation.xml" file doesn't exist.) occurs whenever acustomer
, acustomer_address
or quote for a registered customer is saved.Fixed Issues
Manual testing scenarios
most realistic scenario
/var/www/backend/release/2019-02-28
)/var/www/frontend/release/2019-02-28
)/var/www/frontend/release/2019-03-01
- autospawned)id_prefix
in cache section ofenv.php
)customer
orcustomer_address
on the backend node (may be a cron job or similar)1.expected: The success page is being shown
simplified repro steps
id_prefix
inenv.php
is definedContribution checklist