Skip to content

Commit 82659c2

Browse files
committed
Convert SplDoublyLinkedList::offsetExists() to accept an integer
1 parent 4bde898 commit 82659c2

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

ext/spl/spl_dllist.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,16 +722,14 @@ PHP_METHOD(SplDoublyLinkedList, getIteratorMode)
722722
/* {{{ Returns whether the requested $index exists. */
723723
PHP_METHOD(SplDoublyLinkedList, offsetExists)
724724
{
725-
zval *zindex;
726725
spl_dllist_object *intern;
727-
zend_long index;
726+
zend_long index;
728727

729-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) {
728+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
730729
RETURN_THROWS();
731730
}
732731

733732
intern = Z_SPLDLLIST_P(ZEND_THIS);
734-
index = spl_offset_convert_to_long(zindex);
735733

736734
RETURN_BOOL(index >= 0 && index < intern->llist->count);
737735
} /* }}} */

ext/spl/spl_dllist.stub.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ public function setIteratorMode(int $mode) {}
4040
/** @return int */
4141
public function getIteratorMode() {}
4242

43-
/** @return bool */
44-
public function offsetExists(mixed $index) {}
43+
/**
44+
* @param int $index
45+
* @return bool
46+
*/
47+
public function offsetExists($index) {}
4548

4649
/**
4750
* @param int $index

ext/spl/spl_dllist_arginfo.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 983510483588b313a0cb290db5c82e825a80be62 */
2+
* Stub hash: 26a454261393ea3bdb6252b2d8140434664b5771 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplDoublyLinkedList_add, 0, 0, 2)
55
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
@@ -34,19 +34,17 @@ ZEND_END_ARG_INFO()
3434
#define arginfo_class_SplDoublyLinkedList_getIteratorMode arginfo_class_SplDoublyLinkedList_pop
3535

3636
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplDoublyLinkedList_offsetExists, 0, 0, 1)
37-
ZEND_ARG_TYPE_INFO(0, index, IS_MIXED, 0)
38-
ZEND_END_ARG_INFO()
39-
40-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplDoublyLinkedList_offsetGet, 0, 0, 1)
4137
ZEND_ARG_INFO(0, index)
4238
ZEND_END_ARG_INFO()
4339

40+
#define arginfo_class_SplDoublyLinkedList_offsetGet arginfo_class_SplDoublyLinkedList_offsetExists
41+
4442
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplDoublyLinkedList_offsetSet, 0, 0, 2)
4543
ZEND_ARG_INFO(0, index)
4644
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
4745
ZEND_END_ARG_INFO()
4846

49-
#define arginfo_class_SplDoublyLinkedList_offsetUnset arginfo_class_SplDoublyLinkedList_offsetGet
47+
#define arginfo_class_SplDoublyLinkedList_offsetUnset arginfo_class_SplDoublyLinkedList_offsetExists
5048

5149
#define arginfo_class_SplDoublyLinkedList_rewind arginfo_class_SplDoublyLinkedList_pop
5250

0 commit comments

Comments
 (0)