Repository navigation
Draw a split table's background image on its later pages without warnings (#742) - #753
Open
gravitypdf-bot wants to merge 2 commits into
Open
gravitypdf-bot wants to merge 2 commits into
gravitypdf-bot wants to merge 2 commits into
Conversation
…ings (#742) _tableWrite() read the gradient of each layer of a table's own background-image, drawn again on every later page of a table split across pages, without checking it was there. A layer read from a URL has no gradient key, so each later page raised an "Undefined array key" warning, which a strict error handler turns into a failed document. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts (#742) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #742
Found while working on #552
Stacked on #723
Problem
A table split across pages raises an
Undefined array key "gradient"warning on each later page when the table has abackground-imagefrom a URL. The image is still drawn on every page. The warnings are the only fault, but a strict error handler turns them into a failed document. #742 (fixed by #750) had the same fault in a repeated header or footer; this is the same read in the code that draws the table's own background again on its later pages.Undefined array key "gradient"Cause
_tableWrite()reads$bg['gradient']for every layer of the table'sbackground-imagewithout checking that the key exists. It does this when it draws the background again on a later page of a split table. A layer from a URL hasimage_idand nogradientkey. The same read ongravitypdfis atsrc/Mpdf.php:23460. #723 rewrites it into its loop over background layers, which is why this branch is stacked on #723.Fix
The read is now
!empty($bg['gradient']), the same guard #750 uses for the header and footer reads.Legacy mode
This is a fix for a warning, and it applies in both
cssModes. Nothing on the page changes in either mode.Tests
TableBackgroundTest::testASplitTableWithABackgroundImageDrawsItOnEveryPageWithoutWarningsruns in both CSS modes (it uses theDrawnStylesmodesprovider). It renders a table with a background image that splits across pages and usesassertDrawsSilently()to assert that nothing is raised. It also asserts that the image pattern is painted on every page. Both cases fail against thesrc/on Draw every layer of a multiple background (#609) #723 with the warning at line 23540, and they pass with the fix.Checks
composer test: OK (12764 tests, 31 skipped, none of them snapshots; the snapshot group alone passes 219/219)composer cs: cleangravitypdf, none newCHANGELOG-GRAVITYPDF.mdgets its own line next to #750's, and both PRs add the[#742]link definition at the end of the file. Whichever merges second will conflict there; keep one of the two definitions.🤖 Generated with Claude Code