xref: /PHP-7.2/ext/com_dotnet/tests/27974.phpt (revision 610c7fbe)
1--TEST--
2COM: mapping a safearray
3--SKIPIF--
4<?php # vim:ft=php
5if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
6--FILE--
7<?php // $Id$
8error_reporting(E_ALL);
9
10try {
11	$v = new VARIANT(array("123", "456", "789"));
12	var_dump($v);
13	print $v[0] . "\n";
14	print $v[1] . "\n";
15	print $v[2] . "\n";
16	$v[1] = "hello";
17	foreach ($v as $item) {
18		var_dump($item);
19	}
20	try {
21		$v[3] = "shouldn't work";
22	} catch (com_exception $e) {
23		if ($e->getCode() != DISP_E_BADINDEX) {
24			throw $e;
25		}
26		echo "Got BADINDEX exception OK!\n";
27	}
28	echo "OK!";
29} catch (Exception $e) {
30	print $e;
31}
32?>
33--EXPECT--
34object(variant)#1 (0) {
35}
36123
37456
38789
39string(3) "123"
40string(5) "hello"
41string(3) "789"
42Got BADINDEX exception OK!
43OK!
44