Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #18 call ->toArray() on Traversable instances given to ArrayUtils::iteratorToArray() only for instances which are **not** Iterator implementations #42

Conversation

garygitton
Copy link
Contributor

@garygitton garygitton commented Dec 14, 2021

Q A
Bugfix yes

Description

Fix of the issue #18 (ArrayUtils::iteratorToArray() different behaviour when recursive is false)

  • Add unit test to reproduce and fix the bug

No when we use ArrayUtils::iteratorToArray with recursive = true

  • if traversable is an iterator we don't use the method toArray to get the data

A new test is added in the class ArrayUtilsTest under the method testIteratorToArrayWithIteratorHavingMethodToArrayAndRecursiveIsFalse

Fixes #18

@Ocramius Ocramius changed the base branch from 3.7.x to 3.6.x December 24, 2021 17:29
@Ocramius Ocramius self-assigned this Dec 24, 2021
@Ocramius Ocramius added the Bug Something isn't working label Dec 24, 2021
@Ocramius Ocramius added this to the 3.6.3 milestone Dec 24, 2021
@Ocramius Ocramius force-pushed the fix/arrayutils-iterator-to-array-different-behaviour-when-recursive-is-false branch from 3026694 to 2d3358f Compare December 24, 2021 17:34
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to 3.6.x as target and rebased: overall excellent work, thanks @garygitton!

@Ocramius Ocramius changed the title Fix #18 return toArray value only for traversable which are not iterator Fix #18 return ArrayUtils::toArray() value only for Traversable instances which are **not** Iterator implementations Dec 24, 2021
@Ocramius Ocramius changed the title Fix #18 return ArrayUtils::toArray() value only for Traversable instances which are **not** Iterator implementations Fix #18 call ->toArray() on Traversable instances given to ArrayUtils::iteratorToArray() only for instances which are **not** Iterator implementations Dec 24, 2021
@Ocramius Ocramius merged commit abba193 into laminas:3.6.x Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ArrayUtils::iteratorToArray() different behaviour when recursive is false
3 participants