Summary
In weathermap-cacti-plugin.php, the viewimage and viewthumb code paths call dir($orig_cwd) instead of chdir($orig_cwd) to restore the working directory.
$orig_cwd = getcwd();
chdir(__DIR__);
// ...
dir($orig_cwd); // BUG: dir() creates a Directory object, does NOT change directory
dir() is the OOP directory handle constructor. chdir() is what was meant. Working directory is never restored after serving an image, so any subsequent operation in the same request that uses relative paths silently operates from the wrong directory.
Fix
Replace dir($orig_cwd) with chdir($orig_cwd) in both viewimage and viewthumb branches.
Priority
Hard failure. Queue for Friday.
Summary
In
weathermap-cacti-plugin.php, the viewimage and viewthumb code paths calldir($orig_cwd)instead ofchdir($orig_cwd)to restore the working directory.dir()is the OOP directory handle constructor.chdir()is what was meant. Working directory is never restored after serving an image, so any subsequent operation in the same request that uses relative paths silently operates from the wrong directory.Fix
Replace
dir($orig_cwd)withchdir($orig_cwd)in both viewimage and viewthumb branches.Priority
Hard failure. Queue for Friday.