From 3bf72f95e76b688b40220806784b3a554c63969d Mon Sep 17 00:00:00 2001 From: CismonX Date: Wed, 8 Aug 2018 15:55:57 +0800 Subject: [PATCH] fix bug. update readme. --- README.md | 3 ++- src/collections_methods.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce9f2b1..fb35a47 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ Method names and functionalities are inspired by [Kotlin.Collections](https://ko ### 1.1 Notes -* This extension requires PHP 7.1 and above. +* Requires PHP 7.1 and above. +* Currently not working on MacOS. Fix in progress. ## 2. Documentation diff --git a/src/collections_methods.c b/src/collections_methods.c index d69d23a..cc98a33 100644 --- a/src/collections_methods.c +++ b/src/collections_methods.c @@ -1009,7 +1009,7 @@ PHP_METHOD(Collection, last) RETURN_NULL(); if (EX_NUM_ARGS() == 0) { HashPosition pos = current->nNumUsed; - while (pos >= 0 && Z_ISUNDEF(current->arData[pos].val)) + while (pos <= current->nNumUsed && Z_ISUNDEF(current->arData[pos].val)) --pos; RETURN_ZVAL(¤t->arData[pos].val, 1, 0); }