Skip to content

Use zend_call_known_function() to call #[\SensitiveParameter]’s constructor - #14254

Merged
TimWolla merged 1 commit into
php:masterfrom
TimWolla:sensitive-parameter-construct
May 16, 2024
Merged

Use zend_call_known_function() to call #[\SensitiveParameter]’s constructor#14254
TimWolla merged 1 commit into
php:masterfrom
TimWolla:sensitive-parameter-construct

Conversation

@TimWolla

Copy link
Copy Markdown
Member

zend_call_method_with_1_params() causes needless overhead, due to the capability of looking up the function by name. It’s also very rarely used (only in ext/spl).

zend_call_known_function() is the standard methodology to call a known function and going through Z_OBJCE_P() avoids the repeated hardcoding of the CE name.

…onstructor
`zend_call_method_with_1_params()` causes needless overhead, due to the
capability of looking up the function by name. It’s also very rarely used (only
in ext/spl).
`zend_call_known_function()` is the standard methodology to call a known
function and going through `Z_OBJCE_P()` avoids the repeated hardcoding of the
CE name.

@iluuu1994iluuu1994 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think no lookup by name happens, because you're passing fn_proxy with an already set value. Even so, zend_call_known_function avoids one useless level of indirection.

@TimWolla

Copy link
Copy Markdown
MemberAuthor

I think no lookup by name happens, because you're passing fn_proxy with an already set value.

Correct, but that's unnecessary if() branches for the theoretical support of it (including the ugly double-pointer parameter) 😄

@TimWolla
TimWolla merged commit 4988816 into php:masterMay 16, 2024
@TimWolla
TimWolla deleted the sensitive-parameter-construct branch May 16, 2024 21:23
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@TimWolla@iluuu1994