Skip to content

Commit e4cfd18

Browse files
committed
update tests
1 parent 12c5114 commit e4cfd18

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

ext/posix/posix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ PHP_FUNCTION(posix_mknodat)
13891389
#ifdef HAVE_MAKEDEV
13901390
php_dev = makedev(major, minor);
13911391
#else
1392-
zend_value_error("Cannot create a block or character device, creating a normal file instead");
1392+
php_error_docref(NULL, E_WARNING, "Cannot create a block or character device, creating a normal file instead");
13931393
#endif
13941394
}
13951395
}

ext/posix/tests/posix_mknodat_mkfifoat.phpt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ posix_mknodat/posix_mkfifoat support
44
posix
55
--SKIPIF--
66
<?php
7-
if (!function_exists('posix_mknodat')) die('skip posix_mknodat() not found');
7+
// usually, mkfifoat is implemented with mknodat
8+
if (!function_exists('posix_mknodat') || !function_exists('posix_mkfifoat')) die('skip posix_mknodat()/posix_mkfifoat not found');
89
?>
910
--FILE--
1011
<?php
1112

1213
$fd = fopen(__DIR__, "r");
14+
var_dump(posix_mknodat($fd, 'dev', POSIX_S_IFIFO | 0666, 1, 0));
1315
var_dump(posix_mknodat($fd, '', POSIX_S_IFBLK | 0777, 1, 0));
1416
var_dump(posix_mknodat($fd, __DIR__ . '', POSIX_S_IFBLK | 0777, 1, 0));
1517
try {
@@ -22,14 +24,20 @@ var_dump(posix_mkfifoat($fd, __DIR__ . '', POSIX_S_IFBLK | 0777));
2224
try {
2325
posix_mkfifoat(new stdClass(), '/dev/', POSIX_S_IFBLK | 0777);
2426
} catch (TypeError $e) {
25-
echo $e->getMessage();
27+
echo $e->getMessage() . PHP_EOL;
2628
}
29+
@unlink(__DIR__ . '/dev');
30+
var_dump(posix_mkfifoat($fd, 'dev', POSIX_S_IFIFO | 0666));
2731
fclose($fd);
32+
@unlink(__DIR__ . '/dev');
2833
?>
2934
--EXPECT--
35+
bool(true)
3036
bool(false)
3137
bool(false)
3238
posix_mknodat(): Argument #4 ($major) cannot be 0 for the POSIX_S_IFCHR and POSIX_S_IFBLK modes
3339
bool(false)
3440
bool(false)
3541
posix_mkfifoat(): Argument #1 ($file_descriptor) must be of type int|resource, stdClass given
42+
bool(true)
43+

0 commit comments

Comments
 (0)