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