user3163577
user3163577

Reputation: 79

simultaneous change in session variables in two pages

Let's say we have two pages A, and B that both use/set the same session variable. These pages are called via AJAX so it's possible that they run simultaneously for the same user. My question is, if page A changes the session variable, does page B observe the new value right after the change?

Upvotes: 0

Views: 63

Answers (2)

Ferdinand Beyer
Ferdinand Beyer

Reputation: 67147

The first request that gets handled by PHP will lock the session file, and any concurrent request for the same session will have to wait for the first request to release the lock.

So, yes, AJAX calls on the second page will get the updated data, if they are initiated after the first request.

Upvotes: 0

Hamish
Hamish

Reputation: 23316

No, page B would have to poll for the change.

Upvotes: 1

Related Questions