Skip to content

PHP8 - Segfault when using reflection and having a method parameter type ::Const #531

Open
@gnat42

Description

@gnat42

Hello,

I've had an extension that for awhile has a method where I've had the following code:

object.method<&ClassName::toImage>("toImage", Php::Public, {
            Php::ByVal("format", Php::Type::Const), //<-- This is the problem - and likely my fault. 
            Php::ByVal("output", Php::Type::String),
            Php::ByVal("dpi", Php::Type::Numeric, false)
        });

This compiles fine because the callable.h fill() has a default block when figuring out what the type of an argument should be. Allowing ::Const as a type here is likely incorrect (though with 8.3 you can type hint an constant Enum) - though I don't think php-cpp supports that type yet.

I'm not sure what the correct solution should be. I'm wondering if I'm correct in thinking that my original code was always wrong. If so, can we protect others from making this error? put a Const case in the fill method that throws an exception or something like that? I can submit a PR but just wanted to fully understand the issue.

This is the ticket I mentioned I'd file in #530

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions