Oliver Block wrote: > Hi Arnold, > > Am Samstag, 26. Mai 2007 00:28 schrieben Sie: >> If I need to run gdb please let me know, > > I did a gdb and on my system (debian, CLI). filetype returns 'dir' as well. > > my code was php -r 'filetype("/tmp/link-test");' > > Where /tmp/link-test is a link to a directory /tmp/pear. > > This is some of the output: > > I set a breakpoint to php_stat. You can see the parameters passed to it. > > Breakpoint 1, php_stat (filename=0xb78f4584 "/tmp/link-test", > filename_length=14, type=8, return_value=0xb78f5044, tsrm_ls=0x87b8018) > at /usr/local/src/php-5.2.2/ext/standard/filestat.c:730 > > Some of the steps beginning at line 851 (standard/filestat.c, php_stat()) > > 851 switch (type) { > (gdb) > 881 if (S_ISLNK(ssb.sb.st_mode)) { > (gdb) > 884 switch(ssb.sb.st_mode & S_IFMT) { > (gdb) > 887 case S_IFDIR: RETURN_STRING("dir", 1); > (gdb) > 981 }
Right, so the (ssb.sb.st_mode & S_IFMT) is S_IFDIR which is basically the OS telling us that it is a directory. I don't see what we can do if the OS is not telling us the right thing. The filestat code is a bit convoluted trying to deal with lots of strange operating systems, but this part of it seems pretty clear. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php