Bug #64325 [NEW]: Issue in automatic $_POST array handling

From: Date: Thu, 28 Feb 2013 16:09:49 +0000
Subject: Bug #64325 [NEW]: Issue in automatic $_POST array handling
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-177464@lists.php.net to get a copy of this message
From: php at sygmoral dot com Operating system: Debian PHP version: 5.4.12 Package: Arrays related Bug Type: Bug Bug description:Issue in automatic $_POST array handling Description: ------------ Php automatically puts POSTed name-value pairs with names ending in [] into arrays. Very handy feature! However, I notice issues when more of those square brackets are encountered. If I send a name like save[line[]], then save will be an array and the first key in it will be line[, instead of line[]. It's not that I expect a second level of arrays - just that it doesn't strangely remove that last bracket. So suppose we have the tiny php script below, and I send this with e.g. jquery: post_data = {'save[line[]]':'A line with text'} Effectively, the raw POST data being sent is: save%5Bline%5B%5D%5D=A+line+with+text Test script: --------------- print_r( $_POST['save'] ); Expected result: ---------------- POST: Array ( [line[]] => A line with text ) Actual result: -------------- POST: Array ( [line[] => A line with text ) -- Edit bug report at https://bugs.php.net/bug.php?id=64325&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64325&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64325&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64325&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64325&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64325&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64325&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64325&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64325&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64325&r=support Expected behavior: https://bugs.php.net/fix.php?id=64325&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64325&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64325&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64325&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64325&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64325&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64325&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64325&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64325&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64325&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64325&r=mysqlcfg

« previous php.bugs (#177464) next »