Skip to content

Fix deprecated string increment on non-numeric string in nextHandle() (PHP 8.3+)#358

Merged
mikehaertl merged 1 commit into
mikehaertl:masterfrom
jaroslavlibal:fix-string-increment-deprecation
Jun 24, 2026
Merged

Fix deprecated string increment on non-numeric string in nextHandle() (PHP 8.3+)#358
mikehaertl merged 1 commit into
mikehaertl:masterfrom
jaroslavlibal:fix-string-increment-deprecation

Conversation

@jaroslavlibal

@jaroslavlibal jaroslavlibal commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

On PHP 8.3+ the $char++ operation in nextHandle() triggers "Increment on non-numeric string is deprecated, use str_increment() instead". This breaks projects that escalate deprecations to exceptions when adding files without explicit handles (e.g. new Pdf([$a, $b])).

Use str_increment() on PHP 8.3+ and fall back to $char++ on older versions, which the library still supports (php >= 8.1). The handle sequence (A, B, ..., Z, AA, ...) is unchanged.

Fixes #357

@mikehaertl

Copy link
Copy Markdown
Owner

@jaroslavlibal We have a psalm error now. Maybe you can mark that code part to be ignored by psalm somehow?

… (PHP 8.3+)

On PHP 8.3+ the $char++ operation in nextHandle() triggers
"Increment on non-numeric string is deprecated, use str_increment()
instead". This breaks projects that escalate deprecations to exceptions
when adding files without explicit handles (e.g. new Pdf([$a, $b])).

Use str_increment() on PHP 8.3+ and fall back to $char++ on older
versions, which the library still supports (php >= 8.1). The handle
sequence (A, B, ..., Z, AA, ...) is unchanged.
@jaroslavlibal jaroslavlibal force-pushed the fix-string-increment-deprecation branch from b32b932 to 1f51671 Compare June 24, 2026 08:12
@mikehaertl mikehaertl merged commit 25dba2e into mikehaertl:master Jun 24, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nextHandle() triggers "Increment on non-numeric string is deprecated" on PHP 8.3+

2 participants