Quote Originally Posted by neekfenwick View Post
Excuse me for sticking my oar in, I'm not even in my work environment so can't really investigate, but I note the timestamp of your logs is 6 seconds after 5am, which leads me to guess it's a cron job that's running the sitemapxml script at 5am, so your $_SERVER variables may be impacted by the environment the script was run in, differently to the usual browser invocation. I agree with @cartwhat, editing core files is unlikely to be a good idea, unless you've uncovered a genuine bug. From a cursory read of the documentation at https://www.php.net/manual/en/reserv...les.server.php I can't see why SCRIPT_NAME would be null. Can you give us any details of the exact command line that invoked PHP to run the cgi-bin/sitemapxml.php script? Is there something funky going on with the environment? (try `crontab -l | grep sitemap` to see if any cron commands invoke sitemapxml, your environment may vary)

Personally, I might experiment with logging variables to a file to figure out why your variables are null, though Zen Cart has never had a decent logging framework that I've seen. I built Monolog into mine, with file and Graylog handlers.

By the way, you suggested replacing `dirname($_SERVER['SCRIPT_NAME'])` with `dirname($_SERVER ?? ''['SCRIPT_NAME'])`, which would imply that `$_SERVER` may undefined, which is unlikely. I'd suggest `dirname($_SERVER['SCRIPT_NAME'] ?? '')` at the very least, as a more sensible use of the null coalescing operator ??, but still a bad idea as @cartwhat said, find the root cause of the error rather than modifying core files.
Thank you both for your responses. I am not a programmer, so I am just spit balling trying to come up with a solution.
The cron job that currently runs on the BlueHost server is the same one that has been running for at least five years now without issue.
I have edited out two of the names for security, but they are correct for the site location.

Code:
php -f /******/******/public_html/cgi-bin/sitemapxml.php rebuild=yes ping=yes
I recently upgraded to ZC 2.1 which required updating several plugins e.t.c.
It was about two weeks of frustration and a lot of help from lat9 and a few others, but it got done and I was getting no debug logs finally.
The only item left on the list was the sitemapxml plugin.
After loading the 2.1 compatible version I began getting the debug and warning logs I noted earlier.
My assumption was something is wrong with the core code as I have had that same plugin running for a long time without issue in previous versions of ZC.