Problem/Motivation

Path "" not prefixed with slash.

Validation message is shown if Pages textarea is empty. D7 version does not validate for "/" as this is a new feature in D8.

Proposed resolution

Fix the incorrect validation.

Remaining tasks

Review patch.

User interface changes

None.

API changes

None.

Data model changes

None.

Hello,

Thank you for this awesome module.

I was making tests and I emptied the specific page textarea and I got a validation error.

I will upload a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Grimreaper created an issue. See original summary.

Grimreaper’s picture

Grimreaper’s picture

Assigned: Grimreaper » Unassigned
hass’s picture

Status: Needs review » Needs work
Issue tags: +Need tests
hass’s picture

Project: Piwik Web Analytics » Matomo Analytics
Pol’s picture

Hi,

I worked on a patch where pages are saved in an array instead of a concatenated string.

Do you think it would be usefull for this project ? I've got a working POC.

pfrenssen’s picture

Seems like 2 different issues, this is a straightforward bug fix. Saving the pages as an array would be a nice improvement but it's out of scope for this I think.

hass’s picture

Block visibility was cloned from core and should work like core. If core now uses an array, we should also do this. If not, let‘s keep it as is, please.

hass’s picture

Aside, can you verify if the „fix“ you are trying here, clones the block logic? Maybe block system has the same problem and there is a reason for this I currently cannot remember...

hass’s picture

Issue summary: View changes

  • hass committed 0609154 on 8.x-1.x authored by Grimreaper
    Issue #2826956 by Grimreaper: Validation error when specific pages...
hass’s picture

Status: Needs work » Fixed
hass’s picture

Status: Fixed » Needs work

oh, we need a test

Grimreaper’s picture

Thanks for the commit.

Pol’s picture

In the meantime, I've checked in the D8 code, the Request Path condition plugin (core/modules/system/src/Plugin/Condition/RequestPath.php) and it's using a concat string to store its path, so, the idea to use array to store path is not valid in this context.

By the way, would it be a good idea to use the request path condition plugin in Matomo instead of basically redoing the same ?

Thanks.

pfrenssen’s picture

Assigned: Unassigned » pfrenssen

Assigning to write the test.

pfrenssen’s picture

Assigned: pfrenssen » Unassigned
Status: Needs work » Needs review
Issue tags: -Need tests
FileSize
2.64 KB
3.51 KB

Here is a test. I went straight for a modern PHPUnit test instead of adding to the existing browser tests, so that this doesn't impact the work on #2941830: Fix tests.

I have also provided a variant of the patch that has the original fix reverted, so that we can check that the test correctly detects the bug.

The last submitted patch, 17: 2826956-17.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 17: 2826956-17-reverted.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

pfrenssen’s picture

Forgot to declare the required test group.

Status: Needs review » Needs work

The last submitted patch, 20: 2826956-20-reverted.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

pfrenssen’s picture

Status: Needs work » Needs review

Back to needs review, the reverted patch failed as expected.

hass’s picture

By the way, would it be a good idea to use the request path condition plugin in Matomo instead of basically redoing the same ?

Yes, I just had not understood how in past... if you know how, let's do it.

hass’s picture

The patch seems not testing the bug we fixed here... we should make sure this does not get introduced by fault again somedays in future.

pfrenssen’s picture

It's not so obvious, but the first part of the data provider is testing the bug from this issue:

      [
        // No validation error should be thrown for an empty page list.
        '',
        FALSE,
      ],

This means that if nothing is filled in for the specific pages there should be no validation error. I've uploaded a version of the test that reverts the patch of this issue, and then the test fails.

  • hass committed fb3f732 on 8.x-1.x authored by pfrenssen
    Issue #2826956 by pfrenssen, Grimreaper, hass: Validation error when...
hass’s picture

Status: Needs review » Fixed
Pol’s picture

Only the test has been committed ?

hass’s picture

See #11

Pol’s picture

Oops ! Thanks !

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.