[pmwiki-users] intermittent suspected ParseArgs error when processing SelectQuery

Dominique Faure dominique.faure at gmail.com
Wed Oct 25 10:46:01 CDT 2006


On 10/25/06, Ben Stallings <Ben at interdependentweb.com> wrote:
> Hi, folks.  I've been contacted by a member of the Tararua Tramping Club
> in Australia regarding a problem s/he's having with a SelectQuery.  It's
> generating an error in line 348 of pmwiki.php, and I haven't had a
> chance to see their copy of pmwiki.php yet, so I'm not 100% sure what
> line that is, but my best guess is that it falls inside the ParseArgs
> function, which is called by selectquery.php.
>
> The funny thing about the error is that if you edit the page, make any
> change whatsoever and save it, the error goes away in your browser.  Not
> in other browsers, just the one where you made the change.  It's as if
> something is getting cached in the browser during the editing process.
>
> The problematic tag is,
> (:selectquery columns="Date_Format(`Activity_Start_Date`,'%e %M') as
> 'Date',`Activity_Description` as 'Description'" tables=activity
> where="Activity_Start_Date>=Curdate()" order="Activity_Start_Date":)
>
> This is already pared back compared to what he had when he contacted me,
> but I pared it back as far as
> (:selectquery columns=Activity_Start_Date,Activity_Description
> tables=activity where=1 order=Activity_Start_Date:)
>
> and the error still occurred, so the problem is not with quotes or other
> punctuation... yet it only occurs on pages with SelectQuery.  The error
> it generates is,
>
> Warning: Invalid argument supplied for foreach() in
> /opt/lampp/htdocs/ttc/pmwiki/pmwiki.php on line 348
>
> My guess is that what's on line 348 of their pmwiki.php is this meaty
> bit of ParseArgs():
>
>    preg_match_all('/([-+]|(?>(\\w+)[:=]))?("[^"]*"|\'[^\']*\'|\\S+)/',
>      $x, $terms, PREG_SET_ORDER);
>    foreach($terms as $t) {
>
> Any ideas?  Thanks in advance. --Ben
>

Having a try at the related Cookpage [1]:

columns=Activity_Start_Date,Activity_Description tables=activity
where=1 order=Activity_Start_Date

provides:

Key                 Value(s)
---------           --------
$arg['#']           (array) 'columns'
'Activity_Start_Date,Activity_Description' 'tables' 'activity' 'where'
'1' 'order' 'Activity_Start_Date'
$arg['columns']     'Activity_Start_Date,Activity_Description'
$arg['tables']      'activity'
$arg['where']       '1'
$arg['order']       'Activity_Start_Date'

and:

columns="Date_Format(`Activity_Start_Date`,'%e %M') as
'Date',`Activity_Description` as 'Description'" tables=activity
where="Activity_Start_Date>=Curdate()" order="Activity_Start_Date"

provides:

Key                 Value(s)
---------           --------
$arg['#']           (array) 'columns'
"Date_Format(`Activity_Start_Date`,'%e %M') as
'Date',`Activity_Description` as 'Description'" 'tables' 'activity'
'where' 'Activity_Start_Date>=Curdate()' 'order' 'Activity_Start_Date'
$arg['columns']     "Date_Format(`Activity_Start_Date`,'%e %M') as
'Date',`Activity_Description` as 'Description'"
$arg['tables']      'activity'
$arg['where']       'Activity_Start_Date>=Curdate()'
$arg['order']       'Activity_Start_Date'

both without any errors reported...

Dom

[1] http://www.pmwiki.org/wiki/Cookbook/ParseArgs#demo




More information about the pmwiki-users mailing list