PHP Warning: filesize(): stat failed for (filename)
The information contained in this post
https://www.zen-cart.com/showthread....79#post1306779
is correct, of course, but I get the same error but ONLY when calling from the cgi-bin file.
Xampp, local, php 5.6: no error
Xampp, local, php 7.04: error
I modified the function to get more info:
PHP Code:
function _fileSize($fn,$line_number='') {
// clearstatcache(true, $fn);
clearstatcache();
echo __LINE__ . ' called from line '. $line_number . ', $fn='.$fn."\n<br />"."\n<br />";
//var_dump(debug_backtrace());
$fs = filesize($fn);
return $fs;
}
and added an extra parameter __LINE__ in the various calls in the class to find out where it was called from.
screen output is "interesting" in that there are two calls to this function and it appears the first one is what generates the error due to having no path info:
SiteMapXML (3.6 26.04.2016 10:33:09) Sitemap Manufacturers 811
called from line 517, $fn=sitemapmanufacturers.xml 811 called from line 718, $fn=D:/Documents/Business/blah..blah/..tienda_155/sitemap/sitemapmanufacturers.xml ......more stuff
working backwards I think there is an error here as the path is missing
PHP Code:
if ( SITEMAPXML_USE_EXISTING_FILES == 'true'
&& file_exists($this->savepath . $filename)
&& (filemtime($this->savepath . $filename) >= strtotime($last_date))
&& $this->_checkFContentSitemap($filename)) {
echo '"' . $filename . '" ' . TEXT_FILE_NOT_CHANGED . '<br />';
return false;
this does not generate the error:
PHP Code:
if ( SITEMAPXML_USE_EXISTING_FILES == 'true'
&& file_exists($this->savepath . $filename)
&& (filemtime($this->savepath . $filename) >= strtotime($last_date))
&& $this->_checkFContentSitemap($this->savepath . $filename)) {//steve added path
echo '"' . $filename . '" ' . TEXT_FILE_NOT_CHANGED . '<br />';
return false;
Bookmarks