note 102440 deleted from errorfunc.configuration by peehaa

From: Date: Fri, 09 Dec 2016 22:59:08 +0000
Subject: note 102440 deleted from errorfunc.configuration by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208407@lists.php.net to get a copy of this message
Note Submitter: geompse at gmail dot com ---- Note that if error_log is empty, errors/warnings/notices will be written to stderr (standard error stream), and this may be a problem if you is PHP in CLI. <?php # test.php error_reporting(E_ALL); ini_set('display_errors','On'); ini_set('error_log','my_file.log'); foreach(1 as $i); ini_set('error_log',''); foreach(1 as $i); ini_set('error_log','/dev/null'); #linux foreach(1 as $i); ?> php -f test.php will output : <? Warning: Invalid argument supplied for foreach() in /test.php on line 7 # stdout PHP Warning: Invalid argument supplied for foreach() in /test.php on line 10 # stderr Warning: Invalid argument supplied for foreach() in /test.php on line 10 # stdout Warning: Invalid argument supplied for foreach() in /test.php on line 13 # stdout ?> Errors displayed in the stdout (standard output stream) car be catched with the output buffering functions (ob_start/ob_get_clean) while strerr cannot.

« previous php.notes (#208407) next »