Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

devnexen
Copy link
Member

No description provided.

Copy link
Member

@Girgias Girgias left a 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;
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Comment on lines 6 to 8
<?php
try {
socket_addrinfo_lookup('127.0.0.1', 2000, array(
Copy link
Member

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?

@devnexen devnexen force-pushed the socket_addrinfo_exception branch from 470b6ed to 41a03c3 Compare January 2, 2025 12:56
@devnexen devnexen closed this in b7c76de Jan 2, 2025
devnexen added a commit to devnexen/php-src that referenced this pull request Jan 2, 2025
devnexen added a commit to devnexen/php-src that referenced this pull request Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants