62 questions
1
vote
1
answer
121
views
When does Symfony intialize the session, and can you force it to be initialized sooner?
I'm using Symfony 7.2 and EasyAdmin 4. I'm trying to execute code in a trait that recovers the currently logged User and the current Session, and uses them to initialize an attribute of the class it ...
0
votes
1
answer
340
views
"This value should be of type string" in Symfony DataTime validation, while mapping a request
In Symfony 7 app, I'm mapping request with MapQueryString/MapRequestPayload attributes. Controller's endpoint returns validation errors if request's parameter is of the wrong type. Here it is of type ...
0
votes
2
answers
147
views
Create a JSON request with HttpFoundation to be used in a Behat test
I've got a JSON login query which works in curl (ie I'm sending the data and it finds the user). I want to create a behat test to check it, but I cannot reproduce it in my behat test, and the test ...
1
vote
0
answers
160
views
Symfony Request::getContent(true) strange behaviour in wget but not curl
A user is able to upload a file. During the upload the file is scanned. If there is an issue with the file Symfony returns a Response(400) and the rest of the file is not uploaded, saving the user and ...
0
votes
1
answer
94
views
PHP Symfony session variables automatically updated
I'm using the Concrete CMS which leverages the Symfony-HTTP-foundation component for Session management. I have everything working, but I'm curious about some strange behavior I'm seeing. Take this ...
0
votes
1
answer
347
views
Retrieve symfony parameters of RedirectResponse
I use the stand alone HttpFoundation component of Symfony in my MVC app, and native PHP files for the view templates (not Twig).
The functions in the controller can successfully execute a URL ...
1
vote
1
answer
2k
views
No route found for "GET http://localhost:8000/create" after a refresh
I have two pages, one to show the list of agencies, and one to add a new one. I can easily access to http://localhost:8000/create from http://localhost:8000, but if I try to reload the page I get the ...
0
votes
0
answers
639
views
Argument 1 passed to Symfony\Component\HttpFoundation\InputBag::get() must be of the type string, null given
Argument 1 passed to Symfony\Component\HttpFoundation\InputBag::get() must be of the type string, null given, called in D:\Syed Ghazanfar\Futafut\Backend\v2\vendor\laravel\framework\src\Illuminate\...
0
votes
0
answers
202
views
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 ...
0
votes
1
answer
135
views
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)...
0
votes
0
answers
171
views
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.
#[...
4
votes
2
answers
4k
views
How to forward a Symfony Request to another server using the Http Client (with optional changes)?
How to intercept a request and send it with HttpClient to another server and return the response from that server after some modification?
The original request will contain data and files. I am ...
0
votes
0
answers
302
views
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.
1
vote
0
answers
713
views
Symfony HttpFoundation\Request with no user agent specified leads to 403 Forbidden
I am using symfony to create an API to update some dataset. One of the possible update is coming from a third party through an HTTP request which does not include user agent specifications. As a ...
2
votes
2
answers
1k
views
Feature Test in Laravel 8 uses withHeader to set Host invalid?
Since my project has deployed multiple domain names, the API interface that needs to be tested is using the api.example.test domain name as the entrance.
Using $this->get('/v1/ping') in Feature ...
1
vote
2
answers
3k
views
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 ...
1
vote
1
answer
2k
views
How to serve same response from HttpClient in my controller using Symfony?
I have a Controller that must forward the received request (changing some query parameters) to another server, and returns it's response (with same headers, status and body).
I decided to use ...
3
votes
1
answer
893
views
Laravel generates wrong route behind reverse proxy with path prefix
Running Laravel behind Traefik as reverse proxy, with a Path Prefix (eg /api/ => Laravel).
Laravel is served by Nginx and Php-fpm.
Laravel use Symfony HTTP foundation to generate route URL.
Symfony ...
1
vote
1
answer
239
views
Symfony routing allows commas where dots are configurated
I have a route configuration:
<route id="some_route" path="/special/path/{some_strings}">
<default key="_controller">SpecialControllerBundle:Default:index</default>
...
4
votes
2
answers
1k
views
Filtering on Nested Properties: dot to underscore redirect
I'm using Symfony and API Platform and I'd like to filter on nested properties.
While this looks very simple, when I go to:
http://localhost:8000/api/offers?product.color=red
The request is ...
1
vote
0
answers
266
views
Why is Symfony's UploadedFile `getClientOriginalName()` considered unsafe?
The docs only state that it's user-provided input and therefore not to be trusted. That much makes sense since we never trust user input, but in what ways could a malicious user cause damage with this ...
1
vote
1
answer
60
views
Get both fields from url and convert them to variables to query a search
I am trying to get both fields in an api enpoint so that it queries based on that. example.
api/evenSession/123123123/eventSession?token=1234656&filter= chris moreno
my controller searches by ...
1
vote
1
answer
1k
views
How does the Symfony/Http-foundation component handles Http request and response
I've been assigned to a project which needs include the Symfony components in order to re-organize its business logic. However, I got confused by looking at the Symfony HTTP-foundation document. Hope ...
4
votes
0
answers
2k
views
Symfony Binary File Response fails at the end of the download process
I usually don't post any question on Stack Overflow because I always find an answer to whatever problem I'm in trouble with. But here, I haven't found a clear answer so if you can help me, thanks a ...
2
votes
1
answer
4k
views
Symfony HttpFoundation get single file returns null?
I use symfony HttpFoundation for upload files, the FileBag works if I call all(), but if I use get('document_name') it return null.
use Symfony\Component\HttpFoundation\Request;
public function ...
0
votes
2
answers
241
views
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
...
0
votes
1
answer
1k
views
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 ...
0
votes
0
answers
122
views
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 ...
0
votes
0
answers
515
views
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 $...
3
votes
0
answers
473
views
Where is ob_start in Response?
If I use $response->send() then this code is executed:
public static function closeOutputBuffers($targetLevel, $flush)
{
$status = ob_get_status(true);
$level = count($status);
...
0
votes
0
answers
279
views
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 ...
0
votes
1
answer
246
views
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(...
2
votes
2
answers
3k
views
Symfony session (stand alone) cookiename
I use the Symfony http foundation stand alone (aka i installed the http-foundation package with composer inside my non-symfony project). Ik would like to change the name of the session cookie. What ...
2
votes
1
answer
2k
views
Class 'Symfony\Component\HttpFoundation\ParameterBag' not found
I'm getting the following error when I try to run php artisan on a clean install of Laravel 5.1.43 on a Vagrant box. I've listed the versions below.
PHP Fatal error: Class 'Symfony\Component\...
1
vote
1
answer
1k
views
How to Set and Read a Cookie w/ http-foundation, JWT, & .ENV
I have a login processing file in which I am attempting to set a cookie:
$expTime = time() + 3600;
$key = getenv("SECRET_KEY");
$token = array(
"iss" => request()->getBaseUrl(),
"sub" =&...
0
votes
1
answer
4k
views
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;
...
0
votes
2
answers
459
views
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/...
5
votes
1
answer
5k
views
How do I retrieve basic auth credentials from Symfony's HttpFoundation component?
I want to retrieve the basic authentication credentials from Symfony's HttpFoundation component. A cursory look at the docs reveals nothing; is there a way I can do it?
(I'm using the HttpFoundation ...
2
votes
0
answers
306
views
Symfony2 standalone HttpFoundation component performance loss
I'm currently developing a base application for my projects and something doesn't seem right.
First of all, I'm using PHP 7, Apache.
Composer is first called, it does its magic and all the goods. ...
1
vote
1
answer
511
views
BinaryFileResponse not working correctly in Firefox - Image corrupt or truncated
I'm facing some weird issues when Firefox tries to load PHP generated image files.
Occurs on Mac and Windows (7, 8, 10).
The Firefox console says:
Image corrupt or truncated.
Everything works fine ...
0
votes
1
answer
853
views
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 ...
2
votes
2
answers
3k
views
Symfony BinaryFileResponse cuts off end of file?
I have a ZIP File to be served via Symfony. The controller looks like this:
$headers = [
'Content-Type' => 'application/zip',
'Content-Disposition' => 'attachment; filename="archive.zip"...
3
votes
1
answer
1k
views
How to correctly use silex "finish" middleware to process heavy operations in background?
I'm writing an app on Silex in accordance with the documentation but with some additions. I declare the route, after middleware for route and finish middleware for app.
$app->put('/request/', ...
2
votes
0
answers
57
views
Doctrine file uploading error
Ran into a strange problem - after submitting a form via POST with enctype="multipart/form-data", Doctrine crashes with Fatal Error:
Fatal error: require(): Failed opening required '[PATH/TO/DOCTRINE]...
4
votes
1
answer
1k
views
Sf2 RedirectResponse not working
I am using the HttpFoundation component in my project without using the full Symfony2 framework. I try to make a RedirectResponse if some credentials are true and redirect the user (like stated in the ...
0
votes
0
answers
38
views
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
3
votes
2
answers
2k
views
new (Json)Response shows blank page (Symfony HttpFoundation)
I am using the HttpFoundation in my small project: use \Symfony\Component\HttpFoundation\JsonResponse as JsonResponse;
Unfortunately all my responses (tried JsonResponse, Response and ...
2
votes
2
answers
2k
views
pdf document - setting the window title (html header)
I'm using this to output a pdf document :
$response = new \Symfony\Component\HttpFoundation\Response(file_get_contents($thefile), 200, [
'Content-Description' => 'File transfer',
'Content-...
2
votes
1
answer
515
views
(Symfony 2.4) The Request Stack what is The Request Stack
About Symfony Request Stack I've read below page multiple time . and also I haven't found another blog post or some thing on web world introduce this Symfony class.
"http://symfony.com/blog/new-in-...
2
votes
1
answer
201
views
Database request in routing controller
I'm making a website with categories and products. The categories and the products are both contenttypes. Categories can't be a taxonomy type because the editor of the website has to change data for ...