Forum Moderators: coopster

Message Too Old, No Replies

Various errors.

         

sTimulated

10:39 am on Oct 3, 2011 (gmt 0)

10+ Year Member



I'll start by saying I'm not a coder or programmer,I'm just a user.

Background of the matter....

I have some code that translates files into graphs.
It was originally coded for/in php4.
I now run php5 for various reasons.

These graphs have stopped showing and now produce errors.
Not many but very repetitive.

I had a friend try to fix the errors and he loaded the code into his server(linux with xampp(php5),I use windows with wamp64).
Initially he got the same errors,he then chmodded 777 some folders/files and the graphs started to show :)

I repeated this but it was no go for me :(
Maybe I just need some other modules adding?

Errors......(errors appear when you click on the zoom button)

1-Notice: Undefined index: highlight in H:\wamp\www\stimulatedgaming\rfactorreport\lapbylap.php on line 32

2-Notice: Object of class XMLTag could not be converted to int in H:\wamp\www\stimulatedgaming\rfactorreport\lapbylap.php on line 248

3-Notice: Undefined offset: 20 in H:\wamp\www\stimulatedgaming\rfactorreport\lapbylap.php on line 191

4-Notice: Undefined offset: 20 in H:\wamp\www\stimulatedgaming\rfactorreport\lapbylap.php on line 194

5-Deprecated: Function split() is deprecated in H:\wamp\www\stimulatedgaming\rfactorreport\lib\jpgraph.php on line 176

6-Deprecated: Function split() is deprecated in H:\wamp\www\stimulatedgaming\rfactorreport\lib\jpgraph.php on line 177
JpGraph Error General PHP error : Undefined index: highlight


Codes/Lines......

32-$highlight = $_REQUEST['highlight'];

191-if (($tijd[$i][$j] > $tijd[$k][$j]) && ($tijd[$k][$j] != 0)) {

194-if ($tijd[$i][$j] == 0) {

248-if ($lap == 0)

176-list($majorC, $minorC, $editC) = split('[/.-]', PHP_VERSION);

177-list($majorR, $minorR, $editR) = split('[/.-]', $aMinVersion);
_______________________________
191 & 194 are very repetitive ranging from 1-20(maybe linked to laps?)
I experimented with line 248 by removing one of the = and that error no longer appeared.

I can supply the full package for testing if needed.

To see what I'm talking about go here------> [stimulatedgaming.com...]

Both History and lap by lap graphs do not work for me but do on my friends server?

I have tried using xampp but still the same.
I am going to try today with a different version of wamp64 and also with a wamp32.

Any help,suggestions or insights gladly welcomed.

Many Thanks in advance if you can help :)

rocknbil

4:41 pm on Oct 3, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard sTimulated. Couple things to start with.

1-Notice: Undefined index: highlight in H:\wamp\www\stimulatedgaming\rfactorreport\lapbylap.php on line 32
......
$highlight = $_REQUEST['highlight'];

What this means is there's no value being set in request for "highlight." The solution would be whatever is happening previous that posts to this script. Maybe you have a mis-named form element or broken HTML that is causing the form not to send properly (like a form nested inside another form, pretty common.)

You could (and should) do this as a matter of good error trapping:

if (isset($_REQUEST['highlight']) and ! empty($_REQUEST['highlight'])) {
$highlight = $_REQUEST['highlight'];
}
else {die("Highlight is not being set, check the form or link."); }

But you will of course get that die message. This is what it's telling you.

The rest of the errors are PROBABLY cascading from this one error - second reason for good error trapping. It stops the script immediately. Your script is likely stumbling on trying to make sense of what you're feeding it because the whole thing relies on there being a value for "highlight."

These

Deprecated: Function split() is deprecated...

should be substituted for preg_split()

list($majorC, $minorC, $editC) = preg_split('/[/.-]/', PHP_VERSION);

This,

I experimented with line 248 by removing one of the = and that error no longer appeared.


if ($tijd[$i][$j] == 0) {

is a mistake (a pretty big one. :-) ) The two =='s means "if it's equal to" but when you only have one, what you're doing is setting the value of what's on the left to whatever's on the right. The "if" only means "if setting this value to something succeeds, do something" whereas the original intent is "if this value is equal to that value then do something":


$tijd[$i][$j] = 1;
echo $tijd[$i][$j]; // echo's "1"

Maybe I just need some other modules adding?


Unlikely that adding more modules or files will un-complicate the problem. Start with figuring out why you have no "highlight" in $_REQUEST.

sTimulated

10:58 pm on Oct 3, 2011 (gmt 0)

10+ Year Member



Many Thanks for help and Direction :)

I removed the line $highlight = $_REQUEST['highlight'];
and added the preg_ to the 2 lines.

I get no errors but also no graph.
When clicking the zoom button to make graph open in a new window I get a blank page with a box outline in the middle with the word image in the center of the box.

I did not change- if ($tijd[$i][$j] == 0) {
to- $tijd[$i][$j] = 1;
echo $tijd[$i][$j]; // echo's "1"

Whats baffling is that php5 is supposed to be backward compatible I hear?
So it should work.
And it does work for my friend running php5.
Could it be so simply that he's running linux and I'm running windows?
I don't understand how it can work for him and not for me?

rocknbil

4:01 pm on Oct 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I removed the line $highlight = $_REQUEST['highlight'];


You weren't supposed to remove it, your program needs that value to run. You were supposed to see WHY, when it gets to this program, there's no "$_REQUEST['highlight']" being set.

The deprecated functions of split, ereg, and others will issue warnings until they are replaced with preg (PCRE) functions.

sTimulated

9:03 pm on Oct 5, 2011 (gmt 0)

10+ Year Member



Hi
Thanks for the Help again :)

May go down a different road......

It may be possible to have php4 running alongside php5 on my server through wamp?
There needs to some recompiling done but it may be possible.

Would save me a lot of grief,just need to wait while sm compiles the files.....