Skip to content

Commit a3f7155

Browse files
committed
兼容php7+版本
1 parent 09464a3 commit a3f7155

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ php:
1313
- 7.1
1414
- 7.2
1515
- 7.3
16+
- 7.4
1617
# - nightly
1718

1819
notifications:

arraylist.c

+8-18
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ static inline void arraylist_object_unset_dimension_helper(arraylist_object *int
376376
}
377377
index = Z_LVAL_P(offset);
378378

379-
if (index < 0 || index >= intern->array.nSize) {
379+
if (index < 0 || index >= intern->array.nNumUsed) {
380380
php_error_docref(NULL, E_NOTICE,"Index invalid or out of range '%ld'", index);
381381
return;
382382
} else {
@@ -519,22 +519,7 @@ static zend_object *arraylist_object_new_ex(zend_class_entry *class_type, zval *
519519
php_error_docref(NULL, E_COMPILE_ERROR, "Internal compiler error, Class is not child of ArrayList");
520520
}
521521

522-
if (inherited) {
523-
if (class_type->iterator_funcs.zf_rewind->common.scope != parent) {
524-
intern->flags |= ARRAYLIST_OVERLOADED_REWIND;
525-
}
526-
if (class_type->iterator_funcs.zf_valid->common.scope != parent) {
527-
intern->flags |= ARRAYLIST_OVERLOADED_VALID;
528-
}
529-
if (class_type->iterator_funcs.zf_key->common.scope != parent) {
530-
intern->flags |= ARRAYLIST_OVERLOADED_KEY;
531-
}
532-
if (class_type->iterator_funcs.zf_current->common.scope != parent) {
533-
intern->flags |= ARRAYLIST_OVERLOADED_CURRENT;
534-
}
535-
if (class_type->iterator_funcs.zf_next->common.scope != parent) {
536-
intern->flags |= ARRAYLIST_OVERLOADED_NEXT;
537-
}
522+
if (inherited) {
538523

539524
intern->fptr_offset_get = zend_hash_str_find_ptr(&class_type->function_table, "offsetget", sizeof("offsetget") - 1);
540525
if (intern->fptr_offset_get->common.scope == parent) {
@@ -831,7 +816,12 @@ PHP_MINIT_FUNCTION(arraylist) /* {{{ */ {
831816

832817
/* 单个对象的功能 */
833818
zend_class_implements(array_list_ce, 1, zend_ce_arrayaccess);
834-
zend_class_implements(array_list_ce, 1, zend_ce_countable);
819+
820+
#if PHP_VERSION_ID > 70200
821+
zend_class_implements(array_list_ce, 1, zend_ce_countable);
822+
#endif
823+
824+
835825
return SUCCESS;
836826
}
837827
/* }}} */

0 commit comments

Comments
 (0)