Hello:
I have several wxsim scripts running, one of them, which I find nice if it has a graphical interface, sometimes stops working and gives me an error. The truth is that it normally works, but I can’t figure out why it sometimes doesn’t.
The error is from an undefined variable:
Warning: Undefined variable $wxallwindunits in /var/www/html/wxsim_wxall/wxall.plaintext.php on line 318
Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /var/www/html/wxsim_wxall/wxall.plaintext.php:318 Stack trace: #0 /var/www/html/wxsim_wxall/wxall.settings.php(77): include() #1 /var/www/html/wxsim_wxall/sivu2.php(20): include(‘…’) #2 {main} thrown in /var/www/html/wxsim_wxall/wxall.plaintext.php on line 318
At the current departure at 8pm I’m getting the error, but I’m sure tonight at 2am the error won’t be generated.
Any ideas? I could comment on the lines of plaintext.php but I don’t know if it could result in another error.
Thanks
I do not know your version of the script and those old scripts can not list their code to inspect it.
You have to insert 1 extra line before your line 318
That line and the current 318 should look like:
if (!isset($wxallwindunits)) { $wxallwindunits = array();}
if (!array_key_exists($i,$wxallwindunits) and isset($wparts[2]) ) {
Succes,
Wim
Yes sir, fixed. I just get a warning error which I assume is not important
Warning: A non-numeric value encountered in /var/www/html/wxsim_wxall/wxall.lastret.php on line 642
Once again, thank you very much Wim.
Again, I can not check your version of the script.
But it should look like this around line 642
# Put together the graph
if (!isset ($jstop) ) {$jstop = 0;}
$icstart = $jstart-(round(($jstop-$jstart)/($mainwidth-20)*15));
If it is correct, check line 30 of wxall.settings.php if the value of $mainwidth is set correctly.
Wim
Hello Wim, I’m not sure of the version, but the one I have working I downloaded from this thread thanks to you.
Once again you’ve hit the nail on the head with the error, line 30 of wxall.settings.php was like this
$mainwidth = “100%”;
And I’ve set it to
$mainwidth = “875”;
Solved. Thank you so much