Issue:Includematch does not filter results

From FollowTheScore
Jump to: navigation, search
Description: "includematch" can not be used like in version 1.7.4: It does not filter results.
Extension / Version: DPL   /   1.8.6
Type / Status: Bug   /   open

Problem

I updated DPL from version 1.7.4 to version 1.8.6

within version 1.7.4 I used the parameter includematch very often.

E.g.:

<dpl>
 category=to-be-investigated
 include={template}:parameter
 includematch=/.*Value I am Looking for.*/si
</dpl>

Using DPL 1.7.4 this produced a list of only those pages containing "Value I am Looking for" in the "parameter" of the "template".


Using DPL 1.8.6 this produced additionally those pages where the "includematch" did not match.

I think the behavior of 1.7.4 is the better one. Until this problem is resolved I downgraded back to version 1.7.4

BTW: I am using MediaWiki 1.13.3; PHP 5.2.8 (isapi); MySQL 5.1.30-community

Reply

Can you please reproduce the error here in this wiki? The official test example (Test includematch) looks quite o.k. to me.

Feel free to extend that example or to create a 'brother' like 'Test includematch 2'.

And you should have in mind that includematch, as the manual explains, matches the given pattern against the complete content of the template call, not only against the value of the parameter(s) you specified in the include statement.

Gero 16:11, 5 August 2009 (UTC)

Reproduction

Sorry my discription was a little wrong -

  • it works correctly with including templates
  • it does not work correctly with including sections:

I added a section "Data" to the Pages Republic of Cameroon and Republic of Burundi

Without the "includematch" Parameter - the following dpl displays both sections:

Result: 5 pages

Adding the "includematch" Parameter - only the Section containing "Kirundi" is displayed

  • Republic of Burundi
    Name Republic of Burundi
    Official Languages Kirundi,French
    Goverment Republic
    Area 10,745 sq mi
    Population 7,548,000
    GDP $4.517 billion
    Independence Days 01/07/1962
Result: 1 pages

But those pages where the "includematch" does not match should not be listet.

Only on one page "Kirundi" was found -- there should be only one page listed.

I expected ..."Result: 1 pages"

Solution

You are right. I will fix the bug in the next release (which may take a little while). If you want to patch your installation the only thing you need to do is the following:

  • look near line #380 in DPL.php for a line which performs a "break"
 if (!array_key_exists(0,$secPieces)) break;
  • replace that line by the following text:
 if (!array_key_exists(0,$secPieces)) {
    // avoid matching against a non-existing array element
    // and skip the article if there was a match condition
    if ($mustMatch!= || $mustNotMatch!=) $matchFailed=true;
    break;
 }

That´s it. Thanks for bringing up the error! Gero 17:30, 6 August 2009 (UTC)