1--TEST--
2Test function getservbyport() by calling it more than or less than its expected arguments
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--FILE--
9<?php
10	if (file_exists("/etc/services")) {
11		$file = "/etc/services";
12	}
13	elseif(substr(PHP_OS,0,3) == "WIN") $file = "C:/WINDOWS/system32/drivers/etc/services";
14	else die(PHP_OS. " unsupported");
15
16	if(file_exists($file)){
17		$services = file_get_contents($file);
18                $service = getservbyport( 80, "tcp" );
19                if(preg_match("/$service\s+80\/tcp/", $services)) {
20			echo "PASS\n";
21		}
22	}else{
23		echo "Services file not found in expected location\n";
24	}
25?>
26--EXPECT--
27PASS
28