Bug #47640 [Fbk->NoF]: Session does not unlock file in /tmp/

From: Date: Tue, 15 Oct 2013 11:54:25 +0000
Subject: Bug #47640 [Fbk->NoF]: Session does not unlock file in /tmp/
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182168@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=47640&edit=1 ID: 47640 Updated by: php-bugs@lists.php.net Reported by: manuel dot schmitt at manitu dot de Summary: Session does not unlock file in /tmp/ -Status: Feedback +Status: No Feedback Type: Bug Package: Session related Operating System: Linux PHP Version: 5.2.9 Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2013-06-27 09:37:20] yohgaki@php.net 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. ------------------------------------------------------------------------ [2013-06-27 09:33:42] yohgaki@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] aharvey@php.net Explanation provided separately, since it's not relevant to this bug. Bug reopened. ------------------------------------------------------------------------ [2012-09-12 03:10:26] laruence@php.net ...maybe it's chagned by the reporter self, no action history log in the changes tab ------------------------------------------------------------------------ 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

« previous php.bugs (#182168) next »