This is the X-cart PHP log...
Code:
<?php die(1); ?>
[16-Jul-2018 12:56:35] Error (code: 1): Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes)
Server API: fpm-fcgi;
Request method: GET;
URI: /x5-tags-test/?target=items_list_demo;
Backtrace:
#0 Includes\ErrorHandler::logInfo() called at [/home/xxxx/public_html/x5-tags-test/Includes/ErrorHandler.php:403]
#1 Includes\ErrorHandler::handleError() called at [/home/xxxx/public_html/x5-tags-test/Includes/ErrorHandler.php:388]
#2 Includes\ErrorHandler::shutdown()
So not much help. The query was working when I was just over-riding the prepareCndSubstring but I didn't get the correct count value and as you've shown it's not really the right way to do this.
I could add some logging into the prepareCndSubstring() method of the X-cart Tags module to see what it's doing?