Questions tagged [symfony-http-foundation]

Symfony is a set of reusable PHP components. The HttpFoundation component defines an object-oriented layer for the HTTP specification.

Symfony is a set of reusable PHP components. The HttpFoundation component defines an object-oriented layer for the HTTP specification.

Useful links

61 questions
0
votes
0 answers

Parse nested data from HTTP requests without form classes with Symfony

Our Symfny application allows to print labels on a sheet with 6 labels. The user can specify an additional text for each label and whether to print it or not. At the moment HTTP GET parameters contain the…
fishbone
  • 3,140
  • 2
  • 37
  • 50
0
votes
1 answer

SteamedResponse not working in lumen on other server

I am using Lumen for a set of APIs. using streamedresponse built in library of symphony. use Symfony\Component\HttpFoundation\StreamedResponse; protected function getFileResponseHeaders($filename) { return [ 'Cache-Control' =>…
Shahid Rafiq
  • 669
  • 1
  • 12
  • 27
0
votes
0 answers

How to read the reflection data on primitive type?

The original post: https://github.com/symfony/symfony/discussions/43960 I want to use a QueryParam attribute to read a query string into a Controller method argument. An example controller class. #[Route("/posts")] class PostController extends…
Hantsy
  • 8,006
  • 7
  • 64
  • 109
0
votes
0 answers

In drupal 8 how i can create 410 page status for my pages unpublished

For unpublished pages, the current behavior is a 404 error, I wish to have an 410 error only for the pages which were previously published and subsequently unpublished. Is it feasible ? Thank you.
0
votes
2 answers

Remove parameters from Symfony 4.4 HttpFoundation\Request and re-generate URL

I need to re-generate the URL of my page, removing the additional parameters. For example: when I receive: /bao1/bao2/?removeMe1=anything&keepMe1=anything&removeMe2=&keepMe2=anything I want to generate the URL with removeMe query var removed, but…
0
votes
1 answer

Symfony 2.1.11 Image Data Response adding additional byte to start of response body

I'm trying to resurrect an old Symfony 2.11 project for a client who hasn't the budget for a re-write to upgrade it to something more modern. One of the routes provides raw image data in it's response $resp = new…
0
votes
1 answer

Shouldn't Response::isOk() return true for an HTTP status between 200 and 299?

I'm using Symfony to build REST APIs. I'm in a situation where I want to do some actions in the kernel.terminate event, but I want to make sure that the request was successfully processed before doing so. For that, as I use REST conventions and…
Boulzy
  • 446
  • 4
  • 11
0
votes
0 answers

In Symfony2, is there a way to tell when a Request/Response has completed?

I'm trying to trigger an event when a download completes. Currently, my Controller just returns the Response, but as far as I can tell there's not way for me to know when the download has actually completed.
robert.bo.roth
  • 1,343
  • 3
  • 14
  • 24
0
votes
0 answers

How to get PUT parameters using HttpFoundation

How can I get PUT body parameters using HttpFoundation component (without Symfony)? According the docs Request::createFromGlobals only about POST, GET ... but not PUT. So here I cannot use like $request->request->all(), it will be empty. I believe…
0
votes
0 answers

In PhpStorm when using Request::createFromGlobals - warning says "field x not found in static"

This is happening in a legacy PHP application that was not built using the Symfony framework, only parts of Http-Foundation are used. So nothing is creating the Request for us, instead we create it using GLOBALS in some setup code. This was done as…
0
votes
1 answer

Cannot read "files" in HTTP Foundation Symfony 3.3

Recently I updated a symfony project from 3.2 to 3.3. I have an issue with a simple POST with a file. The file is not in the filebag of the http foundation object Request. public function sendAction(Request $request){ dump($request->files); …
d3cima
  • 729
  • 1
  • 10
  • 31
0
votes
1 answer

Test method with request object in symfony and phpunit

I have the class that returns values from HttpFoundation request object. I want to write tests for that class and I have problem. That is my class: class RequestCollected { private $request; public function __construct(Request $request) …
jager91
  • 272
  • 6
  • 15
0
votes
2 answers

Changing the Request, retrieving data from the Session

Scenario: I have no AJAX. I have a search form with GET method and csrf_protection disabled that filters the entities showed and paginated in myEntityListAction, reachable at the uri /myapp/myentity/list The user opens /myapp/myentity/list, submit…
ste
  • 1,479
  • 10
  • 19
0
votes
1 answer

Processing XML file in PHP and send data little by little

I am trying to read an XML file in a Symfony project, to send the data to the front end. As the XML file is huge, I am using a combination of XMLReader and SimpleXML (as suggested in this thread: How to use XMLReader in PHP?). Here is my code for…
Mahcih
  • 23
  • 5
0
votes
0 answers

Request class: what is the porpouse for defining $request, $files, $query, etc, as public variables?

Why the variables $request, $files and $query are defined as public ? Why they were not defined private or protected? Check here the Request class
tirenweb
  • 30,963
  • 73
  • 183
  • 303