Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixes #3773 #5836

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

steverhoades commented Feb 16, 2014

Fixed some minor issues with suggested fix.

@Maks3w Maks3w added the Json label Feb 22, 2014

@weierophinney weierophinney added this to the 2.2.6 milestone Mar 3, 2014

@Ocramius Ocramius commented on the diff Mar 4, 2014

library/Zend/Json/Server/Server.php
return $args;
}
+ /**
+ * check whether array is associative or not
+ *
+ * @param array $array
+ * @return bool
+ */
+ private function isAssociative(array $array)
+ {
+ $keys = array_keys($array);
+
+ return ($keys != array_keys($keys));
@Ocramius

Ocramius Mar 4, 2014

Member

This is confusing - on what is this logic based?

@weierophinney

weierophinney Mar 4, 2014

Owner

@Ocramius It's similar to what we have in Zend\Stdlib\ArrayUtils::isHashTable() -- essentially, you're testing to see if the array keys are sequential starting with 0. If they are not, it's an associative array. In ArrayUtils, we test if array_values($array) !== $array. Both work.

@weierophinney weierophinney self-assigned this Mar 4, 2014

weierophinney added a commit that referenced this pull request Mar 4, 2014

weierophinney added a commit that referenced this pull request Mar 4, 2014

weierophinney added a commit to zendframework/zend-json that referenced this pull request May 15, 2015

weierophinney added a commit to zendframework/zend-json that referenced this pull request May 15, 2015

weierophinney added a commit to zendframework/zend-json that referenced this pull request May 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment