Jump to content

Existing page suddenly throwing exception


Reid Bramblett
 Share

Recommended Posts

So I have a page that's been in there since early days developing this site, and it was working perfectly fine. I haven't fiddled with it for ages, then suddenly yesterday it stopped working, throwing the following verbose exception:

Fatal Error: Exception: Unimplemented operator in DatabaseQuerySelectFulltext::match() (in /Applications/MAMP/htdocs/test-pw/wire/core/DatabaseQuerySelectFulltext.php line 101)

#0 /Applications/MAMP/htdocs/test-pw/wire/modules/Fieldtype/FieldtypeOptions/SelectableOptionManager.php(197): DatabaseQuerySelectFulltext->match('fieldtype_optio...', 'title', '>', '0 ')
#1 /Applications/MAMP/htdocs/test-pw/wire/modules/Fieldtype/FieldtypeOptions/FieldtypeOptions.module(309): SelectableOptionManager->findOptionsByProperty(Object(Field), 'title', '>', '0 ')
#2 /Applications/MAMP/htdocs/test-pw/wire/core/PageFinder.php(588): FieldtypeOptions->getMatchQuery(Object(DatabaseQuerySelect), 'field_cat_rank', 'data', '>', '0 ')
#3 [internal function]: PageFinder->___getQuery(Object(Selectors), Array)
#4 /Applications/MAMP/htdocs/test-pw/wire/core/Wire.php(397): call_user_func_array(Array, Array)
#5 /Applications/MAMP/htdocs/test-pw/wire/core/Wire.php(332): Wire->runHooks('getQuery', Array)
#6 /Applications/MAMP/htdocs/test-pw/wire/core/Pa in /Applications/MAMP/htdocs/test-pw/index.php on line 254

This error message was shown because site is in debug mode ($config->debug = true; in /site/config.php). Error has been logged.

I tried re-creating the page and deleting the old one, and get the same error with the fresh version. I tried repairing and optimizing the database. No dice. (I have no idea what the core stuff means; I try to stay away from that "wire" folder.)

Oddly, if I change the name of the page, it starts working just fine.

This is doubly odd in that this page has "cousins" with the same name that live in parallel nested page structures, and they are all working just fine. (It is a travel guidebook site, and each city has "see, do, sleep, eat" and "plan" pages underneath the main page, and more underneath each of those; it is one of the "plan" pages that suddenly went haywire.) 

Any advice? For the record, I'm rocking PW 2.7.2. Thanks.

Link to comment
Share on other sites

Hi, looking at the error message at:
 

 DatabaseQuerySelectFulltext->match('fieldtype_optio...', 'title', '>', '0 ')

It looks like you use a selector like "title > 0". That might be the issue, as a text field does not support the "> or <" operator. (Assuming that your title is a text field, not integer).

Maybe check where this selector is used and replace it with a proper one.

Greetings

Link to comment
Share on other sites

Nope. There is no "title > 0" (or anything like it) anywhere in my code. (I just checked.)

Also, it's the "name" field that's the issue, and just with that one specific name. I can stick any other name in there and it works (though all the links into it won't, obviously). So weird. 

Link to comment
Share on other sites

Yes right, it's not even in your code... My fault, sorry.

Did you make sure all caches are emptied (if applicable) and also disabled the cache of the page's template?

What you maybe also could take a closer look at is the cat_rank (?) field which seems to be involved too. 

Maybe check the field and it's option values etc. maybe something changed or is wrong there?

Hope it helps

  • Like 1
Link to comment
Share on other sites

Something's off here, as 2.7.2's index.php doesn't even have a line 254 (2.7.3 neither, and 3.x' is even shorter). Reid, can you take a look what line 254 in your index.php is?

Link to comment
Share on other sites

My index.php does have a line 254. In fact, it's the final line of code in the file: 

trigger_error($errorMessage, E_USER_ERROR); 

...which is, of course, just the end of a larger statement, which reads in full:

catch(Exception $e) {

/*
* Formulate error message and send to the error handler
*
*/
if($process) $process->failed($e);
$wire ? $wire->trackException($e) : $config->trackException($e);
$errorMessage = "Exception: " . $e->getMessage() . " (in " . $e->getFile() . " line " . $e->getLine() . ")";
if($config->debug || ($wire && $wire->user && $wire->user->isSuperuser())) $errorMessage .= "\n\n" . $e->getTraceAsString();
trigger_error($errorMessage, E_USER_ERROR); 
}

Sebii: Nothing on my site is cached (so far as I know), including the template on which that page is based.

Also, that template doesn't even use the cat_rank field.

Link to comment
Share on other sites

Hmm. I ran the updater and ticked the box to replace it, but I also don't see an old one backed up. 

To be sure, I just downloaded afresh the entire zip file from the Processwire site, looked at its index.php, and it seems identical to mine (and runs to 251 lines—well, 249 plus two superflous carriage returns at the end).

Link to comment
Share on other sites

Hmm. I ran the updater and ticked the box to replace it, but I also don't see an old one backed up. 

To be sure, I just downloaded afresh the entire zip file from the Processwire site, looked at its index.php, and it seems identical to mine (and runs to 251 lines—well, 249 plus two superflous carriage returns at the end).

But you mention above that your index has a line 254:

My index.php does have a line 254. In fact, it's the final line of code in the file: 

Link to comment
Share on other sites

Yes right, it's not even in your code... My fault, sorry.

Did you make sure all caches are emptied (if applicable) and also disabled the cache of the page's template?

What you maybe also could take a closer look at is the cat_rank (?) field which seems to be involved too. 

Maybe check the field and it's option values etc. maybe something changed or is wrong there?

Hope it helps

Sebii was right! Turns out there was a smack-myself-on-the-head spacing typo in a separate template dependent upon this page, that only applied to this page, and it did have to do with cat_rank (as a search parameter). I had, in the string of parameters, "cat_rank>0 ," (with a space between the zero and the comma. Removed the space, problem resolved itself.

(Since I hadn't touched that template in ages, though, I'm still confused as to why it was suddenly a problem and not before. Maybe PW is just getting better at rooting out bugs.)

Thanks for all the help!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...