Hi,
I had a problem with nfsen 1.3 with apache2, php 5.2 on OpenSuSE 10.2. When I 
opened the "Details" page the first time it was showing the graphs.
On the first form submit or reload of the page there occured some problems:

Second load: Message "ERROR: No value for 'statvisible'!" but some graph data 
visible
Third load: Message "ERROR: No value for 'statvisible'!" but some graph data 
visible
Tab Change and back: Message "ERROR: No value for 'statvisible'!", no graph 
data visible

I recognized the problem was caused by the cookie "statvisible" which is set in 
the Javascript code on the first load of the page.
On the second load of the page the cookie value is read and written to the 
superglobal $_POST. It seems there is a problem reading this Cookie values in 
PHP.

When I do print_r($_COOKIE); in details.php it displays:

Array
(
    [statvisible] => 
    [PHPSESSID] => rvvii7426aic8ith6sebu9st607dnucl
)

Like explained above the cookie value is read from $_COOKIE['statvisible'] and 
written to $_POST['statvisible']. If the value of $_COOKIE['statvisible'] is 
empty the empty value is written to $_POST['statvisible']. The default value of 
"statsvisible" in the array $detail_opts will be overwritten by the empty value 
in $_POST array. This causes the error messages I got at the second load of the 
page.

This is a quick backtrace through the sources, don't know if it's correct at 
every point.

I guess this is not the final sollution for that problem but I patched the 
details.php as attached, now the page works for me as expected.

--- details.php.orig    2008-02-05 15:21:43.000000000 +0100
+++ details.php 2008-02-05 15:22:24.000000000 +0100
@@ -305,11 +305,11 @@
                $_POST['proto'] = $_GET['proto'];
        }

-       if ( isset($_COOKIE['statpref']) ) {
+       if ( isset($_COOKIE['statpref']) && $_COOKIE['statpref'] != '' ) {
                $_POST['statpref'] = $_COOKIE['statpref'];
        }

-       if ( isset($_COOKIE['statvisible']) ) {
+       if ( isset($_COOKIE['statvisible']) && $_COOKIE['statvisible'] != '' ) {
                $_POST['statvisible'] = $_COOKIE['statvisible'];
        }
        
OK, i see the "Statistics timeslot" table is displayed on every load of the 
page, even if i set it to invisible - but that's not a problem for me.

I just tested the javascript/php cookie handling on another webserver with php 
5.1.x instead of 5.2 -> it worked! So now the question: Do you konw any changes 
there from php 5.1 to 5.2?
It would be nice if you could aply the patch I posted above to nfsen to get the 
detail page work on php 5.2. Furthermore someone should have a look for a real 
fix in php 5.2.

Thanks!
Lars

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nfsen-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nfsen-discuss

Reply via email to