php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36171 $_FILES array keys have periods replaced with underscores
Submitted: 2006-01-26 19:35 UTC Modified: 2006-01-27 00:40 UTC
From: bugs at nikmakepeace dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.1.2 OS: Fedora Core 3
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: bugs at nikmakepeace dot com
New email:
PHP Version: OS:

 

 [2006-01-26 19:35 UTC] bugs at nikmakepeace dot com
Description:
------------
After a file upload, the $_FILES array does not faithfully reflect the structure of the form from which the upload was made. An input with the valid HTML name of 'a.b' becomes the key 'a_b' in the $_FILES array.

The same is true of the other request superglobals.

The PHP manual says that an array index can be any string, and the HTML 5 rec says that the name attribute can be CDATA. 

Now that register_globals is on its last legs in the community, could you make it so that the dot transformation happens only when you explictly extract() or import_request_variables()

Reproduce code:
---------------
<form enctype="multipart/form-data" method="POST">
    <input name="a.b" type="file" />
    <input type="submit" />
</form>

Expected result:
----------------
Something like this:

$_FILES is array ( 
'a.b' => array ( 
  'name' => '5364-16.jpg', 
  'type' => 'image/jpeg', 
  'tmp_name' => 
  '/tmp/php7vvvc0', 
  'error' => 0, 
  'size' => 66554, ), 
)

Actual result:
--------------
$_FILES is array ( 
'a_b' => array ( 
  'name' => '5364-16.jpg', 
  'type' => 'image/jpeg', 
  'tmp_name' => 
  '/tmp/php7vvvc0', 
  'error' => 0, 
  'size' => 66554, ), 
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-27 00:40 UTC] derick@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

We can\'t change this either, as people might still use register_globals and/or still rely on this behavior.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC