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

really disable risky functions #19

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

remicollet
Copy link

@remicollet remicollet commented Sep 21, 2020

Ready for review

Tested with PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4 and 8.0.0beta4

@remicollet remicollet changed the title really disable risky functions (PHP 7) really disable risky functions Sep 22, 2020
@remicollet
Copy link
Author

Copy link
Owner

@Whissi Whissi left a comment

Choose a reason for hiding this comment

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

Good catch & thank you for looking into this.

I have a question because the PR seems to hardcode disabled functions, see inline comment.

realpath_turbo.c Outdated
@@ -118,6 +113,12 @@ PHP_RINIT_FUNCTION(realpath_turbo)

PHP_MINIT_FUNCTION(realpath_turbo)
{
#if PHP_MAJOR_VERSION < 8
zend_disable_function("link", sizeof("link")-1 TSRMLS_CC);
Copy link
Owner

Choose a reason for hiding this comment

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

I am wondering about this change. Looks like we would now always disable these functions...

Copy link
Author

Choose a reason for hiding this comment

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

I have add a test for this.

Copy link
Author

Choose a reason for hiding this comment

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

In short, function from configuration are disabled at PHP startup, additional ones by the plugin during MINIT.

The ini stuff is only useful if some user check configuration, for consistency

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I don't read enough your question...

Looks like we would now always disable these functions...

Indeed... grr

Copy link
Author

Choose a reason for hiding this comment

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

Should be ok now, + new test

@remicollet
Copy link
Author

@Whissi FYI, this package was requested by user of my repository, the reason why I look a bit on it
(I don't use it myself)

See https://blog.remirepo.net/pages/PECL-extensions-RPM-status
And https://forum.remirepo.net/viewtopic.php?id=4043

@@ -2,9 +2,11 @@
#include "realpath_turbo_private.h"

static zend_function_entry realpath_turbo_functions[] = {
{NULL, NULL, NULL}
PHP_FE_END
Copy link
Author

Choose a reason for hiding this comment

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

exists since 7.3.7

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.

None yet

2 participants