Skip to content

Fix "Undefined array key" warning in MultiCell with an empty string - #2197

Open
eyupcanakman wants to merge 1 commit into
mpdf:developmentfrom
eyupcanakman:fix/slice-otl-undefined-array-key-2158
Open

Fix "Undefined array key" warning in MultiCell with an empty string#2197
eyupcanakman wants to merge 1 commit into
mpdf:developmentfrom
eyupcanakman:fix/slice-otl-undefined-array-key-2158

Conversation

@eyupcanakman

Copy link
Copy Markdown
Contributor

MultiCell() with an empty string warns on PHP 8. Otl::sliceOTLdata() reads the group and GPOSinfo keys before they are set when there is no OpenType layout data, which raises "Undefined array key". The fix sets both keys to their empty defaults at the top of the function, the same way char_data is already guarded just below.

The other error in #2158 (long text with align: 'J') is a different path in GetJspacing(), tracked in #2184. Out of scope here.

sliceOTLdata() read the group and GPOSinfo keys before they were set when MultiCell runs with no OpenType layout data, so PHP 8 raised "Undefined array key". Set both keys to their empty defaults at the start of the function, the same way char_data is already guarded below.

Refs mpdf#2158
jakejackson1 added a commit to GravityPDF/mpdf that referenced this pull request Sep 7, 2026
Tolerate empty OTL data when slicing a line of text (mirrors mpdf#2197)
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.

1 participant