From 8f89dafed1fd2ac4f130debcde9570b17d0c7cc4 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Mon, 31 Mar 2014 22:18:11 -0700 Subject: [PATCH] Fix #32: Replace function array dereferencing syntax to avoid syntax errors < PHP 5.4.0 --- src/Curl.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Curl.class.php b/src/Curl.class.php index d3d06d3..fd77a99 100644 --- a/src/Curl.class.php +++ b/src/Curl.class.php @@ -388,7 +388,8 @@ class CaseInsensitiveArray implements ArrayAccess, Countable, Iterator } else { $index = array_search(strtolower($offset), array_keys(array_change_key_case($this->container, CASE_LOWER))); if (!($index === false)) { - unset($this->container[array_keys($this->container)[$index]]); + $keys = array_keys($this->container); + unset($this->container[$keys[$index]]); } $this->container[$offset] = $value; } @@ -407,7 +408,12 @@ class CaseInsensitiveArray implements ArrayAccess, Countable, Iterator public function offsetGet($offset) { $index = array_search(strtolower($offset), array_keys(array_change_key_case($this->container, CASE_LOWER))); - return $index === false ? null : array_values($this->container)[$index]; + if ($index === false) { + return null; + } + + $values = array_values($this->container); + return $values[$index]; } public function count()