1--TEST--
2Test function getservbyname()
3--CREDITS--
4Italian PHP TestFest 2009 Cesena 19-20-21 june
5Fabio Fabbrucci (fabbrucci@grupporetina.com)
6Michele Orselli (mo@ideato.it)
7Simone Gentili (sensorario@gmail.com)
8--SKIPIF--
9<?php
10if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
11    if (!file_exists("/etc/services")) die("skip reason: missing /etc/services");
12}
13if (getenv('SKIP_MSAN')) die('skip msan missing interceptor for getservbyname()');
14?>
15--FILE--
16<?php
17
18    $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', 'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www');
19
20    foreach ($services as $service) {
21            $port = getservbyname($service, 'tcp');
22            var_dump($port);
23    }
24
25
26?>
27--EXPECTF--
28int(%d)
29int(%d)
30int(%d)
31int(%d)
32int(%d)
33int(%d)
34int(%d)
35int(%d)
36int(%d)
37int(%d)
38int(%d)
39