Symfony 从 4.2 更新到 4.3 导致 Web Profiler 崩溃
Symfony update from 4.2 to 4.3 caused Web Profiler to break
我 运行 composer update
现在收到大量弃用警告:
> [2019-06-03 18:08:41] request.INFO: Matched route "_wdt".
> {"route":"_wdt","route_parameters":{"_route":"_wdt","_controller":"web_profiler.controller.profiler::toolbarAction","token":"9354bc"},"request_uri":"http://local
> host:8080/_wdt/9354bc","method":"GET"} [] [2019-06-03 18:08:42]
> request.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError:
> "Impossible to access an attribute ("nb_errors") on a string variable
> ("O:39:"Symfony\Component\VarDumper\Cloner\Data":6:{s:45:"ymf
> ony\Component\VarDumper\Cloner\Data
Web Profiler 工具栏 因以下错误而损坏:
An error occurred while loading the web debug toolbar.
然而当我这样做时 bin/console --version
我得到:
Symfony 4.3.0 (env: dev, debug: true)
什么给? composer.json 文件如何使 Composer 甚至可以更新到 4.3
?
这是我现在的 composer.json:
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"doctrine/doctrine-migrations-bundle": "^2.0",
"easycorp/easyadmin-bundle": "^1.17",
"iio/libmergepdf": "~3.0",
"ramsey/uuid": "^3.5",
"sensio/framework-extra-bundle": "^5.1",
"sensiolabs/security-checker": "^5.0",
"simplisti/jasper-starter": "dev-master",
"symfony/asset": "4.2.*",
"symfony/console": "4.2.*",
"symfony/dotenv": "4.2.*",
"symfony/expression-language": "4.2.*",
"symfony/flex": "^1.1",
"symfony/form": "4.2.*",
"symfony/framework-bundle": "4.2.*",
"symfony/ldap": "^4.0",
"symfony/monolog-bundle": "^3.3",
"symfony/options-resolver": "^4.0",
"symfony/orm-pack": "*",
"symfony/process": "4.2.*",
"symfony/security-bundle": "4.2.*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/yaml": "4.2.*"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"phing/phing": "^2.14",
"symfony/browser-kit": "^4.0",
"symfony/css-selector": "^4.0",
"symfony/debug": "^4.0",
"symfony/debug-pack": "^1.0",
"symfony/maker-bundle": "^1.7",
"symfony/phpunit-bridge": "^4.0",
"symfony/profiler-pack": "^1.0"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"classmap": [
"src/Legacy/"
],
"psr-4": {
"App\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\Tests\": "tests/"
}
},
"replace": {
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
"security-checker security:check": "script"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"id": "01C3XNQSBGC1MSASSGCW6TKGXB",
"allow-contrib": false
}
}
}
这是 vendor/symfony/web-profiler-bundle/Resources/views/Collector/form.html.twig
中的一个问题
正在尝试访问 collector.data.nb_errors
,但 collector.data
是 null
。
打开composer.json。将所有 4.2 引用更新为 4.3。您可能将 symfony/web-profiler-bundle 作为 4.2 而不是 4.3。保存,然后作曲家更新。
我来晚了一点,但如果你想保留 symfony 4.2,你只需要在 composer.json[=13] 中将你所有的 symfony 依赖项从“^4”替换为“4.2.*” =]
例如,在您的 json 中您有
"symfony/ldap": "^4.0"
,所以当你 运行 composer show
时,你会看到一些依赖项升级到 4.3,带有 composer update
。
我 运行 composer update
现在收到大量弃用警告:
> [2019-06-03 18:08:41] request.INFO: Matched route "_wdt".
> {"route":"_wdt","route_parameters":{"_route":"_wdt","_controller":"web_profiler.controller.profiler::toolbarAction","token":"9354bc"},"request_uri":"http://local
> host:8080/_wdt/9354bc","method":"GET"} [] [2019-06-03 18:08:42]
> request.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError:
> "Impossible to access an attribute ("nb_errors") on a string variable
> ("O:39:"Symfony\Component\VarDumper\Cloner\Data":6:{s:45:"ymf
> ony\Component\VarDumper\Cloner\Data
Web Profiler 工具栏 因以下错误而损坏:
An error occurred while loading the web debug toolbar.
然而当我这样做时 bin/console --version
我得到:
Symfony 4.3.0 (env: dev, debug: true)
什么给? composer.json 文件如何使 Composer 甚至可以更新到 4.3
?
这是我现在的 composer.json:
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"doctrine/doctrine-migrations-bundle": "^2.0",
"easycorp/easyadmin-bundle": "^1.17",
"iio/libmergepdf": "~3.0",
"ramsey/uuid": "^3.5",
"sensio/framework-extra-bundle": "^5.1",
"sensiolabs/security-checker": "^5.0",
"simplisti/jasper-starter": "dev-master",
"symfony/asset": "4.2.*",
"symfony/console": "4.2.*",
"symfony/dotenv": "4.2.*",
"symfony/expression-language": "4.2.*",
"symfony/flex": "^1.1",
"symfony/form": "4.2.*",
"symfony/framework-bundle": "4.2.*",
"symfony/ldap": "^4.0",
"symfony/monolog-bundle": "^3.3",
"symfony/options-resolver": "^4.0",
"symfony/orm-pack": "*",
"symfony/process": "4.2.*",
"symfony/security-bundle": "4.2.*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/yaml": "4.2.*"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"phing/phing": "^2.14",
"symfony/browser-kit": "^4.0",
"symfony/css-selector": "^4.0",
"symfony/debug": "^4.0",
"symfony/debug-pack": "^1.0",
"symfony/maker-bundle": "^1.7",
"symfony/phpunit-bridge": "^4.0",
"symfony/profiler-pack": "^1.0"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"classmap": [
"src/Legacy/"
],
"psr-4": {
"App\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\Tests\": "tests/"
}
},
"replace": {
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
"security-checker security:check": "script"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"id": "01C3XNQSBGC1MSASSGCW6TKGXB",
"allow-contrib": false
}
}
}
这是 vendor/symfony/web-profiler-bundle/Resources/views/Collector/form.html.twig
正在尝试访问 collector.data.nb_errors
,但 collector.data
是 null
。
打开composer.json。将所有 4.2 引用更新为 4.3。您可能将 symfony/web-profiler-bundle 作为 4.2 而不是 4.3。保存,然后作曲家更新。
我来晚了一点,但如果你想保留 symfony 4.2,你只需要在 composer.json[=13] 中将你所有的 symfony 依赖项从“^4”替换为“4.2.*” =]
例如,在您的 json 中您有
"symfony/ldap": "^4.0"
,所以当你 运行 composer show
时,你会看到一些依赖项升级到 4.3,带有 composer update
。