php.net |  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: cmb@php.net 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
 [2020-02-08 15:51 UTC] cmb@php.net
Description:
------------
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:
---------------
<?php
$v = new variant([], VT_ARRAY);
foreach ($v as $el) {
    var_dump($el);
}
echo "done\n";
?>


Expected result:
----------------
done


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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-02-08 15:51 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-02-08 16:09 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f649adedfe3f0797cd0d6248e1b01c65b326f443
Log: Fix #79248: Traversing empty VT_ARRAY throws com_exception
 [2020-02-08 16:09 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC