php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67262 bug in libapache2-mod-php5filter
Submitted: 2014-05-12 18:52 UTC Modified: 2021-07-07 10:51 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: vladget at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Apache2 related
PHP Version: 5.4.28 OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
27 + 27 = ?
Subscribe to this entry?

 
 [2014-05-12 18:52 UTC] vladget at gmail dot com
Description:
------------
Hello!

php5filter duplicate data in POST from forms used as arrays(http://us2.php.net/manual/en/faq.html.php#faq.html.arrays)

Here is simple way to reproduce it:
cat f.php

<!DOCTYPE html>
<html>
<head>
    <meta charset="windows-1251">
</head>
<body>

<form action="f.php" method="post" enctype="multipart/form-data">
    <input type="text" name="a">
    <input type="text" name="b[]">
    <input type="text" name="b[]">
    <button type="submit">submit</button>
</form>
<?php

if (!empty($_POST)) {
    echo '<pre>';
    echo "POST:\n";
    var_dump($_POST);
    echo '</pre>';
}

?>
</body>
</html>

libapache2-mod-php5filter as apache mod_php:

  ["a"]=>
  string(1) "1"
  ["b"]=>
  array(4) {
    [0]=>
    string(1) "2"
    [1]=>
    string(1) "3"
    [2]=>
    string(1) "2"
    [3]=>
    string(1) "3"

but it works fine with libapache2-mod-php5 as apache mod_php:

array(2) {
  ["a"]=>
  string(1) "1"
  ["b"]=>
  array(2) {
    [0]=>
    string(1) "2"
    [1]=>
    string(1) "3"

Test script:
---------------
<!DOCTYPE html>
<html>
<head>
    <meta charset="windows-1251">
</head>
<body>

<form action="f.php" method="post" enctype="multipart/form-data">
    <input type="text" name="a">
    <input type="text" name="b[]">
    <input type="text" name="b[]">
    <button type="submit">submit</button>
</form>
<?php

if (!empty($_POST)) {
    echo '<pre>';
    echo "POST:\n";
    var_dump($_POST);
    echo '</pre>';
}

?>
</body>
</html>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-29 12:16 UTC] rmn1024 at gmail dot com
There is also bug with non-array POST-variables. But it looks little different because variables append to last.
If you send in POST body:
a=123

You will receive

array(1) {
  ["a"]=>
  string(8) "123a=123"
}
 [2021-07-07 10:51 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-07-07 10:51 UTC] cmb@php.net
The php5filter SAPI is removed as of PHP 7.0.0 (there is no
php7filter); as such, this ticket is obsolete.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 20:01:30 2024 UTC