Passed arrays lose all but first element

后端 未结 6 1678
别那么骄傲
别那么骄傲 2021-01-12 07:21

I have a strange problem. I recently migrated my application from my local xampp installation to a SUSE Enterprise Server 11 and everything is working but this one thing dri

相关标签:
6条回答
  • 2021-01-12 07:56

    Try $_REQUEST instead of $_GET and/or $_POST

    0 讨论(0)
  • 2021-01-12 08:06

    An example at the link prints Array ( [0] => 52.447529 ) every time even no variables were passed. So, seems that you have problem in code that is not linked with this code: `

    $test="latmin[]=52.447529&latmin[]=22&lonmin=23&lonmax=22.16";
    parse_str($test);
    print_r($latmin);
    phpinfo();
    

    `

    0 讨论(0)
  • 2021-01-12 08:08

    The most likely cause of this bug is that someone set "max_input_vars" to 0 or 1 in php.ini. "max_input_vars" defaults to 1000, and can be overridden in php.ini.

    I encountered the same behavior recently with a different cause -- a security patch someone backported to a PHP 5.2 installation partially implemented "max_input_vars", but missed some important bits. Different cause, same outcome.

    Relevant php source code can be found in main/php_variables.c. In php 5.3.8, the rubber was hitting the road in the php_register_variable_ex function.

    There's a SAPI "treat_data" hook which php uses when parsing strings like "foo=bar&asdf[]=1&asdf[]=2" -- A different SAPI might have its own implementation of this.

    0 讨论(0)
  • 2021-01-12 08:12

    Tested on my server and it works fine for me:

    _GET["latmin"]  
    
    Array
    (
        [0] => 52.447529
        [1] => 22
    )
    

    Look in your php.ini in the Data Handling section and see what the values are. Reset everything to default, restart the webserver and try again. PHP.ini Data Handling defaults

    0 讨论(0)
  • 2021-01-12 08:15

    Well my System Admin did a system update and reboot and the issue is now fixed. No configuration files were changed.

    0 讨论(0)
  • 2021-01-12 08:16

    Hmm.. maybe its somehow related to that critical vulnerability bug ? Does your XAMPP has same PHP version as production? I know there might be similar issues if you post too much data (both in terms of file/post size and param quantity). How about upgrading to 5.3.10 ?

    0 讨论(0)
提交回复
热议问题