Req->Doc #39492 [Opn->Ver]: log_errors do not use error_append_string directive

[email protected] Tue, 23 Nov 2021 12:19:03 +0000
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=39492&edit=1

 ID:                 39492
 Updated by:         [email protected]
 Reported by:        frederic dot linot at free dot fr
 Summary:            log_errors do not use error_append_string directive
-Status:             Open
+Status:             Verified
-Type:               Feature/Change Request
+Type:               Documentation Problem
 Package:            PHP options/info functions
 Operating System:   *
 PHP Version:        5.*
 Block user comment: N
 Private report:     N

 New Comment:

From looking at the implementation[1], error_prepend_string and
error_append_string are indeed only used when displaying the
string on the screen.  From looking at the default php.ini
files[2], the reasoning becomes clear: these INI directives are
designed to be able to mark up the error message HTML, and as such
the implementation is deliberate.  This needs to be documented,
though.

Changing the behavior would require an RFC, so anybody who is
still looking for this is welcome to the pursue the RFC
process[3].

[1] <https://github.com/php/php-src/blob/php-7.4.26/main/main.c#L1390-L1419>
[2] <https://github.com/php/php-src/blob/php-7.4.26/php.ini-development#L570-L580>
[3] <https://wiki.php.net/rfc/howto>


Previous Comments:
------------------------------------------------------------------------
[2009-08-17 07:54:13] brad dot mcnay at webarena dot com dot au

I am also having this problem. The error_prepend_string shows when the 
error is displayed, but not in the log file. Any word on when this 
feature will be available?

------------------------------------------------------------------------
[2006-11-13 09:34:57] frederic dot linot at free dot fr

Reproduce code was not complete, sorry.. (last line was omitted)
Here is :

error_reporting(E_ALL) ; 
ini_set('error_log', 'errors.txt') ;
ini_set('html_errors', false) ;
ini_set('error_append_string', " -- ".$_SERVER['REQUEST_URI']) ;
ini_set('log_errors', true) ;
ini_set('display_errors', true) ;
trigger_error("Show me the error_append_string please !") ;

------------------------------------------------------------------------
[2006-11-13 09:31:56] frederic dot linot at free dot fr

Description:
------------
error_append_string directive not used when error is logged in a file.
Just used when error is displayed on screen.

Reproduce code:
---------------
error_reporting(E_ALL) ; 
ini_set('error_log', 'errors.txt') ;
ini_set('html_errors', false) ;
ini_set('error_append_string', " -- ".$_SERVER['REQUEST_URI']) ;
ini_set('log_errors', true) ;
ini_set('display_errors', true) ;

Expected result:
----------------
in errors.txt file :
Notice: Show me the error_append_string please ! in /home/fred/www/EasyZik-2006-10-29/test.php on line 9 -- /test.php

on screen :
Notice: Show me the error_append_string please ! in /home/fred/www/EasyZik-2006-10-29/test.php on line 9 -- /test.php

Actual result:
--------------
in errors.txt file :
Notice: Show me the error_append_string please ! in /home/fred/www/EasyZik-2006-10-29/test.php on line 9

on screen :
Notice: Show me the error_append_string please ! in /home/fred/www/EasyZik-2006-10-29/test.php on line 9 -- /test.php


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=39492&edit=1