#104 PHP5:$_SERVER, $_ENV and $_REQUEST is NULL in cached scripts

open
nobody
None
9
2004-08-13
2004-07-15
No

Perhaps its just me, but the superglobal $_REQUEST
isn't populated in a cached script.

I'm trying this with PHP 5.0.0 and Turck-MMCache
2.4.7-CVS on my SuSE 9.0-box atm. AFAIR it worked fine
with PHP 4.3.x and Turck-MMCache 2.4.6. I'm not sure
about PHP 4 with 2.4.7-CVS.

Discussion

<< < 1 2 (Page 2 of 2)
  • tmgh141242

    tmgh141242 - 2004-07-16

    Logged In: YES
    user_id=774892

    register_long_arrays=Off
    auto_global_jit=Off
    the same problem occured!

     
  • tmgh141242

    tmgh141242 - 2004-07-16

    Logged In: YES
    user_id=774892

    php_variables.c:
    void php_startup_auto_globals(TSRMLS_D)
    {
    zend_register_auto_global("_GET", sizeof("_GET")-1,
    NULL TSRMLS_CC);
    zend_register_auto_global("_POST", sizeof("_POST")-
    1, NULL TSRMLS_CC);
    zend_register_auto_global("_COOKIE", sizeof
    ("_COOKIE")-1, NULL TSRMLS_CC);
    zend_register_auto_global("_SERVER", sizeof
    ("_SERVER")-1, php_auto_globals_create_server TSRMLS_CC);
    zend_register_auto_global("_ENV", sizeof("_ENV")-1,
    php_auto_globals_create_env TSRMLS_CC);
    zend_register_auto_global("_REQUEST", sizeof
    ("_REQUEST")-1, php_auto_globals_create_request
    TSRMLS_CC);
    zend_register_auto_global("_FILES", sizeof("_FILES")-
    1, NULL TSRMLS_CC);
    }
    but the
    php_auto_globals_create_server ,php_auto_globals_create_en
    v ,php_auto_globals_create_request are related to
    register_long_arrays.below is php_auto_globals_create_server:
    static zend_bool php_auto_globals_create_server(char
    *name, uint name_len TSRMLS_DC)
    {
    php_register_server_variables(TSRMLS_C);

    zend_hash_update(&EG(symbol_table), name,
    name_len+1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof
    (zval *), NULL);
    PG(http_globals)[TRACK_VARS_SERVER]-
    >refcount++;

    if (PG(register_long_arrays)) {
    zend_hash_update(&EG
    (symbol_table), "HTTP_SERVER_VARS", sizeof
    ("HTTP_SERVER_VARS"), &PG(http_globals)
    [TRACK_VARS_SERVER], sizeof(zval *), NULL);
    PG(http_globals)[TRACK_VARS_SERVER]-
    >refcount++;
    }

    return 0; /* don't rearm */
    }

    how to fix mmcache.c?i don't know.maybe someone can do it.

     
  • tmgh141242

    tmgh141242 - 2004-07-16

    Logged In: YES
    user_id=774892

    so if set register_long_arrays=off,there seems no way to get
    $_SERVER,$_ENV,$_REQUEST.but the
    $_COOKIE,$_POST,$_GET and $_FILES can be got rightly.
    it seems to be php5's one thing.

     
  • Xuefer

    Xuefer - 2004-07-16

    Logged In: YES
    user_id=185131

    seens not true
    jit=just in time creating the auto global array
    when u have $_REQUEST in your script, Zend/compile.c will
    trigger the jit

    zend_bool jit_initialization = (PG(auto_globals_jit) && !PG
    (register_globals) && !PG(register_long_arrays) && !PG
    (register_argc_argv));

    forgive my mistake
    it's auto_globals_jit
    not auto_global_jit

     
  • tmgh141242

    tmgh141242 - 2004-07-16

    Logged In: YES
    user_id=774892

    yes!it works perfect!
    can you tell me why php5 set auto_globals_jit=1?
    thanks very much.

     
  • Xuefer

    Xuefer - 2004-07-16

    Logged In: YES
    user_id=185131

    it's not "why it set"
    it's a new feature for performance
    most(some?) script don't need those variables

     
  • Christian Stadler

    • summary: $_REQUEST is NULL in cached scripts (PHP 5 with 2.4.7-CVS) --> PHP5:$_SERVER, $_ENV and $_REQUEST is NULL in cached scripts
     
  • Christian Stadler

    Logged In: YES
    user_id=802198

    Can't a workaround be coded, when auto_globals_jit is turned
    on? Perhaps by triggering the jit right before a request to
    $_REQUEST, $_ENV or $_SERVER?

    > most(some?) script don't need those variables
    Well, at least phpMyAdmin and any other script using
    HTTP_AUTH would fail and vBulletin (very popular) is using
    $_SERVER and especially $_REQUEST scriptwide.

     
  • tmgh141242

    tmgh141242 - 2004-08-18

    Logged In: YES
    user_id=774892

    yes,i think this also:"Well, at least phpMyAdmin and any other
    script using
    HTTP_AUTH would fail and vBulletin (very popular) is using
    $_SERVER and especially $_REQUEST scriptwide."

     
  • Nobody/Anonymous

    Logged In: NO

    this is only the case when register_long_arrays is off

     
<< < 1 2 (Page 2 of 2)

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks