-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/socket: socket_addrinfo_lookup check hints array. #17300
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
Conversation
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.
Minor nits, but LGTM
zend_argument_type_error(3, "\"ai_flags\" key must be of type int, %s given", zend_zval_type_name(hint)); | ||
RETURN_THROWS(); | ||
} | ||
hints.ai_flags = (int)val; |
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.
Probably there should be a range check to see if the val can fit in a C int, but I'm happy to leave this for a follow-up PR
zend_argument_type_error(3, "\"ai_socktype\" key must be of type int, %s given", zend_zval_type_name(hint)); | ||
RETURN_THROWS(); | ||
} | ||
hints.ai_socktype = (int)val; |
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.
Ditto
zend_argument_type_error(3, "\"ai_protocol\" key must be of type int, %s given", zend_zval_type_name(hint)); | ||
RETURN_THROWS(); | ||
} | ||
hints.ai_protocol = (int)val; |
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.
ditto
zend_argument_type_error(3, "\"ai_family\" key must be of type int, %s given", zend_zval_type_name(hint)); | ||
RETURN_THROWS(); | ||
} | ||
hints.ai_family = (int)val; |
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.
ditto
<?php | ||
try { | ||
socket_addrinfo_lookup('127.0.0.1', 2000, array( |
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.
Why is the whole test indented?
470b6ed
to
41a03c3
Compare
No description provided.