Page MenuHomePhabricator

Form fails on SMW 1.8 #ask
Closed, DeclinedPublic

Description

A project form uses {{#ask: [[Category:Project]] |?Project number | format=max }} to determine the current highest project number.

The form fails - a white screen appears after a long while instead of the form to appear - when the project is edited with form.

The 'ask' showed above seems to be the cause of the problem, since the form shows promptly when it is removed from the form definition. Also the problem doesn't occur with SMW 1.7.1 in combination with SF 2.5.1.

The problem occurs with SMW 1.8 beta 2. Other versions are: MW 1.19.2, SF 2.5.1, SRF 1.8 rc2.


Version: unspecified
Severity: normal

Details

Reference
bz42347

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:51 AM
bzimport set Reference to bz42347.

Please try the following query instead:

{{#ask: [[Category:Project]]

?Project number=
mainlabel=-
sort=Project number
order=DESC
limit=1

}}

and compare its result with the result of your original query (if you can get it at all). Please let us know if this works.

Ok I did what you suggested and did some additional research. The interesting results I think are:

{{{field|Project number|default= {{#expr: {{#ask: [[Category:Project]]

  | ?Project number
  | format=max
}} + 1}}

}}}

shows '{{#expr: {{#ask:' in the project number field when creating a new project (NOK) and
works well when editing a project with the form (OK).

The original statement: {{{field|Project number|default= {{#expr: {{#ask: [[Category:Project]] | ?Project number | format=max }} + 1}} }}}
which is exactly the same, only the whole 'field' statement on one line,

shows the correct (next) project number when creating a new project (OK) and
causes the form to fail (white screen after long while) when editing the project (NOK)

If the query that I suggested works for you, it is highly recommended to use this query instead of format=max everywhere. Similarly for format min (but change the order to ASC there). If you want to do math with the result, you should also specify that you do not want any formatting by adding a #-:

{{#ask: [[Category:Project]]

?Project number#-=
mainlabel=-
sort=Project number
order=DESC
limit=1

}}

The max format should be avoided whenever possible. It is very resource intensive (possibly retrieving thousands of results to find one number) and may still lead to wrong results (if there are too many matches).

The other problem you mention here seem to be related to {{{field}}} but not to SMW. I don't see why there should be a connection to SMW 1.8, but maybe there were some small output changes in #ask that your code is somehow sensitive to. I am reassigning this bug to SF now.

The query you suggested shows the same results - with the addition of 'search label=' or the result includes ...further results, which is hard to use in calculations.

This means the creation of a new project works fine and editing fails.

My hosting provider migrated to php 5.3.19 and the problems don't appear anymore.
It seems that the problem is related to (very) old php versions and new versions of the extensions.
Since php 5.2 is not supported anymore in the next version of SMW 'unconfirmed' seems appropriate to me.

Marking as Invalid for now; only one person had the problem and it worked for him

Sounds more like WORKSFORME then... :)

You guys can do things with the status that wouldn't even have dreamed of ;-)