Hi!
In PHP 5.2 and earlier, the html_errors setting has always been on by
default (in the code, in php.ini-dist and in php.ini-recommended). Since
PHP 5.3, it's still on by default in the code and in
php.ini-development, but php.ini-production has it off with the
following comment:
; When PHP displays or logs an error, it has the capability of inserting html
; links to documentation related to that error. This directive controls whether
; those HTML links appear in error messages or not. For performance and security
; reasons, it's recommended you disable this on production servers.
Right now, the docref is shown whenever html_errors=1, even if
docref_root is not set (empty string).
Sadly, this means that most distributions have it off in their php.ini.
Although the setting does influence the HTML links as well, it's by no
means a security (or performance) issue and it makes using PHP in
development a lot more annoying (because distributions have the
"production" version of php.ini, and not the "development" one.
It causes many many questions being asked why Xdebug doesn't show the
pretty errors and having it odd serves nothing. (In production, you
should set display_errors off).
A few examples:
http://cloudfysh.wordpress.com/2010/06/11/php-xdebug-not-formatting-var_dump/
http://stackoverflow.com/questions/4534312/xdebug-var-dump-function-colors
http://www.paoloiannelli.com/2011/04/15/solution-for-xdebug-not-overloading-var_dump/
http://stackoverflow.com/questions/2108576/unreadable-var-dump-output-on-snow-leopard
12:00 <Famic> I just installed xdebug on my debian box
12:00 <Famic> mostly for the nice output on error messages
12:01 <Famic> but it doesn't work (i.e. I only get the default output)
12:01 <Famic> any idea ?
12:01 <Derick> http://xdebug.org/docs/faq#format
derick@xdebug:~/irclogs/OPN$ cat \#xdebug.log | grep 'faq#format' | wc -l
27
I'd like to revert this change *and* change when the docrefs are
shown, so that in 5.4 and trunk:
- html_errors is on by default again.
- the docref links are only shown when docref_root is not empty
A patch is attached. Comments?
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Index: trunk/php.ini-production
===================================================================
--- trunk/php.ini-production (revision 312158)
+++ trunk/php.ini-production (working copy)
@@ -109,7 +109,7 @@
; html_errors
; Default Value: On
; Development Value: On
-; Production value: Off
+; Production value: On
; log_errors
; Default Value: Off
@@ -537,23 +537,24 @@
; An XML-RPC faultCode
;xmlrpc_error_number = 0
-; When PHP displays or logs an error, it has the capability of inserting html
-; links to documentation related to that error. This directive controls whether
-; those HTML links appear in error messages or not. For performance and
security
-; reasons, it's recommended you disable this on production servers.
+; When PHP displays or logs an error, it has the capability of formatting the
+; error message as HTML for easier reading. This directive controls whether
+; the error message is formatted as HTML or not.
; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: On
; Development Value: On
-; Production value: Off
+; Production value: On
; http://php.net/html-errors
-html_errors = Off
+html_errors = On
-; If html_errors is set On PHP produces clickable error messages that direct
-; to a page describing the error or function causing the error in detail.
+; If html_errors is set to On *and* docref_root is not empty, then PHP
+; produces clickable error messages that direct to a page describing the error
+; or function causing the error in detail.
; You can download a copy of the PHP manual from http://php.net/docs
; and change docref_root to the base URL of your local copy including the
; leading '/'. You must also specify the file extension being used including
-; the dot. PHP's default behavior is to leave these settings empty.
+; the dot. PHP's default behavior is to leave these settings empty, in which
+; case no links to documentation are generated.
; Note: Never use this feature for production boxes.
; http://php.net/docref-root
; Examples
Index: trunk/main/main.c
===================================================================
--- trunk/main/main.c (revision 312158)
+++ trunk/main/main.c (working copy)
@@ -716,10 +716,10 @@
}
/* we have a docref for a function AND
- * - we show erroes in html mode OR
- * - the user wants to see the links anyway
+ * - we show erroes in html mode AND
+ * - the user wants to see the links
*/
- if (docref && is_function && (PG(html_errors) ||
strlen(PG(docref_root)))) {
+ if (docref && is_function && PG(html_errors) &&
strlen(PG(docref_root))) {
if (strncmp(docref, "http://", 7)) {
/* We don't have 'http://' so we use docref_root */
Index: trunk/php.ini-development
===================================================================
--- trunk/php.ini-development (revision 312158)
+++ trunk/php.ini-development (working copy)
@@ -109,7 +109,7 @@
; html_errors
; Default Value: On
; Development Value: On
-; Production value: Off
+; Production value: On
; log_errors
; Default Value: Off
@@ -537,23 +537,24 @@
; An XML-RPC faultCode
;xmlrpc_error_number = 0
-; When PHP displays or logs an error, it has the capability of inserting html
-; links to documentation related to that error. This directive controls whether
-; those HTML links appear in error messages or not. For performance and
security
-; reasons, it's recommended you disable this on production servers.
+; When PHP displays or logs an error, it has the capability of formatting the
+; error message as HTML for easier reading. This directive controls whether
+; the error message is formatted as HTML or not.
; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: On
; Development Value: On
-; Production value: Off
+; Production value: On
; http://php.net/html-errors
html_errors = On
-; If html_errors is set On PHP produces clickable error messages that direct
-; to a page describing the error or function causing the error in detail.
+; If html_errors is set to On *and* docref_root is not empty, then PHP
+; produces clickable error messages that direct to a page describing the error
+; or function causing the error in detail.
; You can download a copy of the PHP manual from http://php.net/docs
; and change docref_root to the base URL of your local copy including the
; leading '/'. You must also specify the file extension being used including
-; the dot. PHP's default behavior is to leave these settings empty.
+; the dot. PHP's default behavior is to leave these settings empty, in which
+; case no links to documentation are generated.
; Note: Never use this feature for production boxes.
; http://php.net/docref-root
; Examples
Index: branches/PHP_5_3/php.ini-production
===================================================================
--- branches/PHP_5_3/php.ini-production (revision 312158)
+++ branches/PHP_5_3/php.ini-production (working copy)
@@ -599,9 +599,9 @@
; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: On
; Development Value: On
-; Production value: Off
+; Production value: On
; http://php.net/html-errors
-html_errors = Off
+html_errors = On
; If html_errors is set On PHP produces clickable error messages that direct
; to a page describing the error or function causing the error in detail.
Index: branches/PHP_5_3/php.ini-development
===================================================================
--- branches/PHP_5_3/php.ini-development (revision 312158)
+++ branches/PHP_5_3/php.ini-development (working copy)
@@ -114,7 +114,7 @@
; html_errors
; Default Value: On
; Development Value: On
-; Production value: Off
+; Production value: On
; log_errors
; Default Value: Off
Index: branches/PHP_5_4/php.ini-production
===================================================================
--- branches/PHP_5_4/php.ini-production (revision 312158)
+++ branches/PHP_5_4/php.ini-production (working copy)
@@ -109,7 +109,7 @@
; html_errors
; Default Value: On
; Development Value: On
-; Production value: Off
+; Production value: On
; log_errors
; Default Value: Off
@@ -537,23 +537,24 @@
; An XML-RPC faultCode
;xmlrpc_error_number = 0
-; When PHP displays or logs an error, it has the capability of inserting html
-; links to documentation related to that error. This directive controls whether
-; those HTML links appear in error messages or not. For performance and
security
-; reasons, it's recommended you disable this on production servers.
+; When PHP displays or logs an error, it has the capability of formatting the
+; error message as HTML for easier reading. This directive controls whether
+; the error message is formatted as HTML or not.
; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: On
; Development Value: On
-; Production value: Off
+; Production value: On
; http://php.net/html-errors
-html_errors = Off
+html_errors = On
-; If html_errors is set On PHP produces clickable error messages that direct
-; to a page describing the error or function causing the error in detail.
+; If html_errors is set to On *and* docref_root is not empty, then PHP
+; produces clickable error messages that direct to a page describing the error
+; or function causing the error in detail.
; You can download a copy of the PHP manual from http://php.net/docs
; and change docref_root to the base URL of your local copy including the
; leading '/'. You must also specify the file extension being used including
-; the dot. PHP's default behavior is to leave these settings empty.
+; the dot. PHP's default behavior is to leave these settings empty, in which
+; case no links to documentation are generated.
; Note: Never use this feature for production boxes.
; http://php.net/docref-root
; Examples
Index: branches/PHP_5_4/main/main.c
===================================================================
--- branches/PHP_5_4/main/main.c (revision 312158)
+++ branches/PHP_5_4/main/main.c (working copy)
@@ -716,10 +716,10 @@
}
/* we have a docref for a function AND
- * - we show erroes in html mode OR
- * - the user wants to see the links anyway
+ * - we show erroes in html mode AND
+ * - the user wants to see the links
*/
- if (docref && is_function && (PG(html_errors) ||
strlen(PG(docref_root)))) {
+ if (docref && is_function && PG(html_errors) &&
strlen(PG(docref_root))) {
if (strncmp(docref, "http://", 7)) {
/* We don't have 'http://' so we use docref_root */
Index: branches/PHP_5_4/php.ini-development
===================================================================
--- branches/PHP_5_4/php.ini-development (revision 312158)
+++ branches/PHP_5_4/php.ini-development (working copy)
@@ -109,7 +109,7 @@
; html_errors
; Default Value: On
; Development Value: On
-; Production value: Off
+; Production value: On
; log_errors
; Default Value: Off
@@ -537,23 +537,24 @@
; An XML-RPC faultCode
;xmlrpc_error_number = 0
-; When PHP displays or logs an error, it has the capability of inserting html
-; links to documentation related to that error. This directive controls whether
-; those HTML links appear in error messages or not. For performance and
security
-; reasons, it's recommended you disable this on production servers.
+; When PHP displays or logs an error, it has the capability of formatting the
+; error message as HTML for easier reading. This directive controls whether
+; the error message is formatted as HTML or not.
; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: On
; Development Value: On
-; Production value: Off
+; Production value: On
; http://php.net/html-errors
html_errors = On
-; If html_errors is set On PHP produces clickable error messages that direct
-; to a page describing the error or function causing the error in detail.
+; If html_errors is set to On *and* docref_root is not empty, then PHP
+; produces clickable error messages that direct to a page describing the error
+; or function causing the error in detail.
; You can download a copy of the PHP manual from http://php.net/docs
; and change docref_root to the base URL of your local copy including the
; leading '/'. You must also specify the file extension being used including
-; the dot. PHP's default behavior is to leave these settings empty.
+; the dot. PHP's default behavior is to leave these settings empty, in which
+; case no links to documentation are generated.
; Note: Never use this feature for production boxes.
; http://php.net/docref-root
; Examples
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php