01480: Throwing an error when going to the search page/attempting to search
Description: There is an error being thrown by clicking onto the search page/using the search bar. My wikis are set up using a wiki farm but this is what is being thrown in my error logs.
PHP Parse error: syntax error, unexpected 'and' (T_LOGICAL_AND) in /ADDRESS TO HOME WIKI/pmwiki.php(280) : eval()'d code on line 1: /dh/cgi-system/php74.cgi, referer: ADDRESS TO WIKI ON WIKI FARM
I didn't seem to be having any issues before I updated to 2.3.11, but I was also in the midst of a server transfer. Kat?
What were the search terms? Can you experience the same error on this wiki? What are your page list templates? It looks like this is caused by a conditional markup, either in the Site.Search page or in the page list templates. Can we look at the wiki? --Petko
Okay, following up on that I deleted the Site.Search page on the wiki farm so it defaulted to the one in the core wiki. It seems I forgot Vector (which is the base template I use) uses some custom pages that suddenly don't seem to be playing nice. I'll look more into that, but it seems everything is working appropriately now. Wiki is http://losteventidestudios.com/homebrew/index.php. I'll peruse the other files to make sure everything else seems to be okay, thank you for the direction! --Kat?
Thank you for your feedback, this was helpful. Indeed the problem appears to come from the Site.Search page shipped with Skins:Vector, where a page variable {$HTTPVariablesAvailable}
apparently may not be available (it comes from Cookbook:HttpVariables which may not be enabled). In such a case, the variable is removed before conditionals are evaluated and in the page (:if [ {$HTTPVariablesAvailable} and true and ! equal {$?q} "" ] :)
looks to PmWiki like (:if [ and true and ! equal {$?q} "" ] :)
. A PHP expression starting with "and" causes a Parse error.
While this is indeed caused by a rare combination of circumstances, it shouldn't cause PmWiki to crash. Moreover, such markup may cause the edit form to crash, and then the administrator needs to manually edit the disk file wiki.d/Group.Page which is not trivial.
So for the next version PmWiki should handle such cases more gracefully. In a complex conditional, "and", "or", "&&", "||" at the beginning, or immediately following another one, will have "0" inserted in-between, as in "false". For many cases, especially with page variables, page text variables, or markup expressions, this should be the intended behavior. If there are other cases which I can't think of at the moment, at least the conditionals shouldn't cause PmWiki to crash. --Petko