Multiple inherit|Selects in same content window don't display

Bug #692898 reported by Brad Phillips
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
scalejournal
Confirmed
Critical
rejon

Bug Description

Say you have a content window that looks like the following:

(#(inherit:66|select count(id) from apps_photo_archive where "((username))" = published_by)#)

(#(inherit:82|select * from apps_photo_archive where "((username))" = published_by)#)

Each inherit works independently, but problems arise if both inherits are placed in the same content window, in this format.

If you remove the select statements from both, the inherits display. If, you remove the first select statement, the 2nd select statement seems to apply to the first inherit. Both select statements left in the content window lead to empty results (no errors reported, but no content displayed).

rejon (rejon)
Changed in aikiframework:
status: New → Confirmed
importance: Undecided → Critical
assignee: nobody → Bassel Safadi (bassel)
Changed in scalejournal:
status: New → Confirmed
importance: Undecided → Critical
assignee: nobody → rejon (rejon)
Revision history for this message
Bassel Safadi (bassel) wrote :

Brad: I tested this on latest aiki and the bug seems either solved or invalid, could you please check on scale after updating to latest aiki please

Changed in aikiframework:
status: Confirmed → Invalid
Revision history for this message
rejon (rejon) wrote :

this is not fixed. bassel, updated aiki to latest on scale, still a problem. it must be a regex problem because if separate the widget queries between differe <li /> sections, they work. need you to look at directly.

don't just close this, we need a real look at it.

Changed in aikiframework:
status: Invalid → Confirmed
Revision history for this message
rg1024 (rg1024) wrote :

the code:
The problem is widget.php line 861.
$numMatches = preg_match_all( '/\(\#\(inherent\:(.*)\)\#\)/', $widget, $matches);

must be replaced by:
$numMatches = preg_match_all( '/\(\#\(inherent\:(.*)\)\#\)/Us', $widget, $matches);

the explanation.
the original regular expression catch two inherit as one only because the bigger match the expression too. You must change greedy of regular expression /U, ( and add multiline /s for more robust code).

example:
$widget='(#(inherit:66|select count(id) from apps_photo_archive
where "((username))" = published_by)#)(#(inherit:82|select * from apps_photo_archive where "((username))" =published_by)#)';

echo preg_match_all( '/\(\#\(inherit\:(.*)\)\#\)/sU', $widget,$matches); // return 2
echo preg_match_all( '/\(\#\(inherit\:(.*)\)\#\)/s', $widget,$matches); // return 1
echo preg_match_all( '/\(\#\(inherit\:(.*)\)\#\)/', $widget,$matches); //return 0 (the is a new line character..)

Revision history for this message
Bassel Safadi (bassel) wrote :

Right rg1024 totally agree, ungreedy matching is used all over aiki but missing here, I pushed your fix.. thanks

rejon please confirm if that fixed the problem on scale

Changed in aikiframework:
status: Confirmed → Fix Released
Revision history for this message
rejon (rejon) wrote : Re: [Bug 692898] Re: Multiple inherit|Selects in same content window don't display

good...lets make sure we test these more on live sites before just
closing them. I'm finding a lot of bugs aren't actually fixed, when
tested out in the field...

jon

On Wed, Dec 29, 2010 at 5:31 AM, Bassel Safadi <email address hidden> wrote:
> Right rg1024 totally agree, ungreedy matching is used all over aiki but
> missing here, I pushed your fix.. thanks
>
> rejon please confirm if that fixed the problem on scale
>
> ** Changed in: aikiframework
>       Status: Confirmed => Fix Released
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/692898
>
> Title:
>  Multiple inherit|Selects in same content window don't display
>

--
Jon Phillips
http://rejon.org/
http://fabricatorz.com/
chat/skype: kidproto | irc: rejon
+1.415.830.3884 (sf/global)
+86.187.1003.9974 (china)
+65.8330.5807 (singapore)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.