Forum Moderators: coopster

Message Too Old, No Replies

function.filemtime?

         

jake66

12:40 am on Mar 11, 2010 (gmt 0)

10+ Year Member



I ran Xenu link sleuth on my website today, and one of the 404 errors reported were:

http://www.example.com/function.filemtime


When I went to the affected page, function.filemtime was nowhere in the source, or linked anywhere.

I have seen this error once before, but I do not recall what caused it. It only showed up on 2 files; files of which are place-holders for nearly 5,000 other pages. If this were an actual 'problem', it would show for the other 5k, wouldn't it?


Any insights on to how I can figure out what triggered this?

Readie

8:15 am on Mar 11, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When you have an error, you will often find that an error message get's stuck at the top of the page. If it's a function error it will, for some reason, have the function that triggered the error as a link to example.com/function.name

Anyango

9:50 am on Mar 11, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Failed Code Injection attempt?

lammert

1:30 pm on Mar 11, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The function.filemtime error is a runtime error of PHP. You won't see it in your source, but it is only generated when PHP parses your scripts. It is probably caused by a call to the PHP filemtime() function somewhere in your scripts which returns the modification time of a file. If that file doesn't exist or cannot be accessed due to permission settings, PHP will generate a runtime error to the browser window. This runtime error seems to be picked up by the Xenu link checker.

jake66

2:32 am on Mar 12, 2010 (gmt 0)

10+ Year Member



I ran the Xenu scan a few times afterward and haven't gotten it in any of the later scans.


However, upon inspecting error_log -- I get a bunch of these:
[11-Mar-2010 20:22:55] PHP Warning: filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/**/public_html/cache/index.php_path=22__.cache in /home/**/public_html/includes/cache.php on line 330


On line 330:
 if ( ( filemtime($filename) + $this->cache_lifetime) < time() )


As this is part of my cache function, I assume removing it would cause issues with my caching.

I suspect this error is being generated when a visitor clicks a page whose cache file was recently removed, but the content simply reloads beneath.. so this error is obsolete by the time someone clicks it. Can I suppress it without killing the rest of my php errors? (I use them for troubleshooting other scripts, but this error just baffles me.)

lammert

2:58 am on Mar 12, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can switch off all warning messages during the processing:

$old_mask = error_reporting( 0 );

if ( ( filemtime($filename) ... ) {
}

error_reporting( $old_mask );

jake66

3:52 am on Mar 12, 2010 (gmt 0)

10+ Year Member



Added that into the file. Not sure how to test it, since I can't reproduce the error, but I wiped error_log.

My last error showed at:
[11-Mar-2010 22:00:53]

Hopefully this works. Thanks for the tip so far. :)

jake66

8:54 am on Mar 14, 2010 (gmt 0)

10+ Year Member



New update:
Cache is working fine and no function.filemtime errors in error_log OR with Xenu.

Thanks a ton, lammert!

lammert

1:58 pm on Mar 14, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just note that this solution doesn't solve the problem of your non-existent files, it only masks the errors which are generated. Switching off error reporting for a whole PHP script is therefore in general not a good idea. But I am glad that it helped you out in this specific situation. :)

jake66

7:37 am on Mar 15, 2010 (gmt 0)

10+ Year Member



It's a garbage collection system to remove old cache files. the missing files aren't a 'problem' per-say, but I really don't know why the script is looking for them, to be honest (which is -the- problem, if any).
They seem to show up 1 time for 1 page and never any more than that.

I didn't write the script, I'm just trying to interpret it. :)