-
-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running php from cli, Whoop does not show the file, where first output or headers sent. #629
Comments
Is the latter output after the same |
Correct! One more example: Whoops disabled: server@user:~/public_html$ php -r "include 'index.php';" 2>&1 |grep database
PHP Warning: Cannot modify header information - headers already sent by (output started at /public_html/config/dev/database.php:1) in /public_html/system/library/session.php on line 54
PHP Warning: Cannot modify header information - headers already sent by (output started at /public_html/config/dev/database.php:1) in /public_html/system/library/session.php on line 54
PHP Warning: Cannot modify header information - headers already sent by (output started at /public_html/config/dev/database.php:1) in /public_html/catalog/controller/startup/startup.php on line 139
PHP Warning: Cannot modify header information - headers already sent by (output started at /public_html/config/dev/database.php:1) in /public_html/catalog/controller/startup/startup.php on line 222 With Whoops enabled - Output does not have anything about server@user:~/public_html$ php -r "include 'index.php';" 2>&1 |grep database
server@user:~/public_html$ |
And that’s only in CLI, not if you run it through the HTTP server? |
Yes, correct. The problem is with calling I had xdebug module enabled, I disabled it so output is a little bit different. But problem persists. So, I created test script. I have compared php.ini versions for both, php 7.0 and php 7.3 - did not notice any different settings regarding sessions or debug output. PHP 7.0 does display warning correctly but PHP 7.3 doesn't. Test case - both, with Whoops disabled (let's narrow to vanila PHP): Create <?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
file_put_contents('bogus.php', "<?php echo 'x'; ");
require_once "bogus.php";
session_start(); And here are 2 outputs from PHP 7.0 server@user:~/public_html$ /usr/bin/php7.0 -r "include 'arnis.php';"
server@user:~/public_html$ /usr/bin/php7.0 -r "include 'arnis.php';"
xPHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /public_html/bogus.php:1) in /public_html/arnis.php on line 9
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /public_html/bogus.php:1) in /public_html/arnis.php on line 9
PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /public_html/bogus.php:1) in /public_html/arnis.php on line 9 and PHP 7.3 server@user:~/public_html$ /usr/bin/php7.3 -r "include 'arnis.php';"
xPHP Warning: session_start(): Cannot start session when headers already sent in /public_html/arnis.php on line 9
Warning: session_start(): Cannot start session when headers already sent in /public_html/arnis.php on line 9 |
Thanks for an extensive report. I don’t have a quick fix right now, hopefully we figure it out in time, let’s keep it open. |
This is simple solution, how to check "Headers already sent" lines |
Problem arises because of disabled output buffering of php. In php cli output buffering is disabled and can not be enabled in any way. But whoops relies on output buffering when handling exceptions |
Reproduce:
Tested PHP version:
7.2.19, 7.3.6,
Whoops version:
2.3.1
I recently missed "space" into some configuration file. With Whoops turned off, php output shows:
But with Whoops enabled, I have no idea, which file to blame:
Is there something to be done?
The text was updated successfully, but these errors were encountered: