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

Avoid using the Reflection API for some classes #66

Closed
wants to merge 1 commit into from

Conversation

brettmc
Copy link
Contributor

@brettmc brettmc commented Jun 21, 2024

Since sebastian/exporter 6.0.3, my tests started to cause a segfault. I tracked this down to cb81155 which uses Reflection to count an object's properties. Some of my tests use a data provider which contains protobuf messages, and somewhere in phpunit's test setup, it triggers this code on the dataProvider's provided data.

Unfortunately using reflection on some parts of ext-protobuf cause a segfault (which can easily be replicated outside of phpunit). It's a long-standing issue in ext-protobuf, and I think it's a "won't fix".

So, I am hoping that by avoiding reflection only on known bad classes, we can still have the performance benefits without the exploding tests :)

if a class has problems with Reflection, then fall back to the old toArray
method of counting its properties. For example, using reflection on an ext-protobuf
Message causes a segfault
@sebastianbergmann sebastianbergmann changed the title avoid using Reflection for some classes Avoid using the Reflection API for some classes Jun 21, 2024
@sebastianbergmann
Copy link
Owner

Merged manually, thanks.

@brettmc brettmc deleted the reflection-segfault branch June 21, 2024 06:10
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

Successfully merging this pull request may close these issues.

2 participants