|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51266 stat failed on cifs-mounted files
Submitted: 2010-03-10 21:06 UTC Modified: 2013-02-18 00:34 UTC
Avg. Score:4.3 ± 1.2
Reproduced:12 of 12 (100.0%)
Same Version:5 (41.7%)
Same OS:7 (58.3%)
From: dctucker at hotmail dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.3.2 OS: Arch Linux (current)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-03-10 21:06 UTC] dctucker at hotmail dot com
This bug affects filemtime, filesize, and other stat-related functions. When attempting to get file information from a file hosted on a mounted CIFS share (e.g. /mnt/share/Dir/file.wav), it fails. This is specifically a PHP problem because I am able to work around this problem by executing the stat command from a shell or using `back-tick operator`.

Test script:

$fm = filemtime('/mnt/share/Dir/file.wav');
echo $fm;


Expected result:

Actual result:
Warning: filemtime(): stat failed for /mnt/share/Dir/file.wav in - on line 3


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-10 21:09 UTC] dctucker at hotmail dot com
Works fine under shell with the same user as PHP runs in Apache:

$ sudo -u nobody stat /mnt/share/Dir/file.wav
  File: `/mnt/share/Dir/file.wav'
  Size: 159432852       Blocks: 311400     IO Block: 16384  regular file
Device: fh/15d  Inode: 281474976737089  Links: 1
Access: (0664/-rw-rw-r--)  Uid: (   99/  nobody)   Gid: (    0/    root)
Access: 2010-03-08 09:01:09.987840000 -0500
Modify: 2010-03-06 00:00:00.000000000 -0500
Change: 2010-03-05 07:31:34.933320700 -0500
 [2010-03-10 21:13 UTC] dctucker at hotmail dot com
I would also like to add that this bug did not exist in versions prior to php-5.2.5
 [2010-03-23 19:20 UTC] mail at daniel-berlin dot de
For me, it doesn't even work with PHP 5.3.2
 [2010-03-23 19:23 UTC] mail at daniel-berlin dot de
Sorry, I meant 5.2.4 ...
 [2010-03-24 20:05 UTC] mail at daniel-berlin dot de
Adding cifs option "noserverino" solves the problem.
 [2010-05-20 12:19 UTC]
-Status: Open +Status: Bogus
 [2010-05-20 12:19 UTC]
Works fine here too, so I assume it's not a PHP bug.
 [2010-05-20 21:54 UTC] dctucker at hotmail dot com

Using the 'noserverino' workaround does mitigate the problem, but it does not address the underlying issue.
 [2010-05-21 11:23 UTC]
-Status: Bogus +Status: Feedback
 [2010-05-21 11:23 UTC]
How does the mount command look like, so that it fails?
 [2010-06-03 20:37 UTC] dctucker at hotmail dot com
The mount command lacks noserverino:

$ tail -n 1 /etc/fstab
//theword/d  /mnt/theword  cifs    nocase,file_mode=0664,dir_mode=0775,username=Administrator%,uid=nobody 0 0
 [2010-06-04 08:32 UTC]
Cannot reproduce, still works fine here.

When you edit your report, please re-open it, too.
 [2010-07-30 15:20 UTC] beststom14 at hotmail dot com
Same issue. Windows Seven 32 bit. When programming a file manager i found that some dirs were being listed as files. For some reason when i create a new dir it gets listed correctly but when i COPY it from somewhere it is listed as a file.
 [2011-11-30 20:39 UTC] brandonkirsch at gmail dot com
We recently upgraded our underlying Linux OS and ran into this same issue.  For 
other Googlers who come across this bug report:  Use the "noserverino" mount 
option as specified by others.

If you want to know more about this issue, see:

The important thing to know is that CIFS servers will frequently return inode 
integer values that are greater than 31^2. If you read the PHP documentation for 
these filesystem functions, you will find a disclaimer that these large unsigned 
integer values will break in PHP.

Disable the possibility of really big inode numbers from your CIFS mounts by 
using the "noserverino" mount option.
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 28 05:03:38 2021 UTC