Skip to content

Conversation

@CybotTM
Copy link

@CybotTM CybotTM commented Dec 9, 2025

Summary

Fixes #1

The tempnam() call in PlantumlRenderer::render() uses a subdirectory of sys_get_temp_dir() that may not exist, which triggers a PHP E_NOTICE:

Notice: tempnam(): file created in the system's temporary directory

This notice can appear in rendered documentation output when error reporting includes E_NOTICE.

Changes

  • Create the /phpdocumentor subdirectory if it doesn't exist before calling tempnam()

Test plan

  • Configure guides to use local PlantUML binary (renderer="plantuml")
  • Ensure /tmp/phpdocumentor does not exist
  • Render documentation with a .. uml:: directive
  • Verify no E_NOTICE is emitted

@CybotTM CybotTM force-pushed the bugfix/plantuml-tempnam-notice branch from cb0cbc1 to 5c1abfd Compare December 9, 2025 06:53
The tempnam() call uses a subdirectory of sys_get_temp_dir() that may
not exist, which triggers a PHP E_NOTICE when the directory is missing.
PHP then falls back to the system temp directory, but the notice can
appear in rendered output.

This creates the directory if it doesn't exist before calling tempnam(),
preventing the notice.

Fixes: phpDocumentor#1
Adds a unit test to verify that the temp directory is created
before calling tempnam(), preventing the E_NOTICE regression.
Extracts the temp subdirectory path to a public constant so tests
can reference it directly, ensuring they stay in sync with the
implementation.
@jaapio
Copy link
Member

jaapio commented Dec 9, 2025

Thanks for your contribution, unfortunately I cannot merge this into this repository. As described in our contribution file pr's should be done on phpDocumentor/guides repository.

This repository is a read-only split from this main repo.

@jaapio jaapio closed this Dec 9, 2025
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.

[BUG] PlantumlRenderer triggers E_NOTICE when temp subdirectory doesn't exist

2 participants