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

 ID:                 47640
 Updated by:         yohg...@php.net
 Reported by:        manuel dot schmitt at manitu dot de
 Summary:            Session does not unlock file in /tmp/
 Status:             Feedback
 Type:               Bug
 Package:            Session related
 Operating System:   Linux
 PHP Version:        5.2.9
 Block user comment: N
 Private report:     N

 New Comment:

If you are executing multiple php scripts (e.g. iframe, css, js, etc executes 
php) 

You are better call session_write_close() in your script ASAP.


Previous Comments:
------------------------------------------------------------------------
[2013-06-27 09:33:42] yohg...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

I really don't have clue why you had such problem with 5.2.9.
May be suexec thing.

Please try 5.5 or 5.4.

------------------------------------------------------------------------
[2012-09-12 17:56:16] connie at jaygoss dot com

I just encountered this bug on version 5.3.13. The script worked fine for about 
a year, then stopped working for no known reason (no code changes, version 
upgrades, etc.)

This script works:

echo "<br>Flock Test Without Session<br>"; 
$fp = fopen("_order_id.txt", "r+");
if (flock($fp, LOCK_EX)) { 
    /* do an exclusive lock to get an order number */
    $id = fread($fp,filesize("_order_id.txt"));
    $id++;
    echo "<br>Got the lock, id is now $id";
    ftruncate($fp, 0); /* truncate file */
    rewind($fp); /* reset pointer */
    fwrite($fp, $id); /* write new order id */
    flock($fp, LOCK_UN); /* release the lock */
} else {
    echo "Couldn't get the lock"; 
}

However, if I put the same code inside a session, it fails on my live site, but 
still works fine in my localhost (version 5.3.8):

session_start();
echo "<br>Flock Test With Session<br>"; 
$fp = fopen("_order_id.txt", "r+");
if (flock($fp, LOCK_EX)) { 
    /* do an exclusive lock to get an order number */
    $id = fread($fp,filesize("_order_id.txt"));
    $id++;
    echo "<br>Got the lock, id is now $id";
    ftruncate($fp, 0); /* truncate file */
    rewind($fp); /* reset pointer */
    fwrite($fp, $id); /* write new order id */
    flock($fp, LOCK_UN); /* release the lock */
} else {
    echo "Couldn't get the lock"; 
}
session_destroy();

------------------------------------------------------------------------
[2012-09-12 03:14:57] ahar...@php.net

Explanation provided separately, since it's not relevant to this bug. Bug 
reopened.

------------------------------------------------------------------------
[2012-09-12 03:10:26] larue...@php.net

...maybe it's chagned by the reporter self, no action history log in the 
changes 
tab

------------------------------------------------------------------------
[2012-09-11 20:39:24] kriscr...@php.net

Could somebody explain why the status was changed to "Not a bug?"  I'm not 
seeing 
anything in the comments to indicate why that edit was made.  Looks like a real 
bug to me and everything else seems to check-out, so I'm assuming that was an 
error given the lack of an explanation.

I'm re-opening this with "Feedback" status.  If you're the one who closed this 
(the edit history is empty), please post a comment explaining your reasoning.  
Thanks!

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


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

    https://bugs.php.net/bug.php?id=47640


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

Reply via email to