@@ -697,23 +697,6 @@ static int spl_array_has_dimension(zval *object, zval *offset, int check_empty)
697
697
return spl_array_has_dimension_ex (1 , object , offset , check_empty );
698
698
} /* }}} */
699
699
700
- /* {{{ spl_array_object_verify_pos_ex */
701
- static inline int spl_array_object_verify_pos_ex (spl_array_object * object , HashTable * ht , const char * msg_prefix )
702
- {
703
- if (!ht ) {
704
- php_error_docref (NULL , E_NOTICE , "%sArray was modified outside object and is no longer an array" , msg_prefix );
705
- return FAILURE ;
706
- }
707
-
708
- return SUCCESS ;
709
- } /* }}} */
710
-
711
- /* {{{ spl_array_object_verify_pos */
712
- static inline int spl_array_object_verify_pos (spl_array_object * object , HashTable * ht )
713
- {
714
- return spl_array_object_verify_pos_ex (object , ht , "" );
715
- } /* }}} */
716
-
717
700
/* {{{ proto bool ArrayObject::offsetExists(mixed $index)
718
701
proto bool ArrayIterator::offsetExists(mixed $index)
719
702
Returns whether the requested $index exists. */
@@ -756,12 +739,6 @@ SPL_METHOD(Array, offsetSet)
756
739
void spl_array_iterator_append (zval * object , zval * append_value ) /* {{{ */
757
740
{
758
741
spl_array_object * intern = Z_SPLARRAY_P (object );
759
- HashTable * aht = spl_array_get_hash_table (intern );
760
-
761
- if (!aht ) {
762
- php_error_docref (NULL , E_NOTICE , "Array was modified outside object and is no longer an array" );
763
- return ;
764
- }
765
742
766
743
if (spl_array_is_object (intern )) {
767
744
zend_throw_error (NULL , "Cannot append properties to objects, use %s::offsetSet() instead" , ZSTR_VAL (Z_OBJCE_P (object )-> name ));
@@ -1036,10 +1013,6 @@ static int spl_array_it_valid(zend_object_iterator *iter) /* {{{ */
1036
1013
if (object -> ar_flags & SPL_ARRAY_OVERLOADED_VALID ) {
1037
1014
return zend_user_it_valid (iter );
1038
1015
} else {
1039
- if (spl_array_object_verify_pos_ex (object , aht , "ArrayIterator::valid(): " ) == FAILURE ) {
1040
- return FAILURE ;
1041
- }
1042
-
1043
1016
return zend_hash_has_more_elements_ex (aht , spl_array_get_pos_ptr (aht , object ));
1044
1017
}
1045
1018
}
@@ -1070,11 +1043,7 @@ static void spl_array_it_get_current_key(zend_object_iterator *iter, zval *key)
1070
1043
if (object -> ar_flags & SPL_ARRAY_OVERLOADED_KEY ) {
1071
1044
zend_user_it_get_current_key (iter , key );
1072
1045
} else {
1073
- if (spl_array_object_verify_pos_ex (object , aht , "ArrayIterator::current(): " ) == FAILURE ) {
1074
- ZVAL_NULL (key );
1075
- } else {
1076
- zend_hash_get_current_key_zval_ex (aht , key , spl_array_get_pos_ptr (aht , object ));
1077
- }
1046
+ zend_hash_get_current_key_zval_ex (aht , key , spl_array_get_pos_ptr (aht , object ));
1078
1047
}
1079
1048
}
1080
1049
/* }}} */
@@ -1088,11 +1057,6 @@ static void spl_array_it_move_forward(zend_object_iterator *iter) /* {{{ */
1088
1057
zend_user_it_move_forward (iter );
1089
1058
} else {
1090
1059
zend_user_it_invalidate_current (iter );
1091
- if (!aht ) {
1092
- php_error_docref (NULL , E_NOTICE , "ArrayIterator::current(): Array was modified outside object and is no longer an array" );
1093
- return ;
1094
- }
1095
-
1096
1060
spl_array_next_ex (object , aht );
1097
1061
}
1098
1062
}
@@ -1102,11 +1066,6 @@ static void spl_array_rewind(spl_array_object *intern) /* {{{ */
1102
1066
{
1103
1067
HashTable * aht = spl_array_get_hash_table (intern );
1104
1068
1105
- if (!aht ) {
1106
- php_error_docref (NULL , E_NOTICE , "ArrayIterator::rewind(): Array was modified outside object and is no longer an array" );
1107
- return ;
1108
- }
1109
-
1110
1069
if (intern -> ht_iter == (uint32_t )-1 ) {
1111
1070
spl_array_get_pos_ptr (aht , intern );
1112
1071
} else {
@@ -1356,17 +1315,11 @@ SPL_METHOD(Array, getIterator)
1356
1315
{
1357
1316
zval * object = getThis ();
1358
1317
spl_array_object * intern = Z_SPLARRAY_P (object );
1359
- HashTable * aht = spl_array_get_hash_table (intern );
1360
1318
1361
1319
if (zend_parse_parameters_none () == FAILURE ) {
1362
1320
return ;
1363
1321
}
1364
1322
1365
- if (!aht ) {
1366
- php_error_docref (NULL , E_NOTICE , "Array was modified outside object and is no longer an array" );
1367
- return ;
1368
- }
1369
-
1370
1323
ZVAL_OBJ (return_value , spl_array_object_new_ex (intern -> ce_get_iterator , object , 0 ));
1371
1324
}
1372
1325
/* }}} */
@@ -1400,11 +1353,6 @@ SPL_METHOD(Array, seek)
1400
1353
return ;
1401
1354
}
1402
1355
1403
- if (!aht ) {
1404
- php_error_docref (NULL , E_NOTICE , "Array was modified outside object and is no longer an array" );
1405
- return ;
1406
- }
1407
-
1408
1356
opos = position ;
1409
1357
1410
1358
if (position >= 0 ) { /* negative values are not supported */
@@ -1425,12 +1373,6 @@ static int spl_array_object_count_elements_helper(spl_array_object *intern, zend
1425
1373
HashTable * aht = spl_array_get_hash_table (intern );
1426
1374
HashPosition pos , * pos_ptr ;
1427
1375
1428
- if (!aht ) {
1429
- php_error_docref (NULL , E_NOTICE , "Array was modified outside object and is no longer an array" );
1430
- * count = 0 ;
1431
- return FAILURE ;
1432
- }
1433
-
1434
1376
if (spl_array_is_object (intern )) {
1435
1377
/* We need to store the 'pos' since we'll modify it in the functions
1436
1378
* we're going to call and which do not support 'pos' as parameter. */
@@ -1584,10 +1526,6 @@ SPL_METHOD(Array, current)
1584
1526
return ;
1585
1527
}
1586
1528
1587
- if (spl_array_object_verify_pos (intern , aht ) == FAILURE ) {
1588
- return ;
1589
- }
1590
-
1591
1529
if ((entry = zend_hash_get_current_data_ex (aht , spl_array_get_pos_ptr (aht , intern ))) == NULL ) {
1592
1530
return ;
1593
1531
}
@@ -1617,10 +1555,6 @@ void spl_array_iterator_key(zval *object, zval *return_value) /* {{{ */
1617
1555
spl_array_object * intern = Z_SPLARRAY_P (object );
1618
1556
HashTable * aht = spl_array_get_hash_table (intern );
1619
1557
1620
- if (spl_array_object_verify_pos (intern , aht ) == FAILURE ) {
1621
- return ;
1622
- }
1623
-
1624
1558
zend_hash_get_current_key_zval_ex (aht , return_value , spl_array_get_pos_ptr (aht , intern ));
1625
1559
}
1626
1560
/* }}} */
@@ -1637,10 +1571,6 @@ SPL_METHOD(Array, next)
1637
1571
return ;
1638
1572
}
1639
1573
1640
- if (spl_array_object_verify_pos (intern , aht ) == FAILURE ) {
1641
- return ;
1642
- }
1643
-
1644
1574
spl_array_next_ex (intern , aht );
1645
1575
}
1646
1576
/* }}} */
@@ -1657,11 +1587,7 @@ SPL_METHOD(Array, valid)
1657
1587
return ;
1658
1588
}
1659
1589
1660
- if (spl_array_object_verify_pos (intern , aht ) == FAILURE ) {
1661
- RETURN_FALSE ;
1662
- } else {
1663
- RETURN_BOOL (zend_hash_has_more_elements_ex (aht , spl_array_get_pos_ptr (aht , intern )) == SUCCESS );
1664
- }
1590
+ RETURN_BOOL (zend_hash_has_more_elements_ex (aht , spl_array_get_pos_ptr (aht , intern )) == SUCCESS );
1665
1591
}
1666
1592
/* }}} */
1667
1593
@@ -1677,10 +1603,6 @@ SPL_METHOD(Array, hasChildren)
1677
1603
return ;
1678
1604
}
1679
1605
1680
- if (spl_array_object_verify_pos (intern , aht ) == FAILURE ) {
1681
- RETURN_FALSE ;
1682
- }
1683
-
1684
1606
if ((entry = zend_hash_get_current_data_ex (aht , spl_array_get_pos_ptr (aht , intern ))) == NULL ) {
1685
1607
RETURN_FALSE ;
1686
1608
}
@@ -1706,10 +1628,6 @@ SPL_METHOD(Array, getChildren)
1706
1628
return ;
1707
1629
}
1708
1630
1709
- if (spl_array_object_verify_pos (intern , aht ) == FAILURE ) {
1710
- return ;
1711
- }
1712
-
1713
1631
if ((entry = zend_hash_get_current_data_ex (aht , spl_array_get_pos_ptr (aht , intern ))) == NULL ) {
1714
1632
return ;
1715
1633
}
@@ -1741,7 +1659,6 @@ SPL_METHOD(Array, serialize)
1741
1659
{
1742
1660
zval * object = getThis ();
1743
1661
spl_array_object * intern = Z_SPLARRAY_P (object );
1744
- HashTable * aht = spl_array_get_hash_table (intern );
1745
1662
zval members , flags ;
1746
1663
php_serialize_data_t var_hash ;
1747
1664
smart_str buf = {0 };
@@ -1750,11 +1667,6 @@ SPL_METHOD(Array, serialize)
1750
1667
return ;
1751
1668
}
1752
1669
1753
- if (!aht ) {
1754
- php_error_docref (NULL , E_NOTICE , "Array was modified outside object and is no longer an array" );
1755
- return ;
1756
- }
1757
-
1758
1670
PHP_VAR_SERIALIZE_INIT (var_hash );
1759
1671
1760
1672
ZVAL_LONG (& flags , (intern -> ar_flags & SPL_ARRAY_CLONE_MASK ));
0 commit comments