Missing arrays lose everything except the first element

I have a strange problem. I recently migrated my application from my local xampp installation to SUSE Enterprise Server 11 and everything works, but this one thing is driving me crazy and I cannot find a solution.

When passing arrays via GET or POST using this syntax:

search_dggs.php?latmin[]=52.447529&latmin[]=22&lonmin=17.56&lonmax=22.16 

I get only the first latmin element. Keep in mind that this is just a simple example that I tried after an error occurred in other places where array transfer is needed.

 print_r($_SERVER["QUERY_STRING"]); 

exits

 latmin[]=52.447529&latmin[]=22&lonmin=17.56&lonmax=22.16 

but

 print_r($_GET); 

gives

 Array ( [latmin] => Array ( [0] => 52.447529 ) [lonmin] => 17.56 [lonmax] => 22.16 ) 

Likewise, with all POST requests.

I am using PHP version 5.3.8. I think the problem is in some server configuration, but I could not find anything about this problem.

Reply to comments:

The same thing happens if I send any number of variables.

 parse_str($_SERVER["QUERY_STRING"]); print_r($latmin); 

gives

 Array ( [0] => 52.447529 ) 

php.ini can be found here

You should see the behavior in action here.

The source file for this php file is

 <?php $test="latmin[]=52.447529&latmin[]=22&lonmin=23&lonmax=22.16"; parse_str($test); print_r($latmin); phpinfo(); ?> 
+8
arrays post php get
source share
6 answers

Well, my system administrator did a system update and rebooted, and the problem is now fixed. No configuration files have been changed.

+5
source share

Tested on my server and this works fine for me:

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

Look in your data processing section in your php.ini and see what these values ​​are. Reset everything by default, restart the web server and try again. PHP.ini Default Data Processing

+4
source share

An example in a link prints Array ( [0] => 52.447529 ) every time, even if no variables have been passed. So it looks like you have a problem with code that is not related to this code: `

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

`

+2
source share

Hmm .. maybe this is due to a critical vulnerability bug ? Does your XAMPP have the same version of PHP as production? I know that similar problems can occur if you publish too much data (both in terms of file / message size and amount of steam). How about upgrading to 5.3.10?

0
source share

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

0
source share

The most likely cause of this error 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.

Recently, I came across the same behavior with another reason - a security patch, which was partially added to the PHP 5.2 installation, partially implemented by "max_input_vars", but missed some important bits. Another reason, the same result.

The corresponding php source code can be found in main / php_variables.c. In php 5.3.8, rubber hit the road in the php_register_variable_ex function.

There is an SAPI host "treat_data" that uses php to parse strings such as "foo = bar & asdf [] = 1 & asdf [] = 2" - another SAPI may have its own implementation of this.

0
source share

All Articles