Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MimeType.zep #16646

Merged
merged 9 commits into from
Sep 16, 2024
Merged

Update MimeType.zep #16646

merged 9 commits into from
Sep 16, 2024

Conversation

zikezhang
Copy link
Contributor

@zikezhang zikezhang commented Sep 16, 2024

Prevent fatal errors.

Hello!

In raising this pull request, I confirm the following:

  • I have read and understood the Contributing Guidelines
  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • I have updated the relevant CHANGELOG
  • I have created a PR for the documentation about this change

Small description of change:
Steps to Reproduce:

  1. Form:
$this->add(
            (new File('file',['required' => true]))
                ->setLabel('Attach sample op-ed(available format:pdf,text,word):')
                ->addValidators([
                    new PresenceOf([
                        'message' => 'please upload an op-ed file',
                    ]),
                    new MimeType([
                        "types" => [
                            'application/pdf',
                            'application/msword',
                            'application/rtf',
                            'application/epub+zip',
                            'text/plain',
                        ],
                        "message" => "Allowed file types are :types"
                    ]),
                   new Max([
                        "size"     => "2M",
                        "included" => true,
                        "message"  => ":field exceeds the max size (:size)",
                    ])
                ])
        );
        
  Error: Fatal error: Uncaught ValueError: finfo_file(): Argument #1 ($finfo) cannot be empty in      

Thanks

@niden niden changed the base branch from master to 5.0.x September 16, 2024 16:48
@niden niden added bug A bug report status: medium Medium 5.0 The issues we want to solve in the 5.0 release labels Sep 16, 2024
@niden niden merged commit 04edb15 into phalcon:5.0.x Sep 16, 2024
43 checks passed
@niden
Copy link
Sponsor Member

niden commented Sep 16, 2024

Thank you @zikezhang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants