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

[Backport] 21842: don't cache absolute file paths in validator factory #1

Open
wants to merge 1,166 commits into
base: 2.2-develop
Choose a base branch
from

Conversation

david-fuehr
Copy link
Owner

Original Pull Request

magento#21856

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 a customer, a customer_address or quote for a registered customer is saved.

Fixed Issues

  1. Checkout error for registered customer with cache_id_prefix on multi server setup magento/magento2#21842: Checkout error for registered customer with cache_id_prefix on multi server setup

Manual testing scenarios

most realistic scenario

  1. have a multi server setup with
    1. node backend (absolute instance dir: /var/www/backend/release/2019-02-28)
    2. node frontend-a (absolute instance dir: /var/www/frontend/release/2019-02-28)
    3. node frontend-b (absolute instance dir: /var/www/frontend/release/2019-03-01 - autospawned)
    4. node redis
    5. share cache for all Magento instances (identical id_prefix in cache section of env.php)
    6. [node mysql, ...]
  2. clear cache on backend node
  3. right after that save a customer or customer_address on the backend node (may be a cron job or similar)
  4. place an order with a registered customer on one of the frontend-nodes
    1.expected: The success page is being shown

simplified repro steps

  1. set up a regular instance
  2. make sure that the id_prefix in env.php is defined
    'cache' => [
        'frontend' => [
            'default' => [
                'id_prefix' => '173_'
            ],
            'page_cache' => [
                'id_prefix' => '173_'
            ]
        ]
    ],
  1. redis may be used, the issue can also be reproduced using file based caching
  2. register a customer
  3. place an order using this customer
  4. move the instance directory to another path
  5. update webserver configuration accordingly and restart
  6. try to place an order with the same customer again
    1. expected: success page is being shown

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

viktym and others added 30 commits April 15, 2019 14:58
[TSG] Backporting for 2.2 (pr90) (2.2-develop)
…older exists magento#22369

 - Merge Pull Request magento#22369 from JeroenVanLeusden/magento2:2.2-develop-PR-port-20182
 - Merged commits:
   1. 10de6de
   2. 40b5d2e
…t page is not displayed according to the selected store view scope
…to#21375 - removed non required item options while comparing with merge items
[MPI] Braintree payment method not supported in multi-shipping
Accepted Public Pull Requests:
 - magento#22250: [Backport] Fix gallery event observer (by @Den4ik)
 - magento#22267: magento2-22238: removed backward incompatible change from the options� (by @VitaliyBoyko)
 - magento#22174: WYSIWYG Image-Popup is not working correctly with multipleEditors (by @Nazar65)
 - magento#20107: [2.2] Add support for validation message callback (by @floorz)
 - magento#21946: [Backport] Secure errors directory (by @amol2jcommerce)
 - magento#22078: [backport] issue - 21507 Change photo only if user swipe horizontally (by @Nazar65)
 - magento#21203: [Backport] icon text showing feature (by @mage2pratik)


Fixed GitHub Issues:
 - magento#21789: [BUG] Product gallery opening by mistake (reported by @Den4ik) has been fixed in magento#22250 by @Den4ik in 2.2-develop branch
   Related commits:
     1. 66bacdb

 - magento#22238: Backward-incompatible change between 2.2.7 and 2.2.8 (reported by @yutv) has been fixed in magento#22267 by @VitaliyBoyko in 2.2-develop branch
   Related commits:
     1. 179bedf

 - magento#18548: WYSIWYG-Editor Insert Image-Popup is not working correctly with multiple WYSIWYG-Editors on page (reported by @4ctobias) has been fixed in magento#22174 by @Nazar65 in 2.2-develop branch
   Related commits:
     1. 8611d14
     2. bbe03ea
     3. 84f0af8

 - magento#20078: Magento Ui form validator message callback not supported (reported by @floorz) has been fixed in magento#20107 by @floorz in 2.2-develop branch
   Related commits:
     1. 63c592a

 - magento#20209: errors/local.xml and error page templates are publicly accessible (reported by @schmengler) has been fixed in magento#21946 by @amol2jcommerce in 2.2-develop branch
   Related commits:
     1. 2d291a7

 - magento#7906: Fotorama Gallery too sensitive on Android Devices. (chrome) (reported by @joebordo) has been fixed in magento#22078 by @Nazar65 in 2.2-develop branch
   Related commits:
     1. 744986b
…#21961

 - Merge Pull Request magento#21961 from hiren0241/magento2:2.2-develop-PR-backport-20682
 - Merged commits:
   1. bd87d77
   2. 544100f
   3. 200fac8
   4. d417738
magento-engcom-team and others added 30 commits May 2, 2019 04:49
…tting skipped when customer hitting direct payment step URL magento#22543
Accepted Public Pull Requests:
 - magento#22536: [Bakport] Adding product from wishlist not adding to cart showing warning message. (by @niravkrish)
 - magento#22551: [Backport] Shortening currency list in Configuration->General (replace PR magento#20397) (by @amol2jcommerce)
 - magento#22543: [Backport] [Fixed] Checkout Section: Shipping step is getting skipped when customer hitting direct payment step URL (by @saphaljha)
 - magento#22288: [BACKPORT] #222249 configurable product images wrong sorting fix (by @Wirson)


Fixed GitHub Issues:
 - magento#9155: Adding product from wishlist not adding to cart showing warning message. (reported by @KishorkumarKar) has been fixed in magento#22536 by @niravkrish in 2.2-develop branch
   Related commits:
     1. c62ab93
     2. 4402714

 - magento#21596: Checkout: it is possible to leave blank Shipping Details section and get to Payment Details section by URL (reported by @hiren0241) has been fixed in magento#22543 by @saphaljha in 2.2-develop branch
   Related commits:
     1. 9b9d451
     2. 6645cb2

 - magento#22249: Configurable Product Gallery Images Out of Order when More than 10 images (reported by @sjb9774) has been fixed in magento#22288 by @Wirson in 2.2-develop branch
   Related commits:
     1. f4ab0e6
[TSG] Backporting for 2.2 (pr94) (2.2-develop)
…aining Downlodable Products with "Links can be purchased separately" enabled in Admin Section magento#22582
[pangolin] MQE-1430: [2.2.x] Limit allowed bin/magento commands to specific list (MTF)
 - merged latest code from mainline branch
Accepted Public Pull Requests:
 - magento#22582: [Backport] Alignment Issue While Editing Order Data containing Downlodable Products with "Links can be purchased separately" enabled in Admin Section (by @webkul-deepakkumar)
 - magento#22579: [Backport] Non existing file, when adding image to gallery with move option. Fix for magento#21978 (by @amol2jcommerce)
 - magento#22413: Checkout Totals Sort Order fields can't be empty and should be a number. (by @barbanet)


Fixed GitHub Issues:
 - magento#20917: Alignment Issue While Editing Order Data containing Downlodable Products in Admin Section (reported by @pankaj-cedcoss) has been fixed in magento#22582 by @webkul-deepakkumar in 2.2-develop branch
   Related commits:
     1. 223b710

 - magento#21978: Adding product image: File doesn't exist (reported by @WalterSmulders) has been fixed in magento#22579 by @amol2jcommerce in 2.2-develop branch
   Related commits:
     1. 008f8ef
     2. e97f14c
Accepted Public Pull Requests:
 - magento#22535: [Backport] Fix configurable dropdown showing tax incorrectly in 2.3-develop (by @amol2jcommerce)
 - magento#22016: Magento Catalog - fix custom option type text price conversion for mu� (by @oleksii-lisovyi)


Fixed GitHub Issues:
 - magento#22270: 2.2.8 Configurable product option dropdown - price difference incorrect when catalog prices are entered excluding tax (reported by @danielpfarmer) has been fixed in magento#22535 by @amol2jcommerce in 2.2-develop branch
   Related commits:
     1. f593573
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
- refactoring of static method use should be in a separate pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.