xref: /PHP-7.2/ext/com_dotnet/tests/bug33386.phpt (revision 17ccbeec)
1--TEST--
2Bug #33386 (ScriptControl only sees last function of class)
3--SKIPIF--
4<?php
5if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present";
6if (4 != PHP_INT_SIZE)  print "skip MSScriptControl isn't available under x64";
7?>
8--FILE--
9<?php
10error_reporting(E_ALL);
11
12class twoFuncs {
13    public function func1() { echo " func one\n"; }
14    public function func2() { echo " func two\n"; }
15}
16
17try {
18	$ciTF = new twoFuncs;
19
20	$oScript = new COM("MSScriptControl.ScriptControl");
21	$oScript->Language = "VBScript";
22
23	$oScript->AddObject ("tfA", $ciTF, true);
24	foreach (array(1,2) as $i) {
25		$oScript->ExecuteStatement ("tfA.func$i");
26		$oScript->ExecuteStatement ("func$i");
27	}
28	$oScript->AddObject ("tfB", $ciTF);
29	foreach (array(1,2) as $i) {
30		$oScript->ExecuteStatement ("tfB.func$i");
31	}
32} catch (Exception $e) {
33	print $e;
34}
35?>
36--EXPECT--
37 func one
38 func one
39 func two
40 func two
41 func one
42 func two
43