php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63553 file* functions fail for Thumbs.db (stat failed)
Submitted: 2012-11-18 15:29 UTC Modified: 2012-11-18 16:59 UTC
From: v1nkscaper at gmail dot com Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: Irrelevant OS: ReadyNas DUO
Private report: No CVE-ID: None
 [2012-11-18 15:29 UTC] v1nkscaper at gmail dot com
Description:
------------
every function related to file information (atime,mtime,filesize,filetype...) 
fails when applied on "Thumbs.db" file.

those functions work fine with a "icon.png" owned by same owner/group in the 
same directory 

renaming "Thumbs.db" to "foo.txt" doesn't help.

if you google "stat failed thumbs.db" you'll see these bug appear on some sites.

A Thumbs.db is a cache file that contains thumbnails of files that lies in a 
directory.
Such a file is generated by Windows OS.
you can download one for exemple @ http://www.broux.fr/wp-
content/themes/kelta/wpv_theme/samples/

PHP 5.2.0-8+etch9~bpo31+1 (cgi-fcgi) (built: Feb 11 2008 15:40:46)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

running on 2.6.17.14ReadyNAS
(AFAIK this is the last version packaged fot this system)

Test script:
---------------
filesize("Thumbs.db"); // warning
filesize("icon.png"); // works fine

Expected result:
----------------
actual size of file

Actual result:
--------------
Warning: filesize() [function.filesize]: stat failed for Thumbs.db

when I run the stat command in the OS it works

nas-NETGEAR:/test# stat Thumbs.db
  File: "Thumbs.db"
  Size: 65024     	Blocks: 128        IO Block: 16384  Regular File
Device: fe00h/xxxxx	Inode: 79167686    Links: 1    
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (   98/   admin)
Access: 2012-11-17 00:59:15.000000000 -0800
Modify: 2012-11-17 00:59:16.000000000 -0800
Change: 2012-11-17 00:59:15.000000000 -0800



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-18 15:37 UTC] rasmus@php.net
Sorry, I don't see how this could possibly be a PHP problem. PHP just calls your 
operating system's stat function.
 [2012-11-18 15:37 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2012-11-18 16:59 UTC] v1nkscaper at gmail dot com
Sorry.

Was running filesize on "basename" instead of complete path.
(It gest unnoticed because I got the "icon.png" and Thumbs.db in (almost) every 
folder)

But warning message is unclear. It should be "no such file" instead of "stat 
failed"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC