Wrong attribute value in query if use filterByAttribute (topics) more than 1

Permalink 0 0 Browser Info Environment
Reproduce error:
Create 2 or more topics:
Topic 1
- Apple (1)
- Banana (2)
Topic 2
- Water (3)
- Stone (4)

Create 2 or more attributes with link to topic:
Attribute 1 -> Topic 1
Attribute 2 -> Topic 2

Create custom page list template with this code:
$topicApple = TreeNode::getByID(1);
$list->filterByAttr1($topicApple);
$topicWater = TreeNode::getByID(3);
$list->filterByAttr2($topicWater);


Query string:
SELECT p.cID FROM Pages p LEFT JOIN PagePaths pp ON (p.cID = pp.cID and pp.ppIsCanonical = true) LEFT JOIN PageSearchIndex psi ON p.cID = psi.cID LEFT JOIN PageTypes pt ON p.ptID = pt.ptID INNER JOIN Collections c ON p.cID = c.cID INNER JOIN CollectionVersions cv ON p.cID = cv.cID LEFT JOIN CollectionSearchIndexAttributes csi ON c.cID = csi.cID 
WHERE (ak_exclude_search_index <> 1 or ak_exclude_search_index is null) 
   AND (ak_attr1 LIKE ?) AND (ak_attr2 LIKE ?) 
   AND (p.cPointerID < 1) AND (p.cIsTemplate = 0) AND (cvIsApproved = 1) AND ((cvPublishDate <= ? or cvPublishDate is null)) AND (p.cIsActive = ?) AND (p.siteTreeID = ?) AND (p.cIsSystemPage = ?) ORDER BY cv.cvName asc LIMIT 10 OFFSET 0

with params
["%||\/Water%||", "%||\/Water%||", "2017-12-06 08:39:59", true, 1, false]


Status: New
goesredy

concrete5 Environment Information

# concrete5 Version
Core Version - 8.2.1
Version Installed - 8.2.1
Database Version - 20170802000000

# concrete5 Packages
Reduya (1.1)

# concrete5 Overrides
blocks/reduya_ajax_topics_filter/edit.php, blocks/reduya_ajax_topics_filter/page_list_form.php, blocks/reduya_ajax_topics_filter/view.php, blocks/reduya_ajax_topics_filter/controller.php, blocks/reduya_ajax_topics_filter/view.css, blocks/reduya_ajax_topics_filter/tools/filter.php, blocks/reduya_ajax_topics_filter/tools, blocks/reduya_ajax_topics_filter/db.xml, blocks/reduya_ajax_topics_filter/icon.png, blocks/reduya_ajax_topics_filter/auto.js, blocks/reduya_ajax_topics_filter/rss.png, blocks/reduya_ajax_topics_filter/add.php, blocks/reduya_ajax_topics_filter, elements/express/form/view/attribute_key.php, elements/express/form/view/association.php, elements/express/form/view/form.php, elements/express/form/view/text.php, elements/express/form/view/dashboard/association.php, elements/express/form/view/dashboard, elements/express/form/view, elements/express/form/form/association/select_multiple_reorder.php, elements/express/form/form/association/select_multiple.php, elements/express/form/form/association/select.php, elements/express/form/form/association, elements/express/form/form/form.php, elements/express/form/form, elements/express/form, elements/express, elements/form/composer.php, elements/form/bootstrap3.php, elements/form/grouped/composer.php, elements/form/grouped/bootstrap3.php, elements/form/grouped, elements/form, src/Concrete/Page/PageList.php, src/Concrete/Page, src/Concrete

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
litespeed

# PHP Version
5.6.32

# PHP Extensions
bcmath, bz2, calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, json, libxml, litespeed, mbstring, mcrypt, mhash, mysql, mysqli, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, pspell, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, standard, tidy, timezonedb, tokenizer, uploadprogress, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - -1
max_input_vars - 3000
memory_limit - 512M
post_max_size - 64M
sql.safe_mode - Off
upload_max_filesize - 64M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5