User tests: Successful: Unsuccessful:
This PR fixes gh-6397 "JFilterInput::isSafeFile() fail on very deep $_FILES array"
</fieldset>
<field type="file" name="document" label="Document" />
<fields name="files">
<fields name="files0">
<field type="file" name="file" label="File 1" />
</fields>
<fields name="files1">
<field type="file" name="file" label="File 2" />
</fields>
<fields name="files2">
<field type="file" name="file" label="File 3" />
</fields>
</fields>
<fields name="images">
<fields name="images0">
<field type="file" name="file" label="Images 1" />
</fields>
<fields name="images1">
<field type="file" name="file" label="Images 2" />
</fields>
</fields>
public function save($key = null, $urlVar = null)
{
$app = JFactory::getApplication();
$files = $app->input->files->get('jform');
die('CHECK');
return parent::save($key, $urlVar); // TODO: Change the autogenerated stub
}
Result before the patch
A lot of PHP warnings
Result after the patch
No PHP warnings, just the word "CHECK" printed on your page
There were two corrective actions taken:
The safe file check was moved into get(). This may have a performance impact on unoptimised code calling $app->input->files->get() repeatedly over the same files, but there's no work around due to the way PHP reports uploaded files. Sorry :(
The JFilterInput::isSafeFile method was modified to handle nested file arrays, either in the raw $_FILES format or as nested arrays of file descriptors (these are the only two possible variations that exist)
Signed-off-by: Nicholas K. Dionysopoulos nicholas@akeebabackup.com
Rel_Number | ⇒ | 6397 | |
Relation Type | ⇒ | Pull Request for | |
Build | ⇒ | . |
@nikosdion travis isnt happy
It's not really my fault. Travis chokes on a line I copied verbatim from JInputFiles. Apparently core code doesn't conform to the core coding standards... Anyway, I updated the PR to make Travis a happy chap.
I only said travis wasnt happy. I did not apportion blame :)
I know, Brian. Let me and Michael complain about the state of the core :)
Status | New | ⇒ | Pending |
Build | . | ⇒ | staging |
Easy | No | ⇒ | Yes |
Category | ⇒ | Libraries |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-03-16 21:40:02 |
@cheesegrits We need your feedback ASAP. Thanks!
thanks @nikosdion
test
work good