mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #79248: Traversing empty VT_ARRAY throws com_exception
This commit is contained in:
commit
42e7de1518
2 changed files with 17 additions and 1 deletions
|
@ -185,7 +185,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b
|
|||
SafeArrayGetUBound(V_ARRAY(&I->safe_array), 1, &I->sa_max);
|
||||
|
||||
/* pre-fetch the element */
|
||||
if (php_com_safearray_get_elem(&I->safe_array, &I->v, bound)) {
|
||||
if (I->sa_max >= bound && php_com_safearray_get_elem(&I->safe_array, &I->v, bound)) {
|
||||
I->key = bound;
|
||||
ZVAL_NULL(&ptr);
|
||||
php_com_zval_from_variant(&ptr, &I->v, I->code_page);
|
||||
|
|
16
ext/com_dotnet/tests/bug79248.phpt
Normal file
16
ext/com_dotnet/tests/bug79248.phpt
Normal file
|
@ -0,0 +1,16 @@
|
|||
--TEST--
|
||||
Bug #79248 (Traversing empty VT_ARRAY throws com_exception)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$v = new variant([], VT_ARRAY);
|
||||
foreach ($v as $el) {
|
||||
var_dump($el);
|
||||
}
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue