suhosin removes empty fields from $_POST when used with PHP 5.6

Bug #1624527 reported by rot13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PLD Linux
Fix Released
Medium
Elan Ruusamäe

Bug Description

In a fresh PLD chroot:

# rpm -qa | grep php
php-dirs-1.7-1.noarch
php56-common-5.6.24-1.x86_64
php56-cgi-5.6.24-1.x86_64
php56-suhosin-0.9.36-2.x86_64
php55-common-5.5.38-1.x86_64
php55-cgi-5.5.38-1.x86_64
php55-suhosin-0.9.36-2.x86_64

Notice the empty variable missing from $_POST on PHP 5.6:

# echo '<?php var_dump($_POST);' >/tmp/post_test.php && echo "test=test&empty=" | CONTENT_LENGTH=16 REQUEST_METHOD=POST CONTENT_TYPE=application/x-www-form-urlencoded REDIRECT_STATUS=1 SCRIPT_FILENAME=/tmp/post_test.php php56.cgi /tmp/post_test.php
Content-type: text/html; charset=UTF-8

array(1) {
  ["test"]=>
  string(4) "test"
}

PHP 5.5 works correctly:

# echo '<?php var_dump($_POST);' >/tmp/post_test.php && echo "test=test&empty=" | CONTENT_LENGTH=16 REQUEST_METHOD=POST CONTENT_TYPE=application/x-www-form-urlencoded REDIRECT_STATUS=1 SCRIPT_FILENAME=/tmp/post_test.php php55.cgi /tmp/post_test.php
Content-type: text/html

array(2) {
  ["test"]=>
  string(4) "test"
  ["empty"]=>
  string(0) ""
}

PHP 5.6 without loading suhosin (by uninstalling it or adding -n flag) also works correctly:

# echo '<?php var_dump($_POST);' >/tmp/post_test.php && echo "test=test&empty=" | CONTENT_LENGTH=16 REQUEST_METHOD=POST CONTENT_TYPE=application/x-www-form-urlencoded REDIRECT_STATUS=1 SCRIPT_FILENAME=/tmp/post_test.php php56.cgi -n /tmp/post_test.php
X-Powered-By: PHP/5.6.24
Content-type: text/html; charset=UTF-8

array(2) {
  ["test"]=>
  string(4) "test"
  ["empty"]=>
  string(0) ""
}

Revision history for this message
rot13 (pp) wrote :

Upstream release 0.9.38 seems to work properly. Opened pull request on github: https://github.com/pld-linux/php-suhosin/pull/1

Revision history for this message
Elan Ruusamäe (glen666) wrote :

will be solved with that PR#1

Changed in pld-linux:
assignee: nobody → Elan Ruusamäe (glen666)
importance: Undecided → Medium
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.