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 php 7.2 error : Countable interface not implemented #19249

Merged
merged 2 commits into from Dec 10, 2018

Conversation

@gmachure
Copy link
Contributor

commented Nov 16, 2018

Description (*)

We created a custom module with ui component form with a file upload field. While the upload, the method _setUploadFileId from vendor/magento/framework/File/Uploader.php generate a warning because Countable interface is not implement for a string (PHP version : 7.2.12).
$file[0] is a string and not an array. So count($file[0]) generate an error.

Fixed Issues (if relevant)

  1. #19247: fix php 7.2 error : Countable interface not implemented

Manual testing scenarios (*)

  1. Upload image in ui component form in a custom module
  2. Test :
    -Create custom module
    -Add a file uploader in ui component form.
    -Upload an image.
    -PHP version : 7.2.12

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)
@magento-engcom-team

This comment has been minimized.

Copy link
Contributor

commented Nov 16, 2018

Hi @gmachure. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@gmachure

This comment has been minimized.

Copy link
Contributor Author

commented Nov 16, 2018

@magento-engcom-team give me test instance

@magento-engcom-team

This comment has been minimized.

Copy link
Contributor

commented Nov 16, 2018

Hi @gmachure. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team

This comment has been minimized.

Copy link
Contributor

commented Nov 16, 2018

Hi @gmachure, here is your new Magento instance.
Admin access: http://34.228.235.121/pr-19249//admin
Login: admin Password: 123123q

@orlangur orlangur self-assigned this Nov 16, 2018

@@ -546,7 +546,7 @@ private function _setUploadFileId($fileId)
preg_match("/^(.*?)\[(.*?)\]$/", $fileId, $file);
if (is_array($file) && count($file) > 0 && count($file[0]) > 0 && count($file[1]) > 0) {
if (is_array($file) && count($file) > 0 && !empty($file[0]) && (isset($file[1]) && !empty($file[1]))) {

This comment has been minimized.

Copy link
@orlangur

orlangur Nov 16, 2018

Contributor

isset($file[1]) is redundant here, please remove it.

This comment has been minimized.

Copy link
@gmachure

gmachure Nov 16, 2018

Author Contributor

Hi @orlangur
I removed redundant isset($file[1])

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.1 milestone Nov 17, 2018

@magento-engcom-team

This comment has been minimized.

Copy link
Contributor

commented Nov 17, 2018

Hi @orlangur, thank you for the review.
ENGCOM-3483 has been created to process this Pull Request

@magento-engcom-team

This comment has been minimized.

Copy link
Contributor

commented Nov 17, 2018

@gmachure thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@magento-engcom-team magento-engcom-team merged commit a7b9122 into magento:2.3-develop Dec 10, 2018

3 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details

magento-engcom-team pushed a commit that referenced this pull request Dec 10, 2018

@magento-engcom-team

This comment has been minimized.

Copy link
Contributor

commented Dec 10, 2018

Hi @gmachure. Thank you for your contribution.
We will aim to release these changes as part of 2.3.1.
Please check the release notes for final confirmation.

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.