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

Collection walk method bug fix when specific callback function #5742

Merged
merged 4 commits into from
Apr 13, 2017

Conversation

jalogut
Copy link
Contributor

@jalogut jalogut commented Jul 21, 2016

When a specific class is set as callback on a collection->walk, it works only for the first item in the collection. The problem is that array_unshift modifies directly the value of $args adding the $item object at the beginning. That works well for the first iteration but after that $args grow and grow keeping previous $item objects from previous iterations.

How to test:

Just try an a collection->walk with more than 1 item. Only the callback for the first element is successful.

$this->objectCollection
    ->addFieldToFilter('id', array('in' => array(1,2,3)))
    ->walk(array($this, 'saveCollection'), array('value'));

@ghost ghost added the linked label Aug 10, 2016
@vkorotun vkorotun added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development and removed linked labels Aug 22, 2016
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Feb 24, 2017

CLA assistant check
All committers have signed the CLA.

$results[$id] = call_user_func_array($cb, $args);
//@codingStandardsIgnoreStart
$results[$id] = call_user_func_array($cb, $params);
//@codingStandardsIgnoreEnd
Copy link
Contributor

Choose a reason for hiding this comment

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

What needs to be ignored here?

Copy link
Contributor Author

@jalogut jalogut Feb 24, 2017

Choose a reason for hiding this comment

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

Nothing, I was just getting a warning that you should not use "call_user_func_array". I removed these coding standard ignores

@okorshenko okorshenko self-assigned this Apr 12, 2017
@okorshenko okorshenko added this to the April 2017 milestone Apr 12, 2017
@magento-team magento-team merged commit 84ca28b into magento:develop Apr 13, 2017
magento-team pushed a commit that referenced this pull request Apr 13, 2017
@magento-team
Copy link
Contributor

@jalogut Thank you for the contribution

magento-engcom-team pushed a commit that referenced this pull request Jun 5, 2020
[mpi] MC-29755: X-Magento-Tags header too large
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: accept
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants