'; self::assertSame($input, lazyimg($input)); } finally { ini_set('pcre.backtrack_limit', $limit); } } public function test_lazyimg_overlong_tags_are_skipped(): void { // Tags with more than 1000 characters of attributes are expected to be skipped (eager loading) $overlong = str_repeat('a', 1001); self::assertSame('' . $overlong . '', lazyimg('' . $overlong . '')); self::assertSame('', lazyimg('')); // Under the limit, the work is still bounded and lazy loading is applied $atLimit = str_repeat('a', 980); // 6 + 980 + 13 = 999 characters of attributes $placeholder = Minz_Url::display('/themes/icons/grey.gif'); self::assertSame('' . $atLimit . '', lazyimg('' . $atLimit . '')); self::assertSame('', lazyimg('')); } /** @return array */ public static function provideLazyimg(): array { $placeholder = Minz_Url::display('/themes/icons/grey.gif'); return [ 'ordinary image' => ['', ''], 'multiple tags' => ['', ''], 'video poster' => ['', ''], 'video poster with other attributes' => ['', ''], 'video without poster untouched' => ['', ''], 'track element' => ['', ''], 'video and track elements' => ['', ''], 'track data-src is not rewritten' => ['', ''], 'poster inside attribute value untouched' => ['', ''], 'legacy video data-original untouched' => ['', ''], 'case insensitive' => ['', ''], 'already lazy' => ['', ''], 'deliberate eager opt-out kept' => ['', ''], 'legacy data-original untouched' => ['