|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79248 Traversing empty VT_ARRAY throws com_exception
Submitted: 2020-02-08 15:51 UTC Modified: 2020-02-08 15:51 UTC
From: Assigned: cmb (profile)
Status: Closed Package: COM related
PHP Version: 7.3Git-2020-02-08 (Git) OS: Windows only
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2020-02-08 15:51 UTC]
When an empty VT_ARRAY (i.e. a VT_ARRAY without any elements) is
traversed via foreach, a com_exception ("index out of bounds") is
thrown, what does not match the usual semantics of traversing
empty collections.

Test script:
$v = new variant([], VT_ARRAY);
foreach ($v as $el) {
echo "done\n";

Expected result:

Actual result:
Fatal error: Uncaught com_exception: index out of bounds in C:\php-sdk\phpdev\vc15\x64\com.php:3
Stack trace:
#0 {main}
  thrown in C:\php-sdk\phpdev\vc15\x64\com.php on line 3


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-02-08 15:51 UTC]
-Assigned To: +Assigned To: cmb
 [2020-02-08 16:09 UTC]
Automatic comment on behalf of
Log: Fix #79248: Traversing empty VT_ARRAY throws com_exception
 [2020-02-08 16:09 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 00:01:29 2024 UTC