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

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

Open
gnat42 opened this issue May 2, 2024 · 0 comments

Comments

@gnat42
Copy link
Contributor

gnat42 commented May 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant