Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
[DOCUMENTATION] CUploadedFile::getInstancesByName behavior is not correctly documented #1234
From the documentation of CUploadedFile::getInstancesByName($name) http://www.yiiframework.com/doc/api/1.1/CUploadedFile#getInstancesByName-detail
"Returns an array of instances for the specified ARRAY name. "
This seems to imply that it will only return uploaded files that are elements of an array $_FILES[$name] or of any nested array inside it (as the note remarks: "Please note that this array will contain all files from all subarrays regardless how deeply nested they are").
While it does return all those, it will also return any file whose name just STARTS WITH $name.
Actually, if there existed a method such as CUploadedFile::getAllInstances() to retrieve ALL uploaded files, I'd almost say that the best would be to change the actual method behavior to match the current documentation.
But since there is no such method and it is of VITAL importance to be able to get all instances, I like the current behavior because it provides the only way to get all the instances by calling CUploadedFile::getInstancesByName('') (the only way without jumping into a lower level and accessing $_FILES directly)