Skip to content

ext/gd: Return type violation in imagefilter when an invalid filter is provided #20070

Description

@Girgias

Description

The following code:

<?php
$image = imagecreatetruecolor(180, 30);

try {
    var_dump(imagefilter($image, -1));
} catch (Throwable $e) {
    echo $e::class, ': ', $e->getMessage(), "\n";
}

Resulted in this output:

Fatal error: imagefilter(): Return value must be of type bool, null returned in Unknown on line 0

But I expected this output instead:

ValueError: imagefilter(): Argument #2 ($filter) must be a valid filter

Found by just staring at the code when double-checking #20066

PHP Version

latest

Operating System

No response

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions