Open RWoof opened 4 years ago
I am also seeing this issue, but there are no spaces in my world name "8675309". Error occurs dozens of times a day. My suspicion is that, if the web request comes in while updates_world.php is being updated, it sees it as missing. I can't imagine it locking the file for more than mere milliseconds, though, so this may not be the correct assumption.
It does produce the '//' in the path, but most operating systems (Windows, Mac, Unix, and Linux included) allow the inclusion of multiple slashes between file name or directory components of a file path. They just ignore the extra slash characters.
[error] 976#976: *1060859 FastCGI sent in stderr: "PHP message: PHP Warning: file(/var/www/html//standalone/updates8675309.php): failed to open stream: No such file or directory in /var/www/html/standalone/update.php on line 51" while reading response header from upstream, client: 10.0.0.9, server: , request: "GET /standalone/update.php?world=8675309&ts=1620740155312 HTTP/1.0", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "10.0.0.13", referrer: "https://[REDACTED]/index.html"
Dynmap Jar: Dynmap-3.1-spigot.jar
Issue Description: Disclaimer: I have little to no PHP experience so I'm pretty lost here and my assumptions could be way off base. I noticed after installing dynmap standalone using Nginx that I would occasionally get a few PHP errors in my error log. I think part of the issue was 3 of my worlds having spaces in their names and I also think that the current code in update.php will add a double // to the $fname variable since the $webpath seems to always add a forward slash at the end when it's created and the code to set $fname adds another slash in front of /standalone.
Dynmap Version: Dynmap version: core=3.1-SNAPSHOT-415, plugin=3.1-SNAPSHOT-415
Server Version: This server is running Paper version git-Paper-204 (MC: 1.16.3) (Implementing API version 1.16.3-R0.1-SNAPSHOT)
Pastebin of Configuration.txt: https://pastebin.com/gdNW2Cwj
Server Host (if applicable): Self Hosted
Pastebin of crashlogs or other relevant logs: Example of error with double forward slashes in path caused by $webpath having one forward slash and the code to create $fname adding a second forward slash with /standalone/updates_ Notice in the error the double forward slash after dynmap/web and before standalone in the very long path. I think I've fixed this for myself by removing the forward slash in front of /standalone/updates on line 31 of updates.php
Example of second issue (with the path correct after my attempt to fix the first issue), I believe it is caused by a world name containing spaces (don't laugh at my world names, my daughter named them :D ), Linux seems to surround filenames automatically with single quotes if there are spaces in it when the file is created, I think when update.php runs the command to set $fname on lines 31 and 33, it will use the $world variable which probably does not contain single quotes, then when it runs $lines = file($fname); on line 51, it can't find the file, since $fname will not have the single quotes around the filename and the actual file does.
The actual filename stored in the standalone folder for the world mentioned in the error has single quotes around it (probably from Linux) and looks like: /home/amp/.ampdata/instances/Minecraft03/Minecraft/plugins/dynmap/web/standalone/'updates_hello new world im dino girl.php'
My attempts to correct this using if/else statements to add the ' characters in the $fname if $world contains spaces have caused dynmap to fail to update in my web browser. Here's what I tried:
I believe it might be failing because the if(!is_readable($fname)) code shortly after $fname is set that causes the script to return rather than continuing.
if(!is_readable($fname)) { header('HTTP/1.0 404 Not Found'); return; }
$useridlc = strtolower($userid); $uid = '[' . $useridlc . ']';
if(isset($worldaccess[$world])) { $ss = stristr($worldaccess[$world], $uid); if($ss === false) { echo "{ \"error\": \"access-denied\" }"; return; } }
$lines = file($fname);