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

EZP-31810: Compound SiteAccess matcher will include serialized 'pathinfo' and 'queryParams' attributes unnecessarily #3061

Merged
merged 5 commits into from
Sep 3, 2020

Conversation

adamwojs
Copy link
Member

@adamwojs adamwojs commented Aug 26, 2020

Question Answer
JIRA issue EZP-31810
Bug/Improvement yes
New feature no
Target version 7.x
BC breaks no
Tests pass yes
Doc needed no

TODO:

  • Implement feature / fix a bug.
  • Implement tests.
  • Fix new code according to Coding Standards ($ composer fix-cs).
  • Ask for Code Review.

@andrerom
Copy link
Contributor

andrerom commented Aug 26, 2020

LGTM, but should be targeting 6.13 given the previous fixes have gone there as well, and this is a regression.

@adamwojs adamwojs requested a review from a team August 27, 2020 14:05
@adamwojs adamwojs added the Bug label Aug 27, 2020
@adamwojs adamwojs requested review from alongosz, kaff, mikadamczyk, Nattfarinn, ViniTou and webhdx and removed request for a team August 27, 2020 14:09
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer\Stubs;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, it looks more like Fake than Stub but I don't know that we want to stick strictly to definition ;)

*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer\Stubs;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, it looks more like Fake than Stub but I don't know that we want to stick strictly to definition ;)

*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer\Stubs;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, it looks more like Fake than Stub but I don't know that we want to stick strictly to definition ;)

$data = parent::normalize($object, $format, $context);
foreach (array_keys($data) as $property) {
if (!in_array($property, $this->getAllowedProperties())) {
unset($data[$property]);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering that this logic is enough tested. I know that testing abstract class is often subject of long discussions ;) but..
as we see this part of code turned out essential for our client.
Deleting unnecessary keys feature was covered by testing classes extending abstract and I have a feeling that this important part of code is tested a bit "by accident". For now, we have in the system some class which has some properties which shouldn't be serialized - but it can change in the future. My point is that maybe it could be a good idea to test it explicitly ;)

Copy link
Member

@mnocon mnocon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested various SiteAccess matcher combinations taking into account the scenario described in the ticket (Varnish making too many requests because of too much detail included in serialized SiteAccess), but also additional scenarios involving permissions and other parts of the system (e.g. Page Builder) to make sure that the fix works correctly.

It fixes the issue and I haven't found anything wrong with it, QA approved.

I had some issues with URIText matcher and Page Builder (unrelated to this PR) that I will investigate tomorrow and report to JIRA if needed.

@lserwatka lserwatka merged commit 5d0d02a into 7.5 Sep 3, 2020
@lserwatka
Copy link
Member

@adamwojs Could you merge it up?

@adamwojs adamwojs deleted the ezp_31810 branch September 3, 2020 08:52
@adamwojs
Copy link
Member Author

adamwojs commented Sep 3, 2020

@lserwatka done.

andrerom pushed a commit that referenced this pull request Sep 3, 2020
…nfo' and 'queryParams' attributes unnecessarily (#3061)

* EZP-31810: Aligned Normalizer implementation for Compound matcher   with __sleep method

* EZP-31810: Impl. Normalizer for HostElement, Map, Regex and URIElement matchers

* EZP-31810: Updated \eZ\Publish\Core\MVC\Symfony\Component\Serializer\SerializerTrait

* EZP-31810: Fixed unit tests

* EZP-31810: Added unit tests for HostTextNormalizer, RegexHostNormalizer,
RegexURINormalizer, URITextNormalizer

(cherry picked from commit 5d0d02a)
@andrerom
Copy link
Contributor

andrerom commented Sep 3, 2020

Cherry-picked to 6.13 in d86c763

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

Successfully merging this pull request may close these issues.

7 participants