Edit report at http://bugs.php.net/bug.php?id=51404&edit=1

 ID:               51404
 Comment by:       digitalaudiorock at gmail dot com
 Reported by:      neversaynever at tut dot by
 Summary:          is_dir() returns false on cifs mounted share
 Status:           Bogus
 Type:             Bug
 Package:          Directory function related
 Operating System: Linux
 PHP Version:      Irrelevant

 New Comment:

I just found a blog post (which I had to dredge out of the google cache)
where someone figured this out.  The CIFS mount is now apparently using
the serverino option by default.  In the case of Windows shares this
appears to be resulting in huge inode numbers which are causing is_dir()
to report false.  Using the noserverino option prevents this.  Scary
stuff.


Previous Comments:
------------------------------------------------------------------------
[2010-06-09 20:06:02] digitalaudiorock at gmail dot com

I have to agree with the original poster.  Running php 5.2.13 Under
Gentoo I have problems with is_dir() on CIFS shares with 2.6.31 and
2.6.32.  On a machine I have running 2.6.30 I don't see the issue. 
Here's a CIFS mounted directory that reports is_dir() as false even
though chdir() reports true:



php -r 'var_dump(is_dir("/home/tom/mount/sql"));'

bool(false)



php -r 'var_dump(chdir("/home/tom/mount/sql"));'

bool(true)



Here's the equivalent in perl that reports true:



perl -e '(-d "/home/tom/mount/sql") && print "OK\n"'

OK



ls -ald /home/tom/mount/sql

drwxr-xr-x 1 tom tom 0 Apr 28  2008 /home/tom/mount/sql



That's a windows share mounted as administrator of the windows machine.
While this may be caused somehow by CIFS changes in the kernel, there
truely is something ugly going on here and it's caused me some serious
problems.



Tom

------------------------------------------------------------------------
[2010-06-08 14:33:22] tony2...@php.net

I'm sure PHP doesn't affect any of system functions, including stat().

You get what your stat() returns -> not PHP problem.

------------------------------------------------------------------------
[2010-03-26 20:34:07] neversaynever at tut dot by

Description:
------------
I upgraded my kernel to 2.6.31 (stable) and has php-5.2.12 (stable),
but

php function is_dir() returns false for folder on my cifs mounted
share.



strace php -r 'var_dump(is_dir("/path_to_mounted_folder/"));'



...

stat64("/path_to_mounted_folder/", {st_mode=S_IFDIR|0755, st_size=32768,
...}) = 0 

gettimeofday({1269602972, 30466}, NULL) = 0

write(1, "bool(false)\n", 12bool(false)

)           = 12

...  

Test script:
---------------
php -r 'var_dump(is_dir("/path_to_mounted_folder/"));'

Expected result:
----------------
bool(true)

Actual result:
--------------
bool(false)


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51404&edit=1

Reply via email to