0

I am not certain if this is expected behavior, composer.json is modified as escaped json after running composer install.

My initial composer.json:

{
    "name": "digitalstate/platform-application",
    "description": "DigitalState Platform Application",
    "homepage": "https://github.com/DigitalState/Platform-Application.git",
    "keywords": ["DigitalState"],
    "license": "MIT",
    "autoload": {
        "psr-4": {
            "": "src/"
        }
    },
    "repositories": {
        "composer": {
            "type": "composer",
            "url": "https://packagist.orocrm.com"
        },
        "dsplatform": {
            "type": "vcs",
            "url": "git@bitbucket.org:villemontreal/dsplatform.git"
        }
    },
    "require": {
        "oro/platform": "2.0.5",
        "oro/platform-serialised-fields": "2.0.2",
        "knplabs/knp-time-bundle": "dev-master#272b9d6c127db1a648d2729bc821f0ed19a274d4",
        "craue/formflow-bundle": "dev-master#47b2b7af9b4385f97470ecb858f3a9c03e431587",
        "digitalstate/bpm-camunda-sdk": "dev-master",
        "lexik/jwt-authentication-bundle": "^2.2",
        "mandrill/mandrill": "^1.0",
        "aws/aws-sdk-php": "^3.28",
        "dunglas/doctrine-json-odm": " dev-master",
        "ramsey/uuid": "^3.6"
    },
    "require-dev": {
        "sensio/generator-bundle": "3.1.2",
        "behat/behat": "3.2.2",
        "behat/mink-extension": "2.2.*",
        "behat/mink-selenium2-driver": "1.*",
        "behat/symfony2-extension": "2.1.1",
        "nelmio/alice": "2.2.*",
        "phpunit/phpunit": "5.7.*",
        "phpunit/phpunit-selenium": "3.0.*",
        "johnkary/phpunit-speedtrap": "1.0.*",
        "mybuilder/phpunit-accelerator": "1.2.*",
        "squizlabs/php_codesniffer": "2.7.*",
        "phpmd/phpmd": "2.5.*",
        "sebastian/phpcpd": "2.0.*",
        "leaphub/phpcs-symfony2-standard": "~2.0.0",
        "league/factory-muffin": "^3.0",
        "league/factory-muffin-faker": "^2.0",
        "codeception/codeception": "^2.2",
        "phploc/phploc": "^3.0"
    },
    "config": {
        "component-dir": "web/bundles/components",
        "bin-dir": "bin"
    },
    "scripts": {
        "post-install-cmd": [
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::checkComposerPlugin",
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::setPermissions",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::installAssets",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::setAssetsVersion"
        ],
        "post-update-cmd": [
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::checkComposerPlugin",
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::setPermissions",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::installAssets",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::setAssetsVersion"
        ]
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "env-map": {
                "server": "SERVER",
                "database_host": "APP_DB_HOST",
                "database_user": "APP_DB_USER",
                "database_password": "APP_DB_PASSWORD",
                "database_name": "APP_DB_NAME"
            },
            "file": "app/config/parameters.yml"
        },
        "asset-installer-paths": {
            "npm-asset-library": "web/bundles/npmassets",
            "bower-asset-library": "web/bundles/bowerassets"
        }
    }
}

Output of composer.json after running composer install:

{
    "name": "digitalstate\/platform-application",
    "description": "DigitalState Platform Application",
    "homepage": "https:\/\/github.com\/DigitalState\/Platform-Application.git",
    "keywords": [
        "DigitalState"
    ],
    "license": "MIT",
    "autoload": {
        "psr-4": {
            "": "src\/"
        }
    },
    "repositories": {
        "composer": {
            "type": "composer",
            "url": "https:\/\/packagist.orocrm.com"
        },
        "dsplatform": {
            "type": "vcs",
            "url": "git@bitbucket.org:villemontreal\/dsplatform.git"
        }
    },
    "require": {
        "oro\/platform": "2.0.5",
        "oro\/platform-serialised-fields": "2.0.2",
        "knplabs\/knp-time-bundle": "dev-master#272b9d6c127db1a648d2729bc821f0ed19a274d4",
        "craue\/formflow-bundle": "dev-master#47b2b7af9b4385f97470ecb858f3a9c03e431587",
        "digitalstate\/bpm-camunda-sdk": "dev-master",
        "lexik\/jwt-authentication-bundle": "^2.2",
        "mandrill\/mandrill": "^1.0",
        "aws\/aws-sdk-php": "^3.28",
        "dunglas\/doctrine-json-odm": " dev-master",
        "ramsey\/uuid": "^3.6"
    },
    "require-dev": {
        "sensio\/generator-bundle": "3.1.2",
        "behat\/behat": "3.2.2",
        "behat\/mink-extension": "2.2.*",
        "behat\/mink-selenium2-driver": "1.*",
        "behat\/symfony2-extension": "2.1.1",
        "nelmio\/alice": "2.2.*",
        "phpunit\/phpunit": "5.7.*",
        "phpunit\/phpunit-selenium": "3.0.*",
        "johnkary\/phpunit-speedtrap": "1.0.*",
        "mybuilder\/phpunit-accelerator": "1.2.*",
        "squizlabs\/php_codesniffer": "2.7.*",
        "phpmd\/phpmd": "2.5.*",
        "sebastian\/phpcpd": "2.0.*",
        "leaphub\/phpcs-symfony2-standard": "~2.0.0",
        "league\/factory-muffin": "^3.0",
        "league\/factory-muffin-faker": "^2.0",
        "codeception\/codeception": "^2.2",
        "phploc\/phploc": "^3.0"
    },
    "config": {
        "component-dir": "web\/bundles\/components",
        "bin-dir": "bin"
    },
    "scripts": {
        "post-install-cmd": [
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::checkComposerPlugin",
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::setPermissions",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::installAssets",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::setAssetsVersion"
        ],
        "post-update-cmd": [
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::checkComposerPlugin",
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::setPermissions",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::installAssets",
            "Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::setAssetsVersion"
        ]
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "env-map": {
                "database_driver": "APP_DB_DRIVER",
                "database_host": "APP_DB_HOST",
                "database_port": "APP_DB_PORT",
                "database_name": "APP_DB_NAME",
                "database_user": "APP_DB_USER",
                "database_password": "APP_DB_PASSWORD",
                "mailer_transport": "APP_MAILER_TRANSPORT",
                "mailer_host": "APP_MAILER_HOST",
                "mailer_port": "APP_MAILER_PORT",
                "mailer_encryption": "APP_MAILER_ENCRYPTION",
                "mailer_user": "APP_MAILER_USER",
                "mailer_password": "APP_MAILER_PASSWORD",
                "websocket_bind_port": "APP_WEBSOCKET_BACKEND_PORT",
                "websocket_backend_port": "APP_WEBSOCKET_BACKEND_PORT",
                "websocket_frontend_port": "APP_WEBSOCKET_FRONTEND_PORT",
                "installed": "APP_IS_INSTALLED",
                "secret": "APP_SECRET"
            },
            "file": "app\/config\/parameters.yml"
        },
        "asset-installer-paths": {
            "npm-asset-library": "web\/bundles\/npmassets",
            "bower-asset-library": "web\/bundles\/bowerassets"
        }
    }
}

Is this expected behavior?

Stephane Gosselin
  • 9,030
  • 5
  • 42
  • 65
  • No, that's not expected behavior. I'd guess future attempts to run Composer will fail because of the `%`, too. I'd be inclined to blame one of the `post-install-cmd` or `post-update-cmd` scripts. – ceejayoz Jul 27 '17 at 16:40
  • @ceejayoz - This was my initial impression too, but subsequent composer calls run fine, and I see there have been new releases of composer lately that add json encoding classes. Just did not have time to go through their past changes to figure if this is the new behavior. Now, post-install and post-update I had not thought of this, I will follow this lead, thanks! – Stephane Gosselin Jul 27 '17 at 16:42
  • That's very odd. The `%` really should break the `json_decode` calls Composer is presumably using internally. – ceejayoz Jul 27 '17 at 16:47
  • @ceejayoz - The % was through git-diff, is not there when I opened composer.json in vi, I updated the question. I re-ran composer and confirmed there is no %. but the slashes are always escaped, this is on 3 different environnements with latest composer installed. – Stephane Gosselin Jul 27 '17 at 16:51
  • OK, that makes more sense. Sounds like they just switched up the options for `json_encode` a little, then - http://php.net/json_encode has a `JSON_UNESCAPED_SLASHES` flag. Both are valid. See https://stackoverflow.com/questions/1580647/json-why-are-forward-slashes-escaped. – ceejayoz Jul 27 '17 at 16:57

0 Answers0