bsmither Posted January 31, 2021 Share Posted January 31, 2021 Would someone please test this: <?php ini_set('memory_limit', '256M'); // Platypus Suhosin limit is 256M ini_set('max_execution_time', '60'); ini_set('error_log', 'error_log'); ini_set('log_errors', 'on'); $search_data['keywords'] = "+(*TESA31*) +(*TESA34*) +(*TESA35*)"; $words = preg_replace('/[^\p{Greek}a-zA-Z0-9\-\s]+/u', '', $search_data['keywords']); var_dump($words); ?> I am running PHP 7.4.3 (on Linux Mint 19.4 if that makes a difference). The regex is supposed to not remove whitespace (among other things), but it is. I get: string 'TESA31TESA34TESA35' (length=18) Link to comment Share on other sites More sharing options...
Al Brookbanks Posted January 31, 2021 Share Posted January 31, 2021 I'm PHP 7.4.3 too but on Ubuntu. Quote string(18) "TESA31TESA34TESA35" Link to comment Share on other sites More sharing options...
bsmither Posted January 31, 2021 Author Share Posted January 31, 2021 My research shows this is a bug in PCRE2 that has been variously fixed, but sporadically implemented in the various distros. For a specific example: https://github.com/oerdnj/deb.sury.org/issues/1526 and: https://bugs.php.net/bug.php?id=80118 So, I will test by adding ini_set('pcre.jit', 0); Link to comment Share on other sites More sharing options...
Al Brookbanks Posted January 31, 2021 Share Posted January 31, 2021 Frustrating! Link to comment Share on other sites More sharing options...
bsmither Posted January 31, 2021 Author Share Posted January 31, 2021 The ini_set test didn't fix it, but this is a work-around: $words = preg_replace('/[^ \p{Greek}a-zA-Z0-9\-]+/u', '', $search_data['keywords']); One generally doesn't manage to input - other than spaces - whitespace in text entry fields. (Hopefully, the Sanitize class will catch that anyway.) I think it's a moot point anyway because it seems the final search term in searchCatalogue()'s fulltext mode is unusable because a string has been built up using multiple search words, then only to be torn down on the next statement. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.