Skip to content

Conversation

@stuart897
Copy link

Fixes #8430

@ddevsr ddevsr added the documentation Pull requests for documentation only label Jan 23, 2024
];
if (! $this->validate($validationRule)) {

$postData = ['userfile' => $this->request->getPost('userfile')];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, in this case $_POST is an empty array. So $postData doesn't matter.
But is this better? Since it works even when other fields are present.

Suggested change
$postData = ['userfile' => $this->request->getPost('userfile')];
$postData = $this->request->getPost(array_keys($validationRule));

@kenjis
Copy link
Member

kenjis commented Jan 23, 2024

Please fix coding style.
Run composer cs-fix to fix.
See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md#php-style

   1) user_guide_src/source/libraries/uploaded_files/002.php (unary_operator_spaces, not_operator_with_successor_space, no_whitespace_in_blank_line)
      ---------- begin diff ----------
--- /home/runner/work/CodeIgniter4/CodeIgniter4/user_guide_src/source/libraries/uploaded_files/002.php
+++ /home/runner/work/CodeIgniter4/CodeIgniter4/user_guide_src/source/libraries/uploaded_files/002.php
@@ -29,7 +29,7 @@
         ];
 
         $postData = ['userfile' => $this->request->getPost('userfile')];
-        
+
         if (! $this->validateData($postData, $validationRule)) {
             $data = ['errors' => $this->validator->getErrors()];
 

      ----------- end diff -----------

https://github.com/codeigniter4/CodeIgniter4/actions/runs/7624518338/job/20791002149?pr=8445

@stuart897 stuart897 closed this Feb 8, 2024
@kenjis
Copy link
Member

kenjis commented Feb 8, 2024

@stuart897 Could you tell me what prevented you from fixing the PR?

@stuart897
Copy link
Author

stuart897 commented Feb 9, 2024

@stuart897 Could you tell me what prevented you from fixing the PR?

Busy at work, the feedback seemed extremely minor & as it hadn't been merged in the meantime thought better to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Pull requests for documentation only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Uploaded Files user guide example uses deprecated validation method

3 participants