67bae2d40e0a9d903779ce13bddf4b324208f2ff
Period::length() derived its count from diff()->days (day precision) and abs() (hour/minute/second precision), both of which discard sign information. For a period whose boundary exclusions push includedStart() past includedEnd() (e.g. a single-day period with Boundaries::EXCLUDE_ALL), the period is empty and iterating it yields zero dates, yet length() still reported a positive number, disagreeing with iterator_count(). Add an explicit emptiness check so length() returns 0 whenever includedStart() is after includedEnd(), matching the iterator's behaviour across all precisions.
Languages
PHP
100%