Skip to content

Commit c5e2aa4

Browse files
3.22.5 sync
1 parent 20c6a4c commit c5e2aa4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Google/Protobuf/Internal/RepeatedField.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,13 @@ public function offsetSet($offset, $value)
219219
public function offsetUnset($offset)
220220
{
221221
$count = count($this->container);
222-
if (!is_numeric($offset) || $count === 0 || $offset < 0 || $offset >= $count) {
222+
if (!is_numeric($offset) || $count === 0 || $offset !== $count - 1) {
223223
trigger_error(
224224
"Cannot remove element at the given index",
225225
E_USER_ERROR);
226226
return;
227227
}
228-
array_splice($this->container, $offset, 1);
228+
array_pop($this->container);
229229
}
230230

231231
/**

0 commit comments

Comments
 (0)