Skip to content

Commit 9c7c9d1

Browse files
committed
FTOK
1 parent b59e69d commit 9c7c9d1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

ext/standard/ftok.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ PHP_FUNCTION(ftok)
4141
ZEND_PARSE_PARAMETERS_END();
4242

4343
if (pathname_len == 0){
44-
php_error_docref(NULL, E_WARNING, "Pathname is invalid");
45-
RETURN_LONG(-1);
44+
zend_argument_value_error(1, "cannot be empty");
45+
RETURN_THROWS();
4646
}
4747

4848
if (proj_len != 1){

ext/sysvshm/tests/001.phpt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ if (!function_exists('ftok')){ print 'skip'; }
77
?>
88
--FILE--
99
<?php
10-
11-
var_dump(ftok("",""));
10+
try {
11+
var_dump(ftok("",""));
12+
} catch (\ValueError $e) {
13+
echo $e->getMessage() . \PHP_EOL;
14+
}
1215
var_dump(ftok(-1, -1));
1316
var_dump(ftok("qwertyu","qwertyu"));
1417

@@ -19,8 +22,7 @@ var_dump(ftok(__FILE__,"q"));
1922
echo "Done\n";
2023
?>
2124
--EXPECTF--
22-
Warning: ftok(): Pathname is invalid in %s on line %d
23-
int(-1)
25+
ftok(): Argument #1 ($pathname) cannot be empty
2426

2527
Warning: ftok(): Project identifier is invalid in %s on line %d
2628
int(-1)

0 commit comments

Comments
 (0)