1--TEST--
2Test function getservbyport() by calling it more than or less than its expected arguments
3--DESCRIPTION--
4Test function passing invalid port number and invalid protocol name
5--CREDITS--
6Italian PHP TestFest 2009 Cesena 19-20-21 june
7Fabio Fabbrucci (fabbrucci@grupporetina.com)
8Michele Orselli (mo@ideato.it)
9Simone Gentili (sensorario@gmail.com)
10--SKIPIF--
11<?php
12if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
13    if (!file_exists("/etc/services")) die("skip reason: missing /etc/services");
14}
15if (getenv('SKIP_MSAN')) die('skip msan missing interceptor for getservbyport()');
16?>
17--FILE--
18<?php
19    var_dump(getservbyport( -1, "tcp" ));
20    var_dump(getservbyport( 80, "ppp" ));
21    var_dump(getservbyport( null, null));
22    var_dump(getservbyport( 2, 2));
23    var_dump(getservbyport( "80", "tcp"));
24
25?>
26--EXPECTF--
27bool(false)
28bool(false)
29bool(false)
30bool(false)
31string(%d) "%s"
32