Last modified: 2007-12-06 21:08:51 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T14184, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12184 - dumpBackup.php stderr sent to stdout
dumpBackup.php stderr sent to stdout
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.12.x
All All
: Low minor (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-12-02 23:13 UTC by Dan Jacobson
Modified: 2007-12-06 21:08 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Dan Jacobson 2007-12-02 23:13:07 UTC
All seems well:
$ php dumpBackup.php --current > backup.xml
$

Until one day one looks inside:
$ cat backup.xml
DB connection error: Unknown MySQL server host 'mysql.mywiki.tw' (1) (mysql.mywiki.tw)

Therefore, please make sure stderr stuff goes to stderr, and not
stdout.

(Yes, one can still do php dumpBackup.php||echo 1>&2 FAILED)
Comment 1 Brion Vibber 2007-12-06 18:55:41 UTC
PHP spews errors to stdout by default. It may be possible to redirect it to stderr, though...
Comment 2 Brion Vibber 2007-12-06 21:08:51 UTC
Ok, made changes on two fronts in r28222:

First, the exception reporting has been updated to send output to stderr when in command-line mode. This takes care of database connection errors and various other reportage from MediaWiki code that's done with exceptions.

Second, the commandLine.inc setup checks if 'display_errors' is on and, for PHP 5.2.4 or later, switches it to the 'stderr' setting instead. This will cause PHP warnings and errors to also be sent to stderr instead of the stdout stream. However it won't apply to errors which occur before that point in setup is reached, nor will it have any affect on older versions of PHP.

I also tweaked backup.inc and dumpTextPass to use the stderr mode, which will just disable for older versions of PHP (eg, same as the old behavior setting to false).



As of PHP 5.2.4:

- Changed "display_errors" php.ini option to accept "stderr" as value which 
  makes the error messages to be outputted to STDERR instead of STDOUT with 
  CGI and CLI SAPIs (FR #22839). (Jani)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links