Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1

    Avviso problema php 4.2.3

    Buon giorno a tutti, aprendo la pagina mi restituisce questo messaggio:

    codice:
    Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0
    Facendo una rapida traduzione ho capito che devo settare i valori:
    - session.bug_compat_42
    - session.bug_compat_warn
    su off.
    Aprendo php.ini trovo per default il valore su 1 e imposto il nuovo valore su 0.
    Riavvio il server.
    Eseguo il login sulla pagina ma purtroppo mi da sempre lo stesso avviso.
    Come mai?
    grazie in anticipo.

  2. #2
    ho dimenticato di dirvi che, dopo aver letto l'avviso, se faccio un refresh della pagina, quell'avviso sparisce.
    mmma....

  3. #3
    probabile la cache...

    Ma mettere il off spegni solo la lampadina dell'allarme e non risolvi il problema.

    Verifica lo script.

    ; PHP 4.2 and less have an undocumented feature/bug that allows you to
    ; to initialize a session variable in the global scope, even when register_globals
    ; is disabled. PHP 4.3 and later will warn you, if this feature is used.
    ; You can disable the feature and the warning separately. At this time,
    ; the warning is only displayed, if bug_compat_42 is enabled. This feature
    ; introduces some serious security problems if not handled correctly. It's
    ; recommended that you do not use this feature on production servers. But you
    ; should enable this on development servers and enable the warning as well. If you
    ; do not enable the feature on development servers, you won't be warned when it's
    ; used and debugging errors caused by this can be difficult to track down.
    ; Default Value: On
    ; Development Value: On
    ; Production Value: Off
    ; http://php.net/session.bug-compat-42
    session.bug_compat_42 = On

    ; This setting controls whether or not you are warned by PHP when initializing a
    ; session value into the global space. session.bug_compat_42 must be enabled before
    ; these warnings can be issued by PHP. See the directive above for more information.
    ; Default Value: On
    ; Development Value: On
    ; Production Value: Off
    ; http://php.net/session.bug-compat-warn
    session.bug_compat_warn = On
    In pratica stai usando delle features (caratteristica, aspetto) che portavano ad un bug.

    Il silenzio è spesso la cosa migliore. Pensa ... è gratis.

  4. #4
    Ciao,
    ti sconsiglio di modificare session.bug_compat_42 e session.bug_compat_warn,
    perché così facendo fai solo scomparire i warning, ma non risolvi il problema.

    La causa del warning è - probabilmente - dovuta al fatto che tu usi un indice di sessione che ha lo stesso nome di una variable globale PHP...

    ad esempio se hai
    Codice PHP:
    global $user;
    $_SESSION['user'
    questo genererà quel warning...
    quindi la soluzione è controllare gli indici che usi per $_SESSION e trovato quello incriminato cambiarlo (nel nostro caso ad esempio anziche $_SESSION['user'] potremmo usare $_SESSION['utente']

    NB: non è necessario che la variabile globale l'abbia dchiarata tu con global,
    as esempio se hai $_SESSION['argv'] otterrai cmq il warning perché $argv è una variabile globale php...

  5. #5
    Utente di HTML.it L'avatar di Grino
    Registrato dal
    Oct 2004
    Messaggi
    739
    Ho trovato questo commento sul manuale ufficiale di php.net
    http://php.net/manual/en/reserved.variables.session.php

    When accidently assigning a unset variable to $_SESSION, like

    $_SESSION['foo'] = $bar

    while $bar was not defined, I got the following error message:

    "Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. "

    The errormessage was quite unrelated and got me off-track. The real error was, $bar was not defined.
    Siamo sempre troppo gelosi delle nostre grandi piccole opere! - Grino inedito.
    Lavori e Lavoretti

  6. #6
    ciao Piero buon giorno e grazie.
    Cmq.
    leggendo quello che mi hai postato:
    1) cosa sono le features(caratteristiche) che sto utilizzando
    2) anche disabilitando:
    -session.bug_compat_42 = Off
    -session.bug_compat_warn = Off
    tolgo il warning ma il problema resta.
    3) ho le register_globals = Off, le devo abilitare?

    4) dice che questa features introduce a problemi gravi sulla sicurezza.Ma quali?Come si risolvono?

    Domanda: praticamente com'è che ieri sto problema non ce l'avevo e oggi è saltato fuori?
    Come lo risolvo?
    grazie mille.

  7. #7
    se a me restituisse:
    The errormessage was quite unrelated and got me off-track. The real error was, $bar was not defined. saprei come risolvere..

  8. #8
    Originariamente inviato da philbert
    Ciao,
    ti sconsiglio di modificare session.bug_compat_42 e session.bug_compat_warn,
    perché così facendo fai solo scomparire i warning, ma non risolvi il problema.

    La causa del warning è - probabilmente - dovuta al fatto che tu usi un indice di sessione che ha lo stesso nome di una variable globale PHP...

    ad esempio se hai
    Codice PHP:
    global $user;
    $_SESSION['user'
    questo genererà quel warning...
    quindi la soluzione è controllare gli indici che usi per $_SESSION e trovato quello incriminato cambiarlo (nel nostro caso ad esempio anziche $_SESSION['user'] potremmo usare $_SESSION['utente']

    NB: non è necessario che la variabile globale l'abbia dchiarata tu con global,
    as esempio se hai $_SESSION['argv'] otterrai cmq il warning perché $argv è una variabile globale php...
    non avevo letto il tuo post.....scusami, adesso provo tutto quello che mi avete postato e vi farò sapere....
    vi ringrazio molto gentili

  9. #9
    Utente di HTML.it L'avatar di Grino
    Registrato dal
    Oct 2004
    Messaggi
    739
    Originariamente inviato da ANTAGONIA
    se a me restituisse:
    The errormessage was quite unrelated and got me off-track. The real error was, $bar was not defined. saprei come risolvere..
    Di la verità, stai un po' fumato dall'ultima notte brava. Vero?
    Siamo sempre troppo gelosi delle nostre grandi piccole opere! - Grino inedito.
    Lavori e Lavoretti

  10. #10
    si può darsi, solo che non fumo e le notti brave sono un lontano ricordo.....
    cmq risotto...

    la struttura dello script iniziale:
    Codice PHP:
    if (mysql_num_rows($rsBonus) > 0) {
    $row mysql_fetch_array($rsBonus);
    $cal_telefonia            $row['cal_telefonia'];
    $cal_telefoniamobile            $row['cal_telefoniamobile'];
    $cal_video                $row['cal_video'];
    $cal_adsl                        $row['cal_adsl'];
    }

    $arrayUtenze             = array($cal_telefonia$cal_telefoniamobile,$cal_video,$cal_adsl);

    $_SESSION['sommaQuantita']    = array_sum($arrayUtenze); 
    dopo la modifica:
    Codice PHP:
    if (mysql_num_rows($rsBonus) > 0) {
    $row                     mysql_fetch_array($rsBonus);
    $_SESSION['cal_fleg_hide_casa']    = $row['cal_fleg_hide_casa'];
    }

    $arrayUtenze                 = array(
                                
    $row['cal_telefonia'], 
                                
    $row['cal_telefoniamobile'],
                                
    $row['cal_video'],
                                
    $row['cal_adsl']);
    $_SESSION['sommaQuantita']    = array_sum($arrayUtenze); 
    che ne dite?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.