Issue Bug Resolved

#110827AbstractPaginator: PHP 8.5 warning "not representable as an int" for a huge current page number

Sebastian Mendel 09/29/26, 06:04 updated 09/30/26, 06:25

Description

Problem

AbstractPaginator::updateInternalState() computes the offset before the page number is clamped. Line 123 of typo3/sysext/core/Classes/Pagination/AbstractPaginator.php (v14.3.7 and main) casts the following product to int and assigns it to $offset:

$this->itemsPerPage * ($this->currentPageNumber - 1)

For a large page number (e.g. taken from a request parameter) the multiplication overflows to float. Since PHP 8.5 the (int) cast of a non-representable float raises an E_WARNING. The clamp to the last page (line 142) runs only after that, so the final result is correct, but the warning is emitted. With the Debug preset (SYS/exceptionalErrors = 12290, includes E_WARNING) it becomes an exception.

Steps to reproduce

$paginator = new \TYPO3\CMS\Core\Pagination\ArrayPaginator(range(1, 25), PHP_INT_MAX, 10);

Seen in a third-party extension’s backend module that passes the page number from the request to a paginator.

Expected

No warning; the current page is clamped to the last page (3).

Actual

PHP 8.5.11:

E_WARNING: The float 9.223372036854776E+19 is not representable as an int, cast occurred (AbstractPaginator.php:123)

Afterwards current page = 3, items 21-25. PHP 8.4.26 gives the same result without a warning. currentPageNumber = intdiv(PHP_INT_MAX, 10) + 2 triggers it as well.

Versions

TYPO3 14.3.7 (same code on main), PHP 8.5.11.

Cause

The offset is computed from the unclamped page number; computing it after the clamp (or clamping the page number first) avoids the overflow.

Related: #93351 (introduced the clamp to the last page).

Reviews 3

History 14

  1. Georg Ringer commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-09-30T06:25:10+00:00" > 09/30/26, 06:25 </span>

    Applied in changeset commit:bf4ad7c34781d7c772dd981f8fdf9686d27a0867.