-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Description
The PlantumlRenderer::render() method calls tempnam() with a subdirectory that may not exist, which triggers a PHP E_NOTICE:
$pumlFileLocation = tempnam(sys_get_temp_dir() . '/phpdocumentor', 'pu_');When /tmp/phpdocumentor (or equivalent) doesn't exist, PHP emits:
Notice: tempnam(): file created in the system's temporary directory in .../PlantumlRenderer.php on line 48
This notice can appear in rendered documentation output when error reporting includes E_NOTICE.
Steps to Reproduce
- Configure guides to use the local PlantUML binary renderer (
renderer="plantuml") - Ensure the
/tmp/phpdocumentordirectory does not exist - Render documentation containing a
.. uml::directive - The notice appears in the output
Expected Behavior
No PHP notices should be emitted during normal operation.
Suggested Fix
Create the directory before calling tempnam():
$tempDir = sys_get_temp_dir() . '/phpdocumentor';
if (!is_dir($tempDir)) {
mkdir($tempDir, 0777, true);
}
$pumlFileLocation = tempnam($tempDir, 'pu_');Alternatively, simply use sys_get_temp_dir() directly without the subdirectory, since tempnam() already creates unique filenames.
Environment
- PHP: 8.1+
- phpdocumentor/guides-graphs: 1.7.3
Related
Metadata
Metadata
Assignees
Labels
No labels