php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41705 Same processes of one session are executed simultaneously
Submitted: 2007-06-15 17:24 UTC Modified: 2007-06-25 18:40 UTC
Votes:3
Avg. Score:3.7 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: laden100 at mail dot ru Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.2.3 OS: Solaris
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: laden100 at mail dot ru
New email:
PHP Version: OS:

 

 [2007-06-15 17:24 UTC] laden100 at mail dot ru
Description:
------------
If more than one process of the same session is created in the one time,  this processes are executed simultaneously instead of being executed one after another.

Reproduce code:
---------------
<?php
 //For example this script is asked three times simultaneously from the one user, siting on the one session ID
 require_once('db_fns.php'); //requiring mysql functions and connecting to database
 require_once('session.php'); //creating session from MySQL storage
 $sessid = session_id();
 $example = db_query_onerow("SELECT example FROM table WHERE id=1"); //etc the field `example` is "1" by default. So all three times every process has the value "1"
 echo "Example: $example"; //So every time we will get "1"
 $lock = db_query_onerow("SELECT GET_LOCK('database.lock_{$sessid}', 60);"); //Getting lock to test the bug of PHP
 $anotherexample = db_query_onerow("SELECT example FROM table WHERE id=1"); //This Select will be not executed at the one time because of MySQL locks and will give us the right values
 echo "Another Example: $anotherexample"; //At the first time it will be "1" and two other time "0"
 db_query_write("UPDATE table SET example=0 WHERE id=1"); //Setting the field `example` to 0
 $lock = db_query_onerow("SELECT RELEASE_LOCK('database.lock_{$sessid}')"); //Getting lock to test the bug
?>

Expected result:
----------------
Example: 1
Another Example: 1
Example: 0
Another Example: 0
Example: 0
Another Example: 0

Actual result:
--------------
Example: 1
Example: 1
Example: 1
Another Example: 1
Another Example: 0
Another Example: 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-25 18:40 UTC] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 20 14:00:02 2025 UTC