-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Parameter skipping in function calls #426
Conversation
} else { | ||
/* optional arg - just skip it */ | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several issues here:
- In the else case the code just continues without incrementing i, type_spec or fetching the respective va_arg(s)
- In the if case arg is set to a stack value which is a pointer to yet another stack value and both of those are in the if branch, so they won't exist after it is left.
- I get a warning for the
={0}
initialization here. MaybeINIT_PZVAL
instead?
Another consideration: Can it happen that the NULL zval create here will be modified in the arg_impl to some other type (that requires freeing?)
(I''m not sure where this should be discussed) function myfunc($p1, $p2 = 2, $p3 = 3) {}; you would normally be happy to call that like this: myfunc('abc'); so I think this: myfunc('abc', , 1); is more concise and more readable than: myfunc('abc', default, 1); as it's far less likely to be confused with: myfunc('abc', $default, 1); |
Stas, After a long period of silence (last message around january 2013) on @Internals regarding this RFC, is there any chance this can be resurrected into existence? And by resurrecting i do hope the original ("default") way of utilizing this. Thanks! |
👍 |
I would expect
|
@fruitl00p I think it can be revived, but it needs to be reconciled with phpng changes, so it'll take some time and I'd need to find that time to do the necessary change. I hope I will be able too soon. |
@smalyshev Thanks for the quick update. I have a vague idea how busy you are, no worries. Just don't want this to be lost in the anals of history ;) Thanks again for the great work! (if only i had some C knowledge to be able to contribute) |
Replaced by #981 |
See: https://wiki.php.net/rfc/skipparams