Frank Vèssia Posted September 25, 2011 Posted September 25, 2011 i'm creating some pages from an xml, sometimes i get this error: admin:/grab/:ProcessWire Error:Exception: Unknown Selector operator: '' -- was your selector value properly escaped? (in /home/librolo/public_html/wire/core/Selectors.php line 135) #0 /home/librolo/public_html/wire/core/Selectors.php(160): Selectors->create('indagine', '', 'senza censure s...') #1 /home/librolo/public_html/wire/core/Selectors.php(63): Selectors->extractString('has_parent=1485...') #2 /home/librolo/public_html/wire/core/Pages.php(111): Selectors->__construct('has_parent=1485...') #3 [internal function]: Pages->___find('has_parent=1485...', Array) #4 /home/librolo/public_html/wire/core/Wire.php(267): call_user_func_array(Array, Array) #5 /home/librolo/public_html/wire/core/Wire.php(229): Wire->runHooks('find', Array) #6 /home/librolo/public_html/wire/core/Page.php(656): Wire->__call('find', Array) #7 /home/librolo/public_html/wire/core/Page.php(656): Pages->find('has_parent=1485...', Array) #8 /home/librolo/public_html/site/templates/grab.php(123): Page->find('template=libro,...') #9 /home/librolo/public_html/site/templates before saving the page i use always the sanitizer for every field.
Adam Kiss Posted September 25, 2011 Posted September 25, 2011 This often happens if you put space (' ') between query selector ('template') and sign ('='). Check that on your line 123 in grab.php.
Frank Vèssia Posted September 26, 2011 Author Posted September 26, 2011 this is my query $find=wire('pages')->get(1485)->find("template=libro,title%=$titolo"); looks correct...
ryan Posted September 26, 2011 Posted September 26, 2011 The problem appears to be a result of characters in your $titolo field. You mentioned you are using $sanitizer, but didn't mention if you are using $sanitizer->selectorValue() before bundling the value into your selector. You would want to do this in addition to any other $sanitizer/sanitization you are already doing. This is because selector values need to be sanitized so that the values in them don't get confused as other components of a selector. So make sure that you are doing this: <?php $titolo = $sanitizer->selectorValue($titolo); $find=wire('pages')->get(1485)->find("template=libro,title%=$titolo"); If that doesn't work, try echoing the value of $titolo before calling find() so that you can see which one is causing the problem. From what I can tell, it starts with "senza censure". I am thinking that you can fix this just with $sanitizer->selectorValue(), but if not then paste in the full value here that is causing the problem and we can analyze it further.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now