This topic is locked

A value is missing sometimes from "before display" to "before record added"

9/5/2018 2:59:22 PM
PHPRunner General questions
N
notuo author

Hi. This case is weird. I am not able to debug and I am asking for ideas from you.
I have a list page with a button where I call to an add page using two parameters. iID and aID obtained in this first page. Code:



$record = $button->getCurrentRecord();

$_SESSION["alumnosID"] = $result["alumnosID"] = $record["alumnosID"];

$result["SUBSYSTEMLOCATION"] = $SUBSYSTEMLOCATION . "/" . "eainvest17_add.php?aID=" . $_SESSION["alumnosID"] . "&" . "iID=" . $_SESSION["investigadoresID"];


The eainvest17_add.php page works most of the time (around 3-4% of the time I lost this value: $_SESSION["alumnosID"] when traversing from "Before display" and "Before record added"
I modify my code to generate logs and review this. I confirmed this is happening. I am not sure why and this is my request for help.
Here is the code that add to a log file for all the following examples:



error_log("<<message in page>>: |" . date("Y-m-d h:i:s") . "|" . $_SESSION["UserID"] . "|" . $_SESSION["investID"] . "|" . $_SESSION["alumnosID"] . "|" . $_SERVER[REQUEST_URI] . "|\n", 3, $logfile);


The following examples shows the expected result (96-97% of the time is like this)



Before display: |2018-09-05 09:37:08|HIBC750513|8216|180470|/verano18/investigadores/eainvest17_add.php?aID=180470&iID=8216|

Before record added 1: |2018-09-05 09:45:27|HIBC750513|8216|180470|/verano18/investigadores/eainvest17_add.php?submit=1&|

Before record added 2: |2018-09-05 09:45:27|HIBC750513|8216|180470|/verano18/investigadores/eainvest17_add.php?submit=1&|

After record added: |2018-09-05 09:45:27|HIBC750513|8216|180470|/verano18/investigadores/eainvest17_add.php?submit=1&|

Before display: |2018-09-05 09:45:27|HIBC750513|8216|180470|/verano18/investigadores/eainvest17_add.php?submit=1&|||
Before display: |2018-09-05 09:33:17|MAMM681228|10219|180248|/verano18/investigadores/eainvest17_add.php?aID=180248&iID=10219|

Before record added 1: |2018-09-05 09:49:05|MAMM681228|10219|180248|/verano18/investigadores/eainvest17_add.php?submit=1&|

Before record added 2: |2018-09-05 09:49:05|MAMM681228|10219|180248|/verano18/investigadores/eainvest17_add.php?submit=1&|

After record added: |2018-09-05 09:49:06|MAMM681228|10219|180248|/verano18/investigadores/eainvest17_add.php?submit=1&|

Before display: |2018-09-05 09:49:06|MAMM681228|10219|180248|/verano18/investigadores/eainvest17_add.php?submit=1&|
Before display: |2018-09-05 09:49:12|MAMM681228|b|/verano18/investigadores/eainvest17_add.php?aID=181910&iID=10219|

Before record added 1: |2018-09-05 10:00:49|MAMM681228|10219|181910|/verano18/investigadores/eainvest17_add.php?submit=1&|

Before record added 2: |2018-09-05 10:00:49|MAMM681228|10219|181910|/verano18/investigadores/eainvest17_add.php?submit=1&|

After record added: |2018-09-05 10:00:51|MAMM681228|10219|181910|/verano18/investigadores/eainvest17_add.php?submit=1&|

Before display: |2018-09-05 10:00:51|MAMM681228|10219|181910|/verano18/investigadores/eainvest17_add.php?submit=1&|
Before display: |2018-09-05 10:00:55|MAMM681228|10219|182051|/verano18/investigadores/eainvest17_add.php?aID=182051&iID=10219|

Before record added 1: |2018-09-05 10:03:41|MAMM681228|10219|182051|/verano18/investigadores/eainvest17_add.php?submit=1&|

Before record added 2: |2018-09-05 10:03:41|MAMM681228|10219|182051|/verano18/investigadores/eainvest17_add.php?submit=1&|

After record added: |2018-09-05 10:03:41|MAMM681228|10219|182051|/verano18/investigadores/eainvest17_add.php?submit=1&|

Before display: |2018-09-05 10:03:41|MAMM681228|10219|182051|/verano18/investigadores/eainvest17_add.php?submit=1&|
Before display: |2018-09-05 09:49:46|BAIL520916|1638|182289|/verano18/investigadores/eainvest17_add.php?aID=182289&iID=1638|

Before record added 1: |2018-09-05 10:14:47|BAIL520916|1638|182289|/verano18/investigadores/eainvest17_add.php?submit=1&|

Before record added 2: |2018-09-05 10:14:47|BAIL520916|1638|182289|/verano18/investigadores/eainvest17_add.php?submit=1&|

After record added: |2018-09-05 10:14:47|BAIL520916|1638|182289|/verano18/investigadores/eainvest17_add.php?submit=1&|

Before display: |2018-09-05 10:14:47|BAIL520916|1638|182289|/verano18/investigadores/eainvest17_add.php?submit=1&|


You can notice the url has the same values in the log records as stated by the call with aID and iID (as expected)
But sometimes, just sometimes and I have no clue to this The logs shows the following (you can see the aID is missing and because of that the values recorded in the proper record has NULL which is an error. I have to fix those NULL values by hand now.



Before display: |2018-09-03 07:32:34|PEPR540306|||/verano18/investigadores/eainvest17_add.php?aID=180246&iID=13482|

Before record added 1: |2018-09-03 07:39:32|PEPR540306|13482||/verano18/investigadores/eainvest17_add.php?submit=1&|

Before record added 2: |2018-09-03 07:39:32|PEPR540306|13482||/verano18/investigadores/eainvest17_add.php?submit=1&|

After record added: |2018-09-03 07:39:32|PEPR540306|13482||/verano18/investigadores/eainvest17_add.php?submit=1&|

After record added NULL confirmed: |2018-09-03 07:39:32|PEPR540306|13482||/verano18/investigadores/eainvest17_add.php?submit=1&|

Before display: |2018-09-03 07:39:32|PEPR540306|||/verano18/investigadores/eainvest17_add.php?submit=1&|||
Before display: |2018-09-05 07:50:44|MACB730827|10247|183772|/verano18/investigadores/eainvest17_add.php?aID=183772&iID=10247|

Before record added 1: |2018-09-05 08:45:23|MACB730827|10247||/verano18/investigadores/eainvest17_add.php?submit=1&|

Before record added 2: |2018-09-05 08:45:23|MACB730827|10247||/verano18/investigadores/eainvest17_add.php?submit=1&|

After record added: |2018-09-05 08:45:23|MACB730827|10247||/verano18/investigadores/eainvest17_add.php?submit=1&|

After record added NULL confirmed: |2018-09-05 08:45:23|MACB730827|10247||/verano18/investigadores/eainvest17_add.php?submit=1&|

Before display: |2018-09-05 08:45:24|MACB730827|||/verano18/investigadores/eainvest17_add.php?submit=1&|


I really appreciate any idea. I am lost with this.
Regards to all.

admin 9/5/2018

It is strange that only one variable gets lost. I would assume that there is some other place in the code where $_SESSION["alumnosID"] gets assigned or destroyed.
Another thing is the inconsistency between $_SESSION["investigadoresID"] and $_SESSION["investID"]. You pass one variable via URL but print another one. Just a pointer.

N
notuo author 9/5/2018



It is strange that only one variable gets lost. I would assume that there is some other place in the code where $_SESSION["alumnosID"] gets assigned or destroyed.



Yes, I am trying to look for this in all the events for this particular view with no luck yet.
I think the real problem is that this happens just sometimes, not always. I mean. There is no php nor JS code to deviate the execution somehow.



Another thing is the inconsistency between $_SESSION["investigadoresID"] and $_SESSION["investID"]. You pass one variable via URL but print another one. Just a pointer.


I noticed this as well. It's fine. I made a mistake and use investID wrongly here. Thanks you for noticing <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=85850&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />

admin 9/6/2018

There might be some sort of concurrent access i.e. someone clicks that buttons twice really quick or something similar.
I just noticed that $_SESSION["investID"] always works and $_SESSION["alumnosID"] sometimes doesn't work. You need to look into the way you populate these two sessions variables. There must be some crucial differences.

N
notuo author 9/12/2018



There might be some sort of concurrent access i.e. someone clicks that buttons twice really quick or something similar.
I just noticed that $_SESSION["investID"] always works and $_SESSION["alumnosID"] sometimes doesn't work. You need to look into the way you populate these two sessions variables. There must be some crucial differences.


Everything looks fine about your recommendation.
I think I just narrowed the issue. If any person leaves (filled or not completely filled) this form unattended for many time (i.e. the session expires) and then try to return and either complete or just save the form. I lost the second value (alumnosID).
What I just saw is after the save button is clicked , the session is not valid anymore and the user is asked to login again in a pop up. In this moment I have the investID restarted but I lost the alumnosID for good.
I opened another thread asking for help in how to kill the session after a time out completely (I mean, the login screen is presented to the user in order to star all over again).
From your knowledge, is there any other way to do this?
Regards,