Annotation of embedaddon/php/ext/standard/tests/general_functions/getservbyport_basic.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test function getservbyport() by calling it more than or less than its expected arguments
3: --CREDITS--
4: Italian PHP TestFest 2009 Cesena 19-20-21 june
5: Fabio Fabbrucci (fabbrucci@grupporetina.com)
6: Michele Orselli (mo@ideato.it)
7: Simone Gentili (sensorario@gmail.com)
8: --FILE--
9: <?php
1.1.1.2 ! misho 10: if (file_exists("/etc/services")) {
! 11: $file = "/etc/services";
! 12: }
1.1 misho 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--
27: PASS
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>