On Wed, Apr 25, 2001 at 07:22:03AM +0200, Andi Gutmans wrote:
> Hi,
> 
> I just commited a patch which also cleaned up some other stuff (although it 
> could still use some fixing up).
> Please check the latest CVS to see if it works now.
> Also can you please check the lstat() command? I think it has the same 
> problem (I didn't fix it because I want to be sure) and I think filetype() 
> might also not work correctly on links which aren't pointing to anything 
> (at least not give all the right information).
> 
> Andi
> 

Hey.. I pulled just the filestat.c out of CVS into php-4.0.4pl1..
hopefully that isn't the issue (I recieved no warnings during the compile,
and nothing really seemed to have changed much in the ext/standard/
directory).

--code:
function link_func_test ($file)
{
     if ( is_link ($file)) { print ("is_link passed\n"); }
     else { print ("is_link failed\n"); }

     if (($temp_filetype = filetype ($file))) { print ("filetype passed:
$temp_filetype\n"); }
     else { print ("filetype failed\n"); }

     if (($temp_lstat = lstat ($file))) { print ("lstat passed:\n\n");
print_r ($temp_lstat); }
     else { print ("lstat failed\n"); }
}

$file = '/tmp/test-link-func';
// This was if (file_exists ($file)), but it's borked too! ;)
@ unlink ($file);

if (symlink ('/bin/false', $file)) { link_func_test ($file); }
else { print ("Good symlink failed\n"); }

@ unlink ($file);

if (symlink ('/this/file/does/not/exist', $file)) { link_func_test ($file); }
else { print ("Bad symlink failed\n"); }
--End


--output:
:(00:36am ~/php): ./fs-test.php
is_link passed
filetype passed:  link
lstat passed:

Array
(
    [0] => 770
    [1] => 1273
    [2] => 41471
    [3] => 1
    [4] => 0
    [5] => 0
    [6] => 0
    [7] => 10
    [8] => 988177003
    [9] => 988177003
    [10] => 988177003
    [11] => 4096
    [12] => 1
)

Warning: lstat failed for (null) (errno=14 - Bad address) in ./fs-test.php
on line 5
is_link failed

Warning: stat failed for /tmp/test-link-func (errno=2 - No such file or
directory) in ./fs-test.php on line 8
filetype failed

Warning: stat failed for /tmp/test-link-func (errno=2 - No such file or
directory) in ./fs-test.php on line 11
lstat failed
--end

If there are other changes to the tree which may be affecting this I will
grab the full CVS tree and try again.  Feel free to send me any patches
directly for testing.

Thanks!
J. Jones

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to