Skip to content

Bug: max_dims validation error with SVG files #8591

Description

@jordigarciaemexs

PHP Version

8.1, 8.2

CodeIgniter4 Version

4.2.6

CodeIgniter4 Installation Method

Manual (zip or tar.gz)

Which operating systems have you tested for this bug?

macOS, Windows, Linux

Which server did you use?

apache

Database

MySQL 5.6

What happened?

When you try to use the Validation library, with an SVG image plus the max_dims rule, the function getimagesize tries to get the dimensions of the SVG image, but there are no dimensions for that type.

That returns a Trying to access array offset on value of type bool error in the line 245 in the FileRules.php file.

Steps to Reproduce

Upload an SVG using the form validation rules with mime_in accepting SVG type and max_dims set.

Expected Output

The function detects if there are dimensions in the uploaded image and if not, skip the getimagesize check.

Anything else?

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions