Skip to content

Fix ReflectionMethod invocation of protected method for PHP 7.4 & PHP 8.0 compatibility#18

Open
Saggre wants to merge 1 commit into
Custobar:masterfrom
Saggre:feature/set-reflection-method-accessibility
Open

Fix ReflectionMethod invocation of protected method for PHP 7.4 & PHP 8.0 compatibility#18
Saggre wants to merge 1 commit into
Custobar:masterfrom
Saggre:feature/set-reflection-method-accessibility

Conversation

@Saggre

@Saggre Saggre commented Jun 18, 2025

Copy link
Copy Markdown

In PHP 8.1+, it's possible to invoke protected methods through ReflectionMethod->invoke() without calling setAccessible(true).

However, in earlier versions, this results in the following error: Trying to invoke protected method WooCommerceCustobar\DataSource\Abstract_Data_Source::get_default_keys() from scope ReflectionMethod at classes/data-sources/abstract-data-source.php:44

@Saggre Saggre changed the title Fix ReflectionMethod invocation of protected method for PHP 7.4 compatibility Fix ReflectionMethod invocation of protected method for PHP 7.4 & PHP 8.0 compatibility Jun 18, 2025
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.

1 participant