Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/standard/fsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
efree(hashkey);
}

zend_argument_value_error(6, "must be -1 or between 0 and " ZEND_ULONG_FMT, ((double) PHP_TIMEOUT_ULL_MAX / 1000000.0));
zend_argument_value_error(5, "must be -1 or between 0 and " ZEND_ULONG_FMT, ((double) PHP_TIMEOUT_ULL_MAX / 1000000.0));
RETURN_THROWS();
} else {
#ifndef PHP_WIN32
Expand Down
19 changes: 19 additions & 0 deletions ext/standard/tests/network/fsockopen_timeout_out_of_range.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
fsockopen() and pfsockopen(): ValueError for $timeout reports correct argument number and name
--FILE--
<?php
try {
fsockopen('localhost', 80, $errno, $errstr, -2.0);
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}

try {
pfsockopen('localhost', 80, $errno, $errstr, -2.0);
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
fsockopen(): Argument #5 ($timeout) must be -1 or between 0 and %s
pfsockopen(): Argument #5 ($timeout) must be -1 or between 0 and %s
Loading