ID:               35791
 User updated by:  jgmtfia at gmail dot com
 Reported By:      jgmtfia at gmail dot com
 Status:           Open
 Bug Type:         Filesystem function related
 Operating System: Linux (zts only!)
 PHP Version:      5CVS-2006-01-03 (snap)
 New Comment:

The test given above passes when the non-threaded apache2 MPM is used
for both the cli and apache2 API's.

However this test, which shows what I actually need to accomplish,
fails on both the cli and apache2 API's.  Same sort of problem:
<?php

`echo file A > A; echo file B > B; ln -fs A C`;

echo 'Checking: ';

$FILES = array('A', 'B', 'C');
foreach(array('A', 'B', 'C') as $FILE){
    echo "$FILE ";
    if(!file_exists($FILE)){
        echo "$FILE does not exist.<br>";
        exit;
    }
}

echo "- ok<br><pre>".`ls -l A B C 2>&1`."</pre><br>";

clearstatcache();

echo "Contents of C => ".file_get_contents('C')."<br>";

echo "Remove C -> A, replace with C -> B<br>";
unlink('C');
clearstatcache();
symlink('B', 'C');

echo "<br><pre>".`ls -l A B C 2>&1`."</pre><br>";

$B = trim(file_get_contents('C'));
$RES = '<font color="'.(($B == 'file B') ?
    'green">Pass' : 'red">Fail').'</font>';

echo "Contents of C => $B $RES<br>";
?>

Gives the output:

Checking: A B C - ok

-rw-r--r--    1 nobody   -1           7 Jan  5 19:05 A
-rw-r--r--    1 nobody   -1           7 Jan  5 19:05 B
lrwxrwxrwx    1 nobody   -1           1 Jan  5 19:05 C -> A


Contents of C => file A
Remove C -> A, replace with C -> B

-rw-r--r--    1 nobody   -1           7 Jan  5 19:05 A
-rw-r--r--    1 nobody   -1           7 Jan  5 19:05 B
lrwxrwxrwx    1 nobody   -1           1 Jan  5 19:05 C -> B


Contents of C => file A Fail

An strace of the cli version running the given test shows again that
php is doing an 
    open("/home/user/x/A", O_RDONLY)
when it should be doing    
    open("/home/user/x/C", O_RDONLY)

So it is the same kind of problem as the first test shows, but it did
not go away when the apache MPM was changed to non-threaded.


Previous Comments:
------------------------------------------------------------------------

[2006-01-05 16:36:34] jgmtfia at gmail dot com

I will provide it to your email address this morning.

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

[2006-01-05 00:55:27] [EMAIL PROTECTED]

Can you still send me the config.log you got with the threaded server?
I'd like to see why some of those tests failed..

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

[2006-01-04 23:44:17] jgmtfia at gmail dot com

I removed the apache2 threaded MPM that I had and replaced it with the
prefork MPM and the test now passes when ./configure
--with-apxs2=/usr/bin/apxs2 is used.

Thank you for your help with this.  I had no reason to suspect this was
an apache related problem as the CLI API had the same problem as the
apache2 module.

Is it possible to modify the configure script to detect when a threaded
apache2 MPM is being used to avoid problems in the future?

On another note, the strace of the cli PHP running the test case now
looks more like what would be expected:
write(1, "Checking A.\n", 12C) = 12
access("A", F_OK) = 0
write(1, "Checking C.\n", 12) = 12
access("C", F_OK) = 0
write(1, "Unlinking C.\n", 13) = 13
unlink("C") = 0
write(1, "Checking C: ", 12) = 12
access("C", F_OK) = -1 ENOENT (No such file or directory)

Again thank you.

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

[2006-01-04 20:46:09] [EMAIL PROTECTED]

And before that: Switch to using non-threaded MPM in your apache.
Threaded MPMs are not supported by PHP.

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

[2006-01-04 20:44:27] [EMAIL PROTECTED]

Send also the config.log file.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/35791

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

Reply via email to