Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

michael-2020's avatar

"Symfony\Component\HttpFoundation\Response::create()" method is deprecated on error page

Hi,

i create a default laravel project over command

composer create-project --prefer-dist laravel/laravel blog

the php artisan serveer start nomaly over command

php artisan serve

If I get an error in my code the error page with the stacktace should be displayed. But i came 500 error site. In server log:

PHP Fatal error:  Uncaught ErrorException: Since symfony/http-foundation 5.1: The "Symfony\Component\HttpFoundation\Response::create()" method is deprecated, use "new Symfony\Component\HttpFoundation\Response()" instead. in C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php:25
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(16384, 'Since symfony/h...', 'C:\Temp\Neuer O...', 25, Array)
#1 C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php(25): trigger_error('Since symfony/h...', 16384)
#2 C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\http-foundation\Response.php(237): trigger_deprecation('symfony/http-fo...', '5.1', 'The "%s()" meth...', 'Symfony\Compone...', 'Symfony\Compone...')
#3 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(470): Symfony\Component\HttpFoundation\Response::create('<!doctype html>...', 500, Array)
#4 C:\Temp\Neuer Ordner (3)\blog\vendor\lara in C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php on line 25
[Wed Sep 30 19:01:33 2020] PHP Fatal error:  Uncaught ErrorException: Since symfony/http-foundation 5.1: The "Symfony\Component\HttpFoundation\Response::create()" method is deprecated, use "new Symfony\Component\HttpFoundation\Response()" instead. in C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php:25
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(16384, 'Since symfony/h...', 'C:\Temp\Neuer O...', 25, Array)
#1 C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php(25): trigger_error('Since symfony/h...', 16384)
#2 C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\http-foundation\Response.php(237): trigger_deprecation('symfony/http-fo...', '5.1', 'The "%s()" meth...', 'Symfony\Compone...', 'Symfony\Compone...')
#3 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(470): Symfony\Component\HttpFoundation\Response::create('<!doctype html>...', 500, Array)
#4 C:\Temp\Neuer Ordner (3)\blog\vendor\lara in C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php on line 25

Is the error from my computer or is the general problem?

Info of my computer: php -v

PHP 7.4.10 (cli) (built: Sep  1 2020 16:52:21) ( NTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans

composer show -i

asm89/stack-cors                   v2.0.1    Cross-origin resource sharing library and stack middleware
brick/math                         0.9.1     Arbitrary-precision arithmetic library
dnoegel/php-xdg-base-dir           v0.1.1    implementation of xdg base directory specification for php
doctrine/inflector                 2.0.3     PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
doctrine/instantiator              1.3.1     A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                     1.2.1     PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
dragonmantank/cron-expression      3.0.1     CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
egulias/email-validator            2.1.22    A library for validating emails against several RFCs
facade/flare-client-php            1.3.6     Send PHP errors to Flare
facade/ignition                    2.3.7     A beautiful error page for Laravel applications.
facade/ignition-contracts          1.0.1     Solution contracts for Ignition
fideloper/proxy                    4.4.0     Set trusted proxies for Laravel
filp/whoops                        2.7.3     php error handling for cool kids
fruitcake/laravel-cors             v2.0.2    Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application
fzaninotto/faker                   v1.9.1    Faker is a PHP library that generates fake data for you.
graham-campbell/result-type        v1.0.1    An Implementation Of The Result Type
guzzlehttp/guzzle                  7.1.1     Guzzle is a PHP HTTP client library
guzzlehttp/promises                1.4.0     Guzzle promises library
guzzlehttp/psr7                    1.7.0     PSR-7 message implementation that also provides common utility methods
hamcrest/hamcrest-php              v2.0.1    This is the PHP port of Hamcrest Matchers
laravel/framework                  v8.7.1    The Laravel Framework.
laravel/tinker                     v2.4.2    Powerful REPL for the Laravel framework.
league/commonmark                  1.5.5     Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and Github-Flavored Markdown (GFM)
league/flysystem                   1.1.3     Filesystem abstraction: Many filesystems, one API.
league/mime-type-detection         1.5.0     Mime-type detection for Flysystem
mockery/mockery                    1.4.2     Mockery is a simple yet flexible PHP mock object framework
monolog/monolog                    2.1.1     Sends your logs to files, sockets, inboxes, databases and various web services
myclabs/deep-copy                  1.10.1    Create deep copies (clones) of your objects
nesbot/carbon                      2.40.1    An API extension for DateTime that supports 281 different languages.
nikic/php-parser                   v4.10.2   A PHP parser written in PHP
nunomaduro/collision               v5.0.2    Cli error handling for console/command-line PHP applications.
opis/closure                       3.5.7     A library that can be used to serialize closures (anonymous functions) and arbitrary objects.
paragonie/random_compat            v9.99.99  PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest                   2.0.1     Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                    3.0.2     Library for handling version information and constraints
phpdocumentor/reflection-common    2.2.0     Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock  5.2.2     With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver        1.4.0     A PSR-5 based resolver of Class names, Types and Structural Element Names
phpoption/phpoption                1.7.5     Option Type for PHP
phpspec/prophecy                   1.12.1    Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage          9.1.11    Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator          3.0.5     FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                3.1.1     Invoke callables with a timeout
phpunit/php-text-template          2.0.3     Simple template engine.
phpunit/php-timer                  5.0.2     Utility class for timing
phpunit/phpunit                    9.3.11    The PHP Unit Testing framework.
psr/container                      1.0.0     Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher               1.0.0     Standard interfaces for event handling.
psr/http-client                    1.0.1     Common interface for HTTP clients
psr/http-message                   1.0.1     Common interface for HTTP messages
psr/log                            1.1.3     Common interface for logging libraries
psr/simple-cache                   1.0.1     Common interfaces for simple caching
psy/psysh                          v0.10.4   An interactive shell for modern PHP.
ralouphie/getallheaders            3.0.3     A polyfill for getallheaders.
ramsey/collection                  1.1.1     A PHP 7.2+ library for representing and manipulating collections.
ramsey/uuid                        4.1.1     A PHP library for generating and working with universally unique identifiers (UUIDs).
scrivo/highlight.php               v9.18.1.2 Server side syntax highlighter that supports 185 languages. It's a PHP port of highlight.js
sebastian/cli-parser               1.0.1     Library for parsing CLI options
sebastian/code-unit                1.0.6     Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 2.0.3     Looks up which function or method a line of code belongs to
sebastian/comparator               4.0.5     Provides the functionality to compare PHP values for equality
sebastian/complexity               2.0.1     Library for calculating the complexity of PHP code units
sebastian/diff                     4.0.3     Diff implementation
sebastian/environment              5.1.3     Provides functionality to handle HHVM/PHP environments
sebastian/exporter                 4.0.3     Provides the functionality to export PHP variables for visualization
sebastian/global-state             5.0.1     Snapshotting of global state
sebastian/lines-of-code            1.0.1     Library for counting the lines of code in PHP source code
sebastian/object-enumerator        4.0.3     Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector         2.0.3     Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context        4.0.3     Provides functionality to recursively process PHP variables
sebastian/resource-operations      3.0.3     Provides a list of PHP built-in functions that operate on resources
sebastian/type                     2.2.2     Collection of value objects that represent the types of the PHP type system
sebastian/version                  3.0.2     Library that helps with managing the version number of Git-hosted PHP projects
swiftmailer/swiftmailer            v6.2.3    Swiftmailer, free feature-rich PHP mailer
symfony/console                    v5.1.6    Symfony Console Component
symfony/css-selector               v5.1.6    Symfony CssSelector Component
symfony/deprecation-contracts      v2.2.0    A generic function and convention to trigger deprecation notices
symfony/error-handler              v5.1.6    Symfony ErrorHandler Component
symfony/event-dispatcher           v5.1.6    Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v2.2.0    Generic abstractions related to dispatching event
symfony/finder                     v5.1.6    Symfony Finder Component
symfony/http-client-contracts      v2.2.0    Generic abstractions related to HTTP clients
symfony/http-foundation            v5.1.6    Symfony HttpFoundation Component
symfony/http-kernel                v5.1.6    Symfony HttpKernel Component
symfony/mime                       v5.1.6    A library to manipulate MIME messages
symfony/polyfill-ctype             v1.18.1   Symfony polyfill for ctype functions
symfony/polyfill-iconv             v1.18.1   Symfony polyfill for the Iconv extension
symfony/polyfill-intl-grapheme     v1.18.1   Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-idn          v1.18.1   Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.18.1   Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.18.1   Symfony polyfill for the Mbstring extension
symfony/polyfill-php70             v1.18.1   Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-php72             v1.18.1   Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73             v1.18.1   Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80             v1.18.1   Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/process                    v5.1.6    Symfony Process Component
symfony/routing                    v5.1.6    Symfony Routing Component
symfony/service-contracts          v2.2.0    Generic abstractions related to writing services
symfony/string                     v5.1.6    Symfony String component
symfony/translation                v5.1.6    Symfony Translation Component
symfony/translation-contracts      v2.2.0    Generic abstractions related to translation
symfony/var-dumper                 v5.1.6    Symfony mechanism for exploring and dumping PHP variables
theseer/tokenizer                  1.2.0     A small library for converting tokenized PHP source code into XML and potentially other formats
tijsverkoyen/css-to-inline-styles  2.2.3     CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.
vlucas/phpdotenv                   v5.2.0    Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
voku/portable-ascii                1.5.3     Portable ASCII library - performance optimized (ascii) string functions for php.
webmozart/assert                   1.9.1     Assertions to validate method input/output with nice error messages.
0 likes
11 replies
bobbybouwmann's avatar

I tried it myself and it works just fine. So it seems it's not a dependency issue for new projects. Can you run composer update to check if something is changed in there?

5 likes
michael-2020's avatar

my only change in the project is file resources\views\welcome.blade.php . I replace line

<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

with

<html lang="{{ str_repdddlace('_', '-', app()->getLocale()) }}">

to get the error Page

laracoft's avatar

@michael-2020 my version is

symfony/http-foundation            v5.1.5	

Can you try removing then entire vendor folder and composer update again? It also sounds like this is a new project. What Laravel version are you on?

# php artisan --version
Laravel Framework 8.6.0
michael-2020's avatar

an i became the version

symfony/http-foundation            v5.1.6    Symfony HttpFoundation Component
php artisan --version
Laravel Framework 8.7.1
michael-2020's avatar

The problem still exists. Is this only problem on Windows?

laracoft's avatar

@michael-2020 Why is the server log filled with C:\Temp\...? Could you clear out the whole C:\Temp?

michael-2020's avatar

Log file:

[2020-10-01 10:21:59] local.ERROR: Since symfony/http-foundation 5.1: The "Symfony\Component\HttpFoundation\Response::create()" method is deprecated, use "new Symfony\Component\HttpFoundation\Response()" instead. {"exception":"[object] (ErrorException(code: 0): Since symfony/http-foundation 5.1: The \"Symfony\Component\HttpFoundation\Response::create()\" method is deprecated, use \"new Symfony\Component\HttpFoundation\Response()\" instead. at C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php:25)
[stacktrace]
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(16384, 'Since symfony/h...', 'C:\\Temp\\Neuer O...', 25, Array)
#1 C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php(25): trigger_error('Since symfony/h...', 16384)
#2 C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\http-foundation\Response.php(237): trigger_deprecation('symfony/http-fo...', '5.1', 'The \"%s()\" meth...', 'Symfony\\Compone...', 'Symfony\\Compone...')
#3 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(470): Symfony\Component\HttpFoundation\Response::create('<!doctype html>...', 500, Array)
#4 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(447): Illuminate\Foundation\Exceptions\Handler->convertExceptionToResponse(Object(ErrorException))
#5 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(335): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Object(ErrorException))
#6 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(416): Illuminate\Foundation\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(ErrorException))
#7 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(114): Illuminate\Foundation\Http\Kernel->renderException(Object(Illuminate\Http\Request), Object(ErrorException))
#8 C:\Temp\Neuer Ordner (3)\blog\public\index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#9 C:\Temp\Neuer Ordner (3)\blog\server.php(21): require_once('C:\\Temp\\Neuer O...')
#10 {main}
"} 
[2020-10-01 10:21:59] local.ERROR: Uncaught ErrorException: Since symfony/http-foundation 5.1: The "Symfony\Component\HttpFoundation\Response::create()" method is deprecated, use "new Symfony\Component\HttpFoundation\Response()" instead. in C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php:25
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(16384, 'Since symfony/h...', 'C:\Temp\Neuer O...', 25, Array)
#1 C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php(25): trigger_error('Since symfony/h...', 16384)
#2 C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\http-foundation\Response.php(237): trigger_deprecation('symfony/http-fo...', '5.1', 'The "%s()" meth...', 'Symfony\Compone...', 'Symfony\Compone...')
#3 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(470): Symfony\Component\HttpFoundation\Response::create('<!doctype html>...', 500, Array)
#4 C:\Temp\Neuer Ordner (3)\blog\vendor\lara {"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Uncaught ErrorException: Since symfony/http-foundation 5.1: The \"Symfony\Component\HttpFoundation\Response::create()\" method is deprecated, use \"new Symfony\Component\HttpFoundation\Response()\" instead. in C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php:25
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(16384, 'Since symfony/h...', 'C:\\Temp\\Neuer O...', 25, Array)
#1 C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php(25): trigger_error('Since symfony/h...', 16384)
#2 C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\http-foundation\Response.php(237): trigger_deprecation('symfony/http-fo...', '5.1', 'The \"%s()\" meth...', 'Symfony\\Compone...', 'Symfony\\Compone...')
#3 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(470): Symfony\Component\HttpFoundation\Response::create('<!doctype html>...', 500, Array)
#4 C:\Temp\Neuer Ordner (3)\blog\vendor\lara at C:\Temp\Neuer Ordner (3)\blog\vendor\symfony\deprecation-contracts\function.php:25)
[stacktrace]
#0 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(143): Symfony\Component\ErrorHandler\Error\FatalError->__construct()
#1 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(130): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalErrorFromPhpError()
#2 C:\Temp\Neuer Ordner (3)\blog\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(0): Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#3 {main}
"} 
michael-2020's avatar

i had copy project folder to centos 7 server an error page run.

Please or to participate in this conversation.