Skip to content

Make mysqli_warning constructor private #6208

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

Closed
wants to merge 1 commit into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Sep 24, 2020

The constructor was already effectively inaccessible (protected
on a final class). This just makes it more obvious and removes
the implementation in favor of directly throwing.

Per the removed test, this was an unfinished feature, and I don't
think it makes a lot of sense to finish it -- the
mysqli_stmt::get_warnings() interface makes more sense than
direct construction.

}
} else {
php_error_docref(NULL, E_WARNING, "Invalid class argument");
RETURN_FALSE;
Copy link
Member Author

Choose a reason for hiding this comment

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

The warning + return false is how I got here ... a constructor is not allowed to return false.

The constructor was already effectively inaccessible (protected
on a final class). This just makes it more obvious and removes
the implementation in favor of directly throwing.

Per the removed test, this was an unfinished feature, and I don't
think it makes a lot of sense to finish it -- the
mysqli_stmt::get_warnings() interface makes more sense than
direct construction.
@nikic nikic force-pushed the mysqli-warning-ctor branch from b0465d6 to aa12842 Compare September 27, 2020 19:34
@php-pulls php-pulls closed this in 8138ed7 Sep 27, 2020
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