diff options
author | Fabien Villepinte <fabien.villepinte@gmail.com> | 2019-10-05 14:26:33 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-10-08 18:20:13 +0200 |
commit | 8b5c351154284a88152ee3d166a32dc77316a658 (patch) | |
tree | e38e10fe7b65983618ae29a290adea19a97f005d /ext/sockets | |
parent | bea832cbf6b7a06ee65b93902233864c1ac9ec98 (diff) | |
download | php-git-8b5c351154284a88152ee3d166a32dc77316a658.tar.gz |
Avoid file clash in root_check skipifs
Extract root check into skipif_root.inc to share this commonly
repeated logic.
Closes GH-4779.
Diffstat (limited to 'ext/sockets')
-rw-r--r-- | ext/sockets/tests/socket_create_listen-nobind.phpt | 8 | ||||
-rw-r--r-- | ext/sockets/tests/socket_set_option_error_socket_option.phpt | 8 |
2 files changed, 6 insertions, 10 deletions
diff --git a/ext/sockets/tests/socket_create_listen-nobind.phpt b/ext/sockets/tests/socket_create_listen-nobind.phpt index 81e7297339..d6a9a767a3 100644 --- a/ext/sockets/tests/socket_create_listen-nobind.phpt +++ b/ext/sockets/tests/socket_create_listen-nobind.phpt @@ -5,13 +5,14 @@ Test if socket_create_listen() returns false, when it cannot bind to the port. if (!extension_loaded('sockets')) { die('SKIP The sockets extension is not loaded.'); } -$filename = __DIR__ . '/006_root_check.tmp'; +$filename = __FILE__ . '.root_check.tmp'; $fp = fopen($filename, 'w'); fclose($fp); if (fileowner($filename) == 0) { - unlink ($filename); + unlink($filename); die('SKIP Test cannot be run as root.'); } +unlink($filename); if (@socket_create_listen(80)) { die('SKIP Test cannot be run in environment that will allow binding to port 80 (azure)'); } @@ -20,9 +21,6 @@ if (@socket_create_listen(80)) { $sock = socket_create_listen(80); --EXPECTF-- Warning: socket_create_listen(): unable to bind to given address [13]: Permission denied in %s on line %d ---CLEAN-- -<?php -unlink(__DIR__ . '/006_root_check.tmp'); --CREDITS-- Till Klampaeckel, till@php.net PHP Testfest Berlin 2009-05-09 diff --git a/ext/sockets/tests/socket_set_option_error_socket_option.phpt b/ext/sockets/tests/socket_set_option_error_socket_option.phpt index 18afcc8fb1..53d76fa4c1 100644 --- a/ext/sockets/tests/socket_set_option_error_socket_option.phpt +++ b/ext/sockets/tests/socket_set_option_error_socket_option.phpt @@ -8,13 +8,14 @@ if (!extension_loaded('sockets')) { if (PHP_OS == 'Darwin') { die('skip Not for OSX'); } -$filename = __DIR__ . '/006_root_check.tmp'; +$filename = __FILE__ . '.root_check.tmp'; $fp = fopen($filename, 'w'); fclose($fp); if (fileowner($filename) == 0) { - unlink ($filename); + unlink($filename); die('SKIP Test cannot be run as root.'); } +unlink($filename); ?> --FILE-- <?php @@ -26,9 +27,6 @@ if (!$socket) { socket_set_option( $socket, SOL_SOCKET, 1, 1); socket_close($socket); ?> ---CLEAN-- -<?php -unlink(__DIR__ . '/006_root_check.tmp'); --EXPECTF-- Warning: socket_set_option(): unable to set socket option [%d]: Permission denied in %s on line %d --CREDITS-- |