I have a code that generates a CSV file, using Response but I got an extra data which I woudl like to elminate, this extra data is: <! -- STRACE__TIMER__BREAK --> At this time Im not sure if is PHP or the server. Someone has any idea why is happining this issue?
My code:
$rows = array();
foreach ($entities as $entity) {
$data = ........ // here is the array //
$rows[] = implode(';', $data);
}
$content = implode("\n", $rows);
$response = new Response($content);
$response->headers->set('Content-Type', 'text/csv');
$response->headers->set('Content-Disposition', $filename);
return $response;
The file appears like this:
31/03/2021;1;03;2183752;06140809820010;CREDOMATIC, S.A. DE C.V.;0.00;0.00;0.00;3.78;0.00;0.00;0.49;4.27;3 31/03/2021;1;03;2183851;06140809820010;CREDOMATIC, S.A. DE C.V.;0.00;0.00;0.00;70.89;0.00;0.00;9.22;80.11;3 31/03/2021;1;03;2325856;06140809820010;CREDOMATIC, S.A. DE C.V.;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;3 31/03/2021;1;03;2325857;06140809820010;CREDOMATIC, S.A. DE C.V.;0.00;0.00;0.00;0.00;0.00;0.00;0.00;0.00;3 <! -- STRACE__TIMER__BREAK -->
Strangely, I found that line in the config file app.php
/* START HOST DEBUG CODE */
class LastSay
{
public function __construct()
{
$ipList = array('67.23.232.183','72.29.91.30', '67.23.232.178', '2607:fcd8:a:5:ce9b:a1b2:b2f6:6b7c');
if( in_array( $_SERVER['REMOTE_ADDR'] , $ipList ) )
{
file_put_contents("hdpid.txt", getmypid());
if(!isset($_GET['fast']))
sleep(10);
}
}
public function __destruct()
{
echo "<!-- STRACE__TIMER__BREAK -->";
}
}
$varNameDoesntMatter = new LastSay();
/* END HOST DEBUG CODE */
I just removed it.