|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71123 parse_str('.a=1&.b=2', $arr); returns wrong result
Submitted: 2015-12-15 02:15 UTC Modified: 2015-12-15 02:43 UTC
From: ptcong90 at gmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.6.16 OS: OS X
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ptcong90 at gmail dot com
New email:
PHP Version: OS:


 [2015-12-15 02:15 UTC] ptcong90 at gmail dot com
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:
    [.a] => 1
    [.b] => 2

Actual result:
    [_a] => 1
    [_b] => 2


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-15 02:43 UTC]
-Status: Open +Status: Not a bug -Package: PHP Language Specification +Package: Strings related
 [2015-12-15 02:43 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

PHP converts periods to underscores when parsing query strings and form data intentionally. This is documented behavior.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 15:01:28 2024 UTC