~ubuntu-branches/ubuntu/raring/php5/raring

« back to all changes in this revision

Viewing changes to ext/snmp/tests/snmp2_real_walk.phpt

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-18 16:10:26 UTC
  • mfrom: (1.1.24) (0.3.58 sid)
  • Revision ID: package-import@ubuntu.com-20120618161026-hg1fc5r9z1a4hlqz
Tags: 5.4.4-1ubuntu1
* Merge from Debian unstable. Remaining changes:
  - d/rules: Simplify apache config settings since we never build 
    interbase or firebird.
  - debian/rules: export DEB_HOST_MULTIARCH properly.
  - Add build-dependency on lemon, which we now need.
  - Dropped firebird2.1-dev, libc-client-dev, libmcrypt-dev as it is in universe.
  - Dropped libcurl-dev not in the archive.
  - debian/control: replace build-depends on mysql-server with
    mysql-server-core-5.5 and mysql-client-5.5 to avoid upstart and
    mysql-server-5.5 postinst confusion with starting up multiple
    mysqlds listening on the same port.
  - Dropped php5-imap, php5-interbase, php5-mcrypt since we have versions
    already in universe.
  - Dropped libonig-dev and libqgdbm since its in universe. (libonig MIR
    has been declined due to an inactive upstream. So this is probably
    a permanent change).
  - modulelist: Drop imap, interbase, sybase, and mcrypt.
  - debian/rules:
    * Dropped building of mcrypt, imap, and interbase.
    * Install apport hook for php5.
    * stop mysql instance on clean just in case we failed in tests
* Dropped Changes:
  * d/rules: enable Suhosin patch with PHP5_SUHOSIN=yes -- Upstream suhosin
    has been slow to adopt PHP 5.4, and is showing signs of disengagement.
    Therefore, we will follow Debian's lead and drop Suhosin for now.
  - d/control: build-depend on mysql 5.5 instead of 5.1 for running tests.
    -- Debian just deps on mysql-server
  - Suggest php5-suhosin rather than recommends. -- Dropping suhosin
  - d/setup-mysql.sh: modify to work with mysql 5.5 differences -- superseded
    in Debian.
  - Only build php5-sqlite for sqlite3, dropping the obsolete sqlite2. --
    superseded in Debian
  - d/maxlifetime: Improve maxlifetime script to scan for more SAPIs and 
    scan all *.ini in conf.d directory. -- Change came from Debian
  - d/libapache2-mod-php5.postinst,libapache2-mod-php5filter.postinst: 
    Restart apache on first install to ensure module is fully enabled.
    -- Change came from Debian
  - debian/patches/php5-CVE-2012-1823.patch: filter query strings that
    are prefixed with '-' -- Fixed upstream
  - debian/control: Recommend php5-dev for php-pear. -- This was a poorly
    conceived idea anyway.
  - Pre-Depend on a new enough version of dpkg for dpkg-maintscript-helper
    rather than checking whether it exists at run-time, leading to more
    predictable behaviour on upgrades. -- Applied in Debian
  - d/p/gd-multiarch-fix.patch: superseded
* d/NEWS: add note explaining that SUHOSIN is no longer enabled in the
  Ubuntu packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--                                 
 
2
Function snmp2_real_walk
 
3
--CREDITS--
 
4
Olivier Doucet Olivier Doucet Boris Lytochkin
 
5
--SKIPIF--
 
6
<?php
 
7
require_once(dirname(__FILE__).'/skipif.inc');
 
8
?>
 
9
--FILE--
 
10
<?php
 
11
require_once(dirname(__FILE__).'/snmp_include.inc');
 
12
 
 
13
//EXPECTF format is quickprint OFF
 
14
snmp_set_quick_print(false);
 
15
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
 
16
 
 
17
echo "Checking error handling\n";
 
18
var_dump(snmp2_real_walk($hostname, $community, '.1.3.6.1.2.1.1', ''));
 
19
var_dump(snmp2_real_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, ''));
 
20
 
 
21
echo "Checking working\n";
 
22
echo "Single OID\n";
 
23
$return = snmp2_real_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
 
24
var_dump(gettype($return));
 
25
var_dump(sizeof($return));
 
26
var_dump(key($return));
 
27
var_dump(array_shift($return));
 
28
 
 
29
echo "Single OID in array\n";
 
30
$return = snmp2_real_walk($hostname, $community, array('.1.3.6.1.2.1.1'), $timeout, $retries);
 
31
var_dump(gettype($return));
 
32
var_dump(sizeof($return));
 
33
var_dump(key($return));
 
34
var_dump(array_shift($return));
 
35
 
 
36
echo "More error handling\n";
 
37
echo "Multiple correct OID\n";
 
38
$return = snmp2_real_walk($hostname, $community, array('.1.3.6.1.2.1.1', '.1.3.6'), $timeout, $retries);
 
39
var_dump($return);
 
40
 
 
41
echo "Multiple OID with wrong OID\n";
 
42
$return = snmp2_real_walk($hostname, $community, array('.1.3.6.1.2.1.1', '.1.3.6...1'), $timeout, $retries);
 
43
var_dump($return);
 
44
$return = snmp2_real_walk($hostname, $community, array('.1.3.6...1', '.1.3.6.1.2.1.1'), $timeout, $retries);
 
45
var_dump($return);
 
46
 
 
47
echo "Single nonexisting OID\n";
 
48
$return = snmp2_real_walk($hostname, $community, array('.1.3.6.99999.0.99999.111'), $timeout, $retries);
 
49
var_dump($return);
 
50
 
 
51
?>
 
52
--EXPECTF--
 
53
Checking error handling
 
54
 
 
55
Warning: snmp2_real_walk() expects parameter 4 to be long, %s given in %s on line %d
 
56
bool(false)
 
57
 
 
58
Warning: snmp2_real_walk() expects parameter 5 to be long, %s given in %s on line %d
 
59
bool(false)
 
60
Checking working
 
61
Single OID
 
62
%unicode|string%(5) "array"
 
63
int(%d)
 
64
string(%d) "%s"
 
65
string(%d) "%s"
 
66
Single OID in array
 
67
%unicode|string%(5) "array"
 
68
int(%d)
 
69
string(%d) "%s"
 
70
string(%d) "%s"
 
71
More error handling
 
72
Multiple correct OID
 
73
 
 
74
Warning: snmp2_real_walk(): Multi OID walks are not supported! in %s on line %d
 
75
bool(false)
 
76
Multiple OID with wrong OID
 
77
 
 
78
Warning: snmp2_real_walk(): Multi OID walks are not supported! in %s on line %d
 
79
bool(false)
 
80
 
 
81
Warning: snmp2_real_walk(): Multi OID walks are not supported! in %s on line %d
 
82
bool(false)
 
83
Single nonexisting OID
 
84
 
 
85
Warning: snmp2_real_walk(): Error in packet at '%s': No more variables left in this MIB View (It is past the end of the MIB tree) in %s on line %d
 
86
bool(false)