[PSR-7] $_FILES behavior wrong description

49 views
Skip to first unread message

Benoît Burnichon

unread,
Dec 9, 2016, 8:35:28 AM12/9/16
to PHP Framework Interoperability Group
Hello,

I have a legacy application where I included PSR-7 specification in the process of modernizing.

Looking at the PSR-7 section about UploadedFileInterface, I saw some false descriptions of how $_FILES works.

I uploaded a file in 'my-form[details][avatar]' field of form-data, I ended up with the following array in $_FILES:

Version of PHP used:
PHP 5.6.27-0+deb8u1 (cli) (built: Oct 15 2016 15:53:28) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans

array (
 
'my-form' => array (
   
'name' => array (
     
'details' => array (
       
'avatars' => 'learny-bn.jpg',
     
),
   
),
   
'type' => array (
     
'details' => array (
       
'avatars' => 'image/jpeg',
     
),
   
),
   
'tmp_name' => array (
     
'details' => array (
       
'avatars' => '/data/tmp/phpRq7Gzy',
     
),
   
),
   
'error' => array (
     
'details' => array (
       
'avatars' => 0,
     
),
   
),
   
'size' => array (
     
'details' => array (
       
'avatars' => 19600,
     
),
   
),
 
),
)

As you can see, it is different from what is indicated in behavior description where all 5 keys are in the same leaf array. Instead, I have keys of second level of $_FILES being 'tmp_name', 'name', 'size', 'type' & 'error'.

I think this description file should be changed as implementors could be misled by the wrong description. Or did I missed something in my config?

Cheers,

Benoît
Reply all
Reply to author
Forward
0 new messages