xref: /PHP-8.2/ext/com_dotnet/tests/gh8750.phpt (revision 56804e32)
1--TEST--
2Bug GH-8750 (Can not create VT_ERROR variant type)
3--EXTENSIONS--
4com_dotnet
5--SKIPIF--
6<?php
7$provider = "Microsoft.ACE.OLEDB.12.0";
8$filename = __DIR__ . "\\gh8750.mdb";
9$catalog = new com("ADOX.Catalog");
10try {
11    $catalog->Create("Provider=$provider;Data Source=$filename");
12} catch (com_exception) {
13    die("skip $provider provider not available");
14}
15$catalog = null;
16@unlink($filename);
17?>
18--FILE--
19<?php
20$filename = __DIR__ . "\\gh8750.mdb";
21
22$catalog = new com("ADOX.Catalog");
23$catalog->Create("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$filename");
24$catalog = null;
25
26$db = new com("ADODB.Connection");
27$db->ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$filename";
28$db->Mode = 1; // adModeRead
29$db->Open();
30// adSchemaProviderSpecific, *missing*, JET_SCHEMA_USERROSTER
31$rs = $db->OpenSchema(-1, new variant(DISP_E_PARAMNOTFOUND, VT_ERROR), "{947bb102-5d43-11d1-bdbf-00c04fb92675}");
32// manual counting since rs.RecordCount is -1 (not supported)
33$i = 0;
34while (!$rs->EOF) {
35    $rs->MoveNext();
36    $i++;
37}
38$rs->Close();
39$db->Close();
40var_dump($i);
41?>
42--EXPECT--
43int(1)
44--CLEAN--
45<?php
46unlink(__DIR__ . "/gh8750.mdb");
47?>
48