Skip getservbyname() and getservbyport() tests on *nix if there is
no /etc/services file.

Closes GH-6191.
This commit is contained in:
Matthias Karbe 2020-09-23 14:25:30 +02:00 committed by Nikita Popov
parent 035ad0aed5
commit 2899137391
3 changed files with 18 additions and 0 deletions

View File

@ -5,6 +5,12 @@ Italian PHP TestFest 2009 Cesena 19-20-21 june
Fabio Fabbrucci (fabbrucci@grupporetina.com)
Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
--SKIPIF--
<?php
if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
if (!file_exists("/etc/services")) die("skip reason: missing /etc/services");
}
?>
--FILE--
<?php

View File

@ -5,6 +5,12 @@ Italian PHP TestFest 2009 Cesena 19-20-21 june
Fabio Fabbrucci (fabbrucci@grupporetina.com)
Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
--SKIPIF--
<?php
if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
if (!file_exists("/etc/services")) die("skip reason: missing /etc/services");
}
?>
--FILE--
<?php
if (file_exists("/etc/services")) {

View File

@ -7,6 +7,12 @@ Italian PHP TestFest 2009 Cesena 19-20-21 june
Fabio Fabbrucci (fabbrucci@grupporetina.com)
Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
--SKIPIF--
<?php
if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
if (!file_exists("/etc/services")) die("skip reason: missing /etc/services");
}
?>
--FILE--
<?php
var_dump(getservbyport( -1, "tcp" ));