File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / com_dotnet / tests / 27974.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:36 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--TEST--
COM: mapping a safearray
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
--FILE--
<?php // $Id: 27974.phpt,v 1.1.1.2 2012/05/29 12:34:36 misho Exp $
error_reporting(E_ALL);

try {
	$v = new VARIANT(array("123", "456", "789"));
	var_dump($v);
	print $v[0] . "\n";
	print $v[1] . "\n";
	print $v[2] . "\n";
	$v[1] = "hello";
	foreach ($v as $item) {
		var_dump($item);
	}
	try {
		$v[3] = "shouldn't work";
	} catch (com_exception $e) {
		if ($e->getCode() != DISP_E_BADINDEX) {
			throw $e;
		}
		echo "Got BADINDEX exception OK!\n";
	}
	echo "OK!";
} catch (Exception $e) {
	print $e;
}
?>
--EXPECT--
object(variant)#1 (0) {
}
123
456
789
string(3) "123"
string(5) "hello"
string(3) "789"
Got BADINDEX exception OK!
OK!

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>