karagenit/forks

Threshold Setting One Bug

Closed this issue · 2 comments

You can't save 1 as the threshold value...

Caused by eb90711 entitled "Use intval() on SESSION Vars"

Obviously the default value was being set. This could only happen when $threshold is NULL, so that means the intval() was somehow returning null.

Well, not quite. In PHP, NULL == 0 is true, so when someone tried to set 0 for the threshold it would default as it was thinking the value was actually NULL. I think we need to use NULL === 0.

The reason using intval() introduced this is that NULL == "0" is false! So, now that we are comparing it to an int and not a String we get this error.

The reason it wasn't appearing in the other variables: forks couldn't be zero, so it was a non-issue. recursion could be 0, but it's default value was also 0, so I wasn't noticing it get reset to the default value.