php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ptcong90 at gmail dot com
New email:
PHP Version: OS:

 

 [2015-12-15 02:15 UTC] 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
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-15 02:43 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: PHP Language Specification +Package: Strings related
 [2015-12-15 02:43 UTC] requinix@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 21:01:28 2024 UTC