Link to home
Start Free TrialLog in
Avatar of Richard Korts
Richard KortsFlag for United States of America

asked on

Cannot see how code is dying

The client has encountered a bug, I am trying to track it down. I've reached the point where the code (php) just dies, I cannot see how it can do what it's doing.


Attached are two programs and the result of their processing. Specifically, on line 80 in mults_print.php there is an include of get_session_for_form.php. For debugging, I put in a lot of echos. Note, specifically on line 79, this echo shows. On line 3 of get_session_for_form.php, that echo does not appear.


Seems impossible, meaning probably I am overlooking the obvious.


Can someone help?


Thank you


impossible.JPG

get_session_for_form.php

mults_print.php

Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

First off, make SURE you don't echo anything before calling session_start:


if ($_POST['xp20215'] == "on") {
   echo "got 20215 in mults_print<br>"; // <------------ IF THIS RUNS, THE SESSION WON'T START!
}   
$fr = $_GET['fr'];
$sta = "on";
session_start(); // <-------------- THIS NEEDS TO COME BEFORE ANY OUTPUT

Open in new window


Next, your code says:


<?php   
   include "db_connect.php";
   echo "entered get_session_for_form<br>";

Open in new window


If you add an echo BEFORE the include, will that first echo show? If so, maybe there's an error within db_connect.php.


Avatar of Richard Korts

ASKER

Made both of those changes, same result.


Thank you.


Richard

1. What does the top of the get_session_for_form.php look like after you added the new echo?


2. If you change the error reporting level to E_ALL, do you see any additional notices or anything that might provide some context?

Hi,


Always check these 2 places: 

Check php errror log file on the webserver.

Check error in browser console (right click inspect)


You can test the code locally and enabling error reporting.

*Note do not enable error reporting on production live application for security reason...


Locally on test machine I'm using Xdebug this improve error reporting info, this tool is a part of Wampserver if you use this webserver,

otherwise you need to install it manually.
https://xdebug.org/


ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Gr8gonzo, that got me past that point, the E_ALL found that code as you identified.


Still another roadblock, but past that point.


Thank you,


Richard