tplaner / When

PHP Date Recursion library
https://github.com/tplaner/When
MIT License
513 stars 96 forks source link

Reference to non-existent object variable ($thisClone->limit) #74

Closed PeterA closed 3 years ago

PeterA commented 5 years ago

I've been doing some testing on the getOccurrencesBetween() function and found a line that appears to reference an object variable that doesn't exist. Here is the code in question:

Line 525 of When.php (introduced in de0cd0da5ee017ed4cc2aa81068b6ef3999e7380):

            if (isset($thisClone->limit)) {
                $thisClone->limit = $thisClone->limit - 200;
            }

Under what condition would $thisClone->limit be set?

I am wondering if what was meant here was a reference to the $limit variable set while calling the getOccurrencesBetween() function. If so, $limit isn't an object variable and the check on $thisClone->limit will return false even if getOccurrencesBetween() is called with a limit.

Am I missing something?

tplaner commented 3 years ago

Sorry for any confusion @PeterA, this was legacy code which was not removed.