Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

temp fix for if Odd bug


Go to End


3 Posts   1783 Views

Avatar
dashiel

Community Member, 13 Posts

13 May 2008 at 1:21pm

i noticed there was a 3-month old, low priority ticket for the if Odd failing. i came up with what is probably a dirty hack, but basically i changed:

line 647 in VariableData.php from

function Odd() {
	return !$this->iteratorPos % 2;
}

to

function Odd() {
	return !$this->Even();
}

it seems to work, and so far hasn't caused any weird spikes in performance. hope this helps those of you in need of a quick fix, until someone who knows PHP can fix it properly.

Avatar
Sam

Administrator, 690 Posts

13 May 2008 at 2:35pm

That fix looks good; can you post it to open.silverstripe.com so that we can integrate it with the core? :-)

Avatar
dashiel

Community Member, 13 Posts

13 May 2008 at 3:27pm

i just uploaded to open.silverstripe.com - i added the file to the original trouble ticket. not sure if that's the right way to do it.