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

Whitelist functions as soon as they are used #269

Merged
merged 2 commits into from
Oct 24, 2018

Conversation

theofidry
Copy link
Member

Previously, if you had the following code:

namespace Acme;

if (function_exists('foo')) {
    \foo();
}

with foo being in the whitelist, the function would have not been whitelisted. The reasoning was that the recording of whitelisted elements was the same for functions and classes. For classes, it makes sense since the whitelisting will not work if the whitelisted class declaration is not found, however this is not the case for functions since the declaration dumped in the scoper-autoload.php is sufficient.

With this PR, the function foo above is now prefixed, which should allow cases like this one to work out of the box, either by whitelisting the global functions or by manually whitelisting it.

@theofidry theofidry merged commit c800372 into humbug:master Oct 24, 2018
@theofidry theofidry deleted the bugfix/func-whitelist branch October 24, 2018 11:57
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