[BUGFIX] Fix tempnam() E_NOTICE when using PlantUML binary renderer#1124
Closed
CybotTM wants to merge 4 commits intoTYPO3-Documentation:mainfrom
Closed
[BUGFIX] Fix tempnam() E_NOTICE when using PlantUML binary renderer#1124CybotTM wants to merge 4 commits intoTYPO3-Documentation:mainfrom
CybotTM wants to merge 4 commits intoTYPO3-Documentation:mainfrom
Conversation
When using the local PlantUML binary renderer (renderer="plantuml"), the upstream PlantumlRenderer calls tempnam() with a subdirectory that may not exist, triggering a PHP E_NOTICE that appears in the rendered documentation output. This adds a DecoratingPlantumlBinaryRenderer that ensures the temp directory exists before delegating to the inner renderer, fixing the issue without requiring upstream changes or global E_NOTICE suppression. Resolves: TYPO3-Documentation#1099
Add unit tests to verify the decorator: - Creates temp directory when missing before rendering - Properly delegates to the inner renderer Also changes constructor to accept DiagramRenderer interface instead of concrete PlantumlRenderer to enable mocking in tests. Relates: TYPO3-Documentation#1099
Change DecoratingPlantumlBinaryRenderer constructor to accept DiagramRenderer interface instead of concrete PlantumlRenderer. This improves testability and follows dependency inversion principle. The decorator only needs the interface contract, not the concrete implementation. Relates: TYPO3-Documentation#1099
Add a test that expects tempnam() to trigger E_NOTICE when the directory doesn't exist. When this test FAILS, it indicates that PHP's behavior has changed or upstream has fixed the issue, and the DecoratingPlantumlBinaryRenderer workaround may no longer be needed. This helps track when we can safely remove this workaround. Relates: TYPO3-Documentation#1099
38bba55 to
1d44823
Compare
Contributor
|
We should fix this in upstream |
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.
Summary
Fixes E_NOTICE triggered by
tempnam()when rendering PlantUML diagrams.The upstream
PlantumlRenderercallstempnam(sys_get_temp_dir() . '/phpdocumentor', 'pu_')but the/phpdocumentorsubdirectory may not exist, triggering:This PR adds a decorator that ensures the temp directory exists before delegating to the inner renderer.
Resolves: #1099
Changes
DecoratingPlantumlBinaryRendererthat creates temp directory before renderingPlantumlRendererUpstream
Test plan
make test-unit ENV=localpasses (83 tests)make code-style ENV=localpassesmake phpstan ENV=localpasses