Hi there! And thanks for Processwire!
It appears that i've found something interesting about PW selectors. They should only be strings! Here's an example of SQL-like syntax for selector:
$my_complex_selector = "
name='some name',
parameter=123,
other_parameter=[subparam>=subvalue]
";
Trying to use this selector lead to a very buggy PW behaviour. It appears that newlines are treated in a very special manner by PW selector engine, preventing the newlined selectors from working as expected.
I cannot imagine a situation when an unescaped newline could be a part of selector or selector value, so stripping newline symbols from selector could be a good idea for further PW development. And, currently, another good idea is to write complex selectors as PHP arrays:
$my_complex_selector = [
"name=$name",
"param1=$param1",
];
and to implode them into a single line before using find() and other functions which use selectors.
Sorry if i wrote something trivial, but having this post already present at support forum could save me a couple of hours. Hope mine will save that tame for someone else ?