Skip to content

Conversation

@SvenLie
Copy link

@SvenLie SvenLie commented Nov 8, 2025

When using the PlantUML-Renderer a notice is triggered by tempnam(). This is displayed within the rendered documentation.

When using the PlantUML-Renderer a notice is triggered by tempnam(). This is displayed within the rendered documentation.
@garvinhicking
Copy link
Contributor

I think we should address the notice and not suppress it generally. Can you mention the notice here so that we can try how to prevent a notice somehow?

@SvenLie
Copy link
Author

SvenLie commented Nov 8, 2025

with following guides.xml config:

  <extension
            class="\phpDocumentor\Guides\Graphs\DependencyInjection\GraphsExtension"
            renderer="plantuml"
            plantuml-binary="/usr/bin/plantuml"
    />

Above the plantuml then this is rendered:

Notice: tempnam(): file created in the system's temporary directory in /opt/guides/vendor/phpdocumentor/guides-graphs/src/Graphs/Renderer/PlantumlRenderer.php on line 48

@garvinhicking
Copy link
Contributor

So I actually think we should suppress that notice in the graphRenderer.php of phpdocumentor, wdyt?

I think generally we do want to see PHP notices to spot errors...?!

Maybe also we're missing a php.ini setting for sys_temp_dir in our container and then the notice would not even occur....

@garvinhicking
Copy link
Contributor

Would you like to try to adapt your patch and actually set this sys_temp_dir to /tmp/ and see if that changes things?

@SvenLie
Copy link
Author

SvenLie commented Nov 27, 2025

Unfortunately same notice with that added to php.ini:

sys_temp_dir = /tmp

CybotTM added a commit to CybotTM/render-guides that referenced this pull request Dec 9, 2025
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
CybotTM added a commit to CybotTM/render-guides that referenced this pull request Dec 9, 2025
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
CybotTM added a commit to CybotTM/render-guides that referenced this pull request Dec 9, 2025
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
CybotTM added a commit to CybotTM/render-guides that referenced this pull request Dec 9, 2025
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
@CybotTM
Copy link
Contributor

CybotTM commented Dec 9, 2025

problem is the missing phpdocumentor folder in temp_dir

CybotTM added a commit to CybotTM/render-guides that referenced this pull request Dec 9, 2025
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
CybotTM added a commit to CybotTM/render-guides that referenced this pull request Dec 9, 2025
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
CybotTM added a commit to CybotTM/render-guides that referenced this pull request Dec 9, 2025
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
CybotTM added a commit to CybotTM/render-guides that referenced this pull request Dec 9, 2025
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
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.

3 participants