Bug #71123 [Opn->Nab]: parse_str('.a=1&.b=2', $arr); returns wrong result

From: Date: Tue, 15 Dec 2015 02:43:17 +0000
Subject: Bug #71123 [Opn->Nab]: parse_str('.a=1&.b=2', $arr); returns wrong result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197892@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71123&edit=1 ID: 71123 Updated by: requinix@php.net Reported by: ptcong90 at gmail dot com Summary: parse_str('.a=1&.b=2', $arr); returns wrong result -Status: Open +Status: Not a bug Type: Bug -Package: PHP Language Specification +Package: Strings related Operating System: OS X PHP Version: 5.6.16 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php PHP converts periods to underscores when parsing query strings and form data intentionally. This is documented behavior. http://php.net/manual/en/language.variables.external.php Previous Comments: ------------------------------------------------------------------------ [2015-12-15 02:15:45] ptcong90 at gmail dot com Description: ------------ parse_str returns a wrong result if param start with dot (.) parse_str('.a=1&.b=2', $arr); This issue happend in whole versions of php. Test script: --------------- parse_str('.a=1&.b=2', $array); Expected result: ---------------- Array ( [.a] => 1 [.b] => 2 ) Actual result: -------------- Array ( [_a] => 1 [_b] => 2 ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71123&edit=1

« previous php.bugs (#197892) next »