-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ext/socket: socket_addrinfo_lookup check hints array.
close GH-17300
- Loading branch information
Showing
4 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--TEST-- | ||
socket_addrinfo_lookup with invalid hints | ||
--EXTENSIONS-- | ||
sockets | ||
--FILE-- | ||
<?php | ||
try { | ||
socket_addrinfo_lookup('127.0.0.1', 2000, array( | ||
'ai_family' => new stdClass(), | ||
'ai_socktype' => SOCK_DGRAM, | ||
'ai_flags' => 0, | ||
'ai_protocol' => 0, | ||
)); | ||
} catch (\TypeError $e) { | ||
echo $e->getMessage() . PHP_EOL; | ||
} | ||
try { | ||
socket_addrinfo_lookup('127.0.0.1', 2000, array( | ||
'ai_family' => AF_INET, | ||
'ai_socktype' => new stdClass(), | ||
'ai_flags' => 0, | ||
'ai_protocol' => 0, | ||
)); | ||
} catch (\TypeError $e) { | ||
echo $e->getMessage() . PHP_EOL; | ||
} | ||
try { | ||
socket_addrinfo_lookup('127.0.0.1', 2000, array( | ||
'ai_family' => AF_INET, | ||
'ai_socktype' => SOCK_DGRAM, | ||
'ai_flags' => new stdClass(), | ||
'ai_protocol' => 0, | ||
)); | ||
} catch (\TypeError $e) { | ||
echo $e->getMessage() . PHP_EOL; | ||
} | ||
try { | ||
socket_addrinfo_lookup('127.0.0.1', 2000, array( | ||
'ai_family' => AF_INET, | ||
'ai_socktype' => SOCK_DGRAM, | ||
'ai_flags' => 0, | ||
'ai_protocol' => new stdClass(), | ||
)); | ||
} catch (\TypeError $e) { | ||
echo $e->getMessage() . PHP_EOL; | ||
} | ||
?> | ||
--EXPECT-- | ||
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_family" key must be of type int, stdClass given | ||
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_socktype" key must be of type int, stdClass given | ||
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_flags" key must be of type int, stdClass given | ||
socket_addrinfo_lookup(): Argument #3 ($hints) "ai_protocol" key must be of type int, stdClass given |