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

Upgrade ZF components. Zend_Json #9236

Closed
okorshenko opened this issue Apr 13, 2017 · 11 comments
Closed

Upgrade ZF components. Zend_Json #9236

okorshenko opened this issue Apr 13, 2017 · 11 comments
Assignees
Labels
Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development up for grabs

Comments

@okorshenko
Copy link
Contributor

okorshenko commented Apr 13, 2017

Description
Upgrade components from ZF1 to ZF2

As a long term goal, we would like to eliminate knowledge about 3rd party libraries from Magento code base. Magento code still can use 3rd party libraries, but they must be wrapped by Magento interfaces and classes (adapters) so that 3rd party libraries can be easily substituted by newest versions or alternative implementations.

Acceptance Criteria

  1. Magento interfaces are defined and can be used instead of ZF1 classes in Magento code
  2. Default implementations for new interfaces are defined and configured as the preferences for new interfaces
  3. Client code of the ZF1 components is refactored to use Magento interfaces
  4. Zend classes are used as private services in Magento adapters
  5. Backward compatibility is preserved
  6. ZF1 components are updated to ZF2

List of the components

# Component Name
(total usages count)
Module Name Usages Count
1 Zend_Json (total: 51) Framework\DataObject.php 1
    Framework\Controller 1
    Framework\Json 2
    Framework\Module 3
    Framework\Webapi 3
    Magento\Weee 6
    Framework\Data 4
    Magento\Theme 31
@okorshenko
Copy link
Contributor Author

@dmanners if you would like to work on this, I can assign this to you.

@dmanners
Copy link
Contributor

Updated List of the components

# Component Name
(total usages count)
Module Name Usages Count
1 Zend_Json (total: 15) Framework\DataObject.php 1
    Framework\Controller 1
    Framework\Json 2
    Framework\Module 3
    Framework\Webapi 3
    Framework\Data 4
    Magento\Widget 1

@dmanners
Copy link
Contributor

Updated List of the components as of July

# Component Name
(total usages count)
Module Name Usages Count
1 Zend_Json (total: 13) Magento\Customer 1
    Framework\DataObject.php 1
    Framework\Controller 1
    Framework\Json 2
    Framework\Module 5
    Framework\Webapi 3

@dmanners
Copy link
Contributor

Just noticed I forgot to include the setup module in the list of places to change that has 5 occurrences.

@dmanners
Copy link
Contributor

Current status

lib/internal/Magento/Framework/Controller/Result/Json.php:        $this->json = \Zend_Json::encode($data, $cycleCheck, $options);
lib/internal/Magento/Framework/Module/Setup/Migration.php:    protected function _jsonDecode($encodedValue, $objectDecodeType = \Zend_Json::TYPE_ARRAY)
lib/internal/Magento/Framework/Module/Setup/Migration.php:        return \Zend_Json::decode($encodedValue, $objectDecodeType);
lib/internal/Magento/Framework/Module/PackageInfo.php:     * @throws \Zend_Json_Exception
lib/internal/Magento/Framework/Module/PackageInfo.php:                        $packageData = \Zend_Json::decode($jsonData[$key]);
lib/internal/Magento/Framework/Module/PackageInfo.php:                    } catch (\Zend_Json_Exception $e) {
lib/internal/Magento/Framework/Module/PackageInfo.php:                        throw new \Zend_Json_Exception(
lib/internal/Magento/Framework/Json/Decoder.php:        return \Zend_Json::decode($data);
lib/internal/Magento/Framework/Json/Encoder.php:        return \Zend_Json::encode($data);
lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php:        } catch (\Zend_Json_Exception $e) {
lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Request/Deserializer/JsonTest.php:            ->will($this->throwException(new \Zend_Json_Exception));
lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Request/Deserializer/JsonTest.php:                new \Zend_Json_Exception('Decoding error:' . PHP_EOL . 'Decoding failed: Syntax error')
setup/src/Magento/Setup/Test/Unit/Controller/MarketplaceTest.php:            ->will($this->returnValue(\Zend_Json::encode(['success' => true])));
setup/src/Magento/Setup/Test/Unit/Controller/MarketplaceTest.php:            ->will($this->returnValue(\Zend_Json::encode(['success' => true])));
setup/src/Magento/Setup/Model/PackagesAuth.php:                return \Zend_Json::encode(['success' => true]);
setup/src/Magento/Setup/Model/PackagesAuth.php:                return \Zend_Json::encode(['success' => false, 'message' => 'Bad credentials']);
setup/src/Magento/Setup/Model/PackagesAuth.php:            return \Zend_Json::encode(['success' => false, 'message' => $e->getMessage()]);

@dmanners
Copy link
Contributor

dmanners commented Jul 28, 2017

Updated List of the components as of 28th of July

# Component Name
(total usages count)
Module Name Usages Count
1 Zend_Json (total: 2) Framework\Json 2

That makes me feel good!

@magento-team magento-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Application Framework up for grabs labels Jul 31, 2017
@magento magento deleted a comment from magento-team Jul 31, 2017
@magento magento deleted a comment from magento-team Jul 31, 2017
@magento magento deleted a comment from magento-team Jul 31, 2017
@magento magento deleted a comment from magento-team Jul 31, 2017
@magento magento deleted a comment from magento-team Jul 31, 2017
@magento magento deleted a comment from magento-team Jul 31, 2017
@magento magento deleted a comment from magento-team Jul 31, 2017
@magento magento deleted a comment from magento-team Jul 31, 2017
@dmanners
Copy link
Contributor

dmanners commented Aug 2, 2017

Small step backwards but no problem 💃 we go again!

# Component Name
(total usages count)
Module Name Usages Count
1 Zend_Json (total: 3) Framework\Json 2
2   Framework\Controller 1

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Application Framework Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed up for grabs labels Sep 11, 2017
@magento-engcom-team
Copy link
Contributor

Hi @dmanners
Thank you for continuous contribution to this component. You almost resolved all issues in that area! 👍 👍 👍
We are closing the issue, but feel free to proceed with Zend_Json refactoring

@ishakhsuvarov
Copy link
Contributor

Hi @okorshenko. Thank you for your report.
The issue has been fixed in #13137 by @dmanners in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@ishakhsuvarov ishakhsuvarov added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Jan 22, 2018
@sidolov
Copy link
Contributor

sidolov commented Apr 5, 2018

Hi @okorshenko. Thank you for your report.
The issue has been fixed in #14438 by @dmanners in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

dmanners added a commit to dmanners/magento2 that referenced this issue May 3, 2018
magento-devops-reposync-svc pushed a commit that referenced this issue Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development up for grabs
Projects
None yet
Development

No branches or pull requests

6 participants