~hexmode/ubuntu/lucid/php5/php5.fix-php-bug-33210

« back to all changes in this revision

Viewing changes to ext/sockets/tests/socket_getpeername_ipv6loop.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-11-06 01:44:25 UTC
  • mfrom: (1.1.15 upstream) (0.3.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091106014425-5dsqjhbg303h3kfn
Tags: 5.2.11.dfsg.1-1ubuntu1
* Merge from debian testing, remaining changes:
  - debian/control, debian/rules: Disable a few build dependencies and
    accompanying, binary packages which we do not want to support in main:
    + firebird2-dev/php5-interbase (we have a seperate php-interbase source)
    + libc-client/php5-imap (we have a seperate php-imap source)
    + libmcrypt-dev/php5-mcrypt (seperate php-mycrpt source)
    + readline support again, now that the libedit issue is fixed.
  - debian/control: Add build dependency: libdedit-dev (>= 2.9.cvs.20050518-1)
    CLI readline support.
  - debian/rules:
    + Correctly mangle PHP5_* macros for lpia
  - debian/control:
    + Use libdb-4.6-dev.
    + Rename Vcs-Browser & Vcs-Git to XS-Original-Vcs-Browser & XS-Original-Vcs-Git (LP: #323731).
  - Dropped patches:
    - debian/patches/119-sybase-alias.patch: Use Debian's patch.
    - debian/patches/fix-autoconf-ftbfs.patch: Use Debian's patch
    - debian/patches/fix-zlib-decompression: Already in upstream
  - Use the default pear/install-pear-nozlib.phar in php 5.2.11
  - debian/control: Move php5-suhoshin to Suggests.
  - debian/rules: Fix broken symlink for pear.
  - Dropped dependency on autoconf2.13.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
ext/sockets - socket_getpeername_ipv6loop - basic test
 
3
--CREDITS--
 
4
# TestFest 2009 - NorwayUG
 
5
# $Id: socket_getpeername_ipv6loop.phpt 494 2009-06-09 20:38:05Z tatjana.andersen@redpill-linpro.com $
 
6
--SKIPIF--
 
7
<?php   
 
8
        if (!extension_loaded('sockets')) {
 
9
                die('skip sockets extension not available.');
 
10
        }
 
11
?>
 
12
--FILE--
 
13
<?php   
 
14
        /* Bind and connect sockets to localhost */
 
15
        $localhost = '::1';
 
16
 
 
17
        /* Hold the port associated to address */
 
18
        $port = 31337;
 
19
        
 
20
        /* Setup socket server */
 
21
        $server = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
 
22
        if (!$server) {
 
23
                die('Unable to create AF_INET6 socket [server]');
 
24
        }
 
25
        
 
26
        if (!socket_bind($server, $localhost, $port)) {
 
27
                die('Unable to bind to '.$localhost.':'.$port);
 
28
        }
 
29
        if (!socket_listen($server, 2)) {
 
30
                die('Unable to listen on socket');
 
31
        }
 
32
 
 
33
        /* Connect to it */
 
34
        $client = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
 
35
        if (!$client) {
 
36
                die('Unable to create AF_INET6 socket [client]');
 
37
        }
 
38
        if (!socket_connect($client, $localhost, $port)) {
 
39
                die('Unable to connect to server socket');
 
40
        }
 
41
 
 
42
        /* Accept that connection */
 
43
        $socket = socket_accept($server);
 
44
        if (!$socket) {
 
45
                die('Unable to accept connection');
 
46
        }
 
47
 
 
48
        if (!socket_getpeername($client, $address, $port)) {
 
49
                die('Unable to retrieve peer name');
 
50
        }
 
51
        var_dump($address, $port);
 
52
 
 
53
        socket_close($client);
 
54
        socket_close($socket);
 
55
        socket_close($server);
 
56
?>
 
57
--EXPECT--
 
58
string(3) "::1"
 
59
int(31337)