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

11532: Duplicate Simple Product Throws Error: Undefined offset: 0 in SaveHandler.php on line 122 #12001

Merged
merged 2 commits into from Nov 13, 2017

Conversation

@RomaKis
Copy link
Contributor

commented Nov 3, 2017

Fixed Issues (if relevant)

  1. #11532: Duplicate Simple Product Throws Error: Undefined offset: 0 in SaveHandler.php on line 122

Manual testing scenarios

Precondition
Two cases:
Create simple product and export his, delete product in catalog manager, and import file from product.
or
Create simple product, and update Magento from 2.1.8 or 2.1.9 to 2.2.0.
Steps to reproduce:

  1. Click on an existing simple product in the catalog manager
  2. Click the "Save & Duplicate" option
    Expected result
    The product saves and creates a duplicate item.
    Actual result
    Saves the product but doesn't duplicate it. Throws the following error:
    Notice: Undefined offset: 0 in /home/store/public_html/vendor/magento/module-catalog/Model/Category/Link/SaveHandler.php on line 122

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
} elseif ($oldCategoryPositions[$key]['position'] != $newCategoryPosition['position']) {
$result[] = $newCategoryPositions[$key];
unset($oldCategoryPositions[$key]);
} elseif (isset($oldCategoryPositions[$key])) {

This comment has been minimized.

Copy link
@dmanners

dmanners Nov 10, 2017

Contributor

Personally I do not think we need the nested if here. I think we could cover this check via

} elseif (
    isset($oldCategoryPositions[$key])
    && $oldCategoryPositions[$key]['position'] != $newCategoryPosition['position']
) {

Or have I missed something?

This comment has been minimized.

Copy link
@RomaKis

RomaKis Nov 10, 2017

Author Contributor

@dmanners, yes, you are right. It is fixed and squashed.

@dmanners

This comment has been minimized.

Copy link
Contributor

commented Nov 10, 2017

@RomaKis There appears to be a small style problem.


There was 1 failure:
--
10-Nov-2017 05:50:34 | [exec]
10-Nov-2017 05:50:34 | [exec] 1) Magento\Test\Php\LiveCodeTest::testCodeStyle
10-Nov-2017 05:50:34 | [exec] PHP Code Sniffer detected 2 violation(s):
10-Nov-2017 05:50:34 | [exec]
10-Nov-2017 05:50:34 | [exec] FILE: ...to2/app/code/Magento/Catalog/Model/Category/Link/SaveHandler.php
10-Nov-2017 05:50:34 | [exec] ----------------------------------------------------------------------
10-Nov-2017 05:50:34 | [exec] FOUND 1 ERROR AFFECTING 1 LINE
10-Nov-2017 05:50:34 | [exec] ----------------------------------------------------------------------
10-Nov-2017 05:50:34 | [exec]  122 \| ERROR \| [x] Expected 0 spaces after opening bracket; newline
10-Nov-2017 05:50:34 | [exec]      \|       \|     found
10-Nov-2017 05:50:34 | [exec] ----------------------------------------------------------------------
10-Nov-2017 05:50:34 | [exec] PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
10-Nov-2017 05:50:34 | [exec] ----------------------------------------------------------------------
@RomaKis

This comment has been minimized.

Copy link
Contributor Author

commented Nov 10, 2017

@dmanners, fixed.

@dmanners

This comment has been minimized.

Copy link
Contributor

commented Nov 10, 2017

@RomaKis thanks

@okorshenko okorshenko merged commit 3f79b80 into magento:2.2-develop Nov 13, 2017

3 checks passed

codacy/pr Good work! A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details
okorshenko added a commit that referenced this pull request Nov 13, 2017
@testmagento2

This comment has been minimized.

Copy link

commented Nov 15, 2017

@dmanners, fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.