Bug in {cycle} ?

2 views
Skip to first unread message

Ibmurai

unread,
May 28, 2009, 12:27:38 PM5/28/09
to php-outline
I believe there's a bug in {cycle}, and that I've fixed it.

The problem is that nothing gets output from the {cycle} block the
first time it's met / passed / invoked (what's the word? :) )

Here's my udiff (sort of) of class/system.php:

public function cycle_block($args) {
$num = ++$this->cycle_num;
$this->cycle_stack[] = $num;
$this->cycles[$num] = 1;
$var = '$outline_cycle_' . $num;
- $this->compiler->code("!isset($var) ? $var = 0 : $var+
+; if ($var == 1) {");
+ $this->compiler->code("!isset($var) ? $var = 1 : $var+
+; if ($var == 1) {");
}

Ibmurai

unread,
May 28, 2009, 12:30:40 PM5/28/09
to php-outline
Thanks, google groups, for breaking my code :D
Here it is again, hopefully more readable:

public function cycle_block($args) {
$num = ++$this->cycle_num;
$this->cycle_stack[] = $num;
$this->cycles[$num] = 1;
$var = '$outline_cycle_' . $num;
- $this->compiler->code("!isset($var) ? $var = 0 : $var++; if ($var ==
1) {");
+ $this->compiler->code("!isset($var) ? $var = 1 : $var++; if ($var ==
1) {");
}

*fingers crossed*

Rasmus Schultz

unread,
May 28, 2009, 9:33:28 PM5/28/09
to php-outline
fixed in SVN.

mindplay.dk

unread,
May 28, 2009, 9:35:08 PM5/28/09
to php-outline
by the way, for bug reports, there is also an issue tracker:

http://code.google.com/p/php-outline/issues/list


On May 28, 9:33 pm, Rasmus Schultz <ras...@mindplay.dk> wrote:
> fixed in SVN.
>
Reply all
Reply to author
Forward
0 new messages