#485 Detecting bad windows defaults for php.ini

PHP_error
open
nobody
5
2012-10-11
2005-06-28
bikeracer
No

The php install instructions on windows direct you to
use a file php.ini-recommended (this file does not
appear to ship with the linux versions of php dist).

This php.ini file has the following settings...
register_globals = Off
register_long_arrays = Off
display_errors = Off

The result is that code in phpwiki/lib/config.php
fails, and gives no notice that it has failed.....

  if (!ini_get('register_globals') or

(ini_get('register_globals') == 'off')) {
extract($HTTP_SERVER_VARS);
}

I will include a patch that will address this issue.
The patch has been tested on linux and windows, with
register_long_arrays = On and Off.

It detects the bad ini settings and echo's a message so
that users who have followed the windows setup of PHP
can be warned about incompatable setting of
register_long_arrays in their php.ini file.

When testing, remember to also set display_errors =
Off, as it is in php.ini-recommended in windows dists,
otherwise the logic in this patch will seem redundant.

Discussion

  • bikeracer
    bikeracer
    2005-06-28

    Patch file to warn of bad php.ini setting for register_long_arrays

     
  • Logged In: NO

    Additionally it would be great when the user will be warned
    from his crappy "PHP as CGI"-installation where SCRIPT_NAME
    gives "/php/php.exe" and not the current PHP file.

     
  • Hb
    Hb
    2005-07-03

    Logged In: YES
    user_id=1192644

    .

     
  • Reini Urban
    Reini Urban
    2005-07-21

    Logged In: YES
    user_id=13755

    I've got an better idea:

      if (!ini_get('register_globals') or
    

    (ini_get('register_globals') == 'off')) {
    if (!ini_get('register_long_arrays') or
    (ini_get('register_long_arrays') == 'off')) {
    $HTTP_SERVER_VARS =& $_SERVER;
    }
    extract($HTTP_SERVER_VARS);
    }

     
  • bikeracer
    bikeracer
    2005-07-22

    Logged In: YES
    user_id=1303624

    You will need to test that idea.
    What I remember when I coded the patch is that
    register_long_arrays=Off will cause the $(HTTP_SERVER_VARS)
    to all be null. So I think when you test it you will find
    that this idea will not work as it.
    But from this webpage
    http://www.php.net/manual/en/reserved.variables.php
    I understood that their may be a more verbose way to access
    the needed http variables when the register_long_arrays is
    not set.