<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12207] trunk:
  Ensure WP_DEBUG is always defined and simplify the checks on it.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12207">12207</a></dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2009-11-18 08:22:49 +0000 (Wed, 18 Nov 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Ensure WP_DEBUG is always defined and simplify the checks on it. Fixes <a href="http://trac.wordpress.org/ticket/11090">#11090</a> props nacin.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
<li><a href="#trunkwpincludeshttpphp">trunk/wp-includes/http.php</a></li>
<li><a href="#trunkwpincludeswpdbphp">trunk/wp-includes/wp-db.php</a></li>
<li><a href="#trunkwpsettingsphp">trunk/wp-settings.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (12206 => 12207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2009-11-18 08:12:05 UTC (rev 12206)
+++ trunk/wp-includes/functions.php        2009-11-18 08:22:49 UTC (rev 12207)
</span><span class="lines">@@ -2927,8 +2927,7 @@
</span><span class="cx">  * to get the backtrace up to what file and function called the deprecated
</span><span class="cx">  * function.
</span><span class="cx">  *
</span><del>- * The current behavior is to trigger an user error if WP_DEBUG is defined and
- * is true.
</del><ins>+ * The current behavior is to trigger an user error if WP_DEBUG is true.
</ins><span class="cx">  *
</span><span class="cx">  * This function is to be used in every function in depreceated.php
</span><span class="cx">  *
</span><span class="lines">@@ -2949,7 +2948,7 @@
</span><span class="cx">         do_action('deprecated_function_run', $function, $replacement);
</span><span class="cx"> 
</span><span class="cx">         // Allow plugin to filter the output error trigger
</span><del>-        if( defined('WP_DEBUG') &amp;&amp; ( true === WP_DEBUG ) &amp;&amp; apply_filters( 'deprecated_function_trigger_error', true )) {
</del><ins>+        if( WP_DEBUG &amp;&amp; apply_filters( 'deprecated_function_trigger_error', true )) {
</ins><span class="cx">                 if( !is_null($replacement) )
</span><span class="cx">                         trigger_error( sprintf( __('%1$s is &lt;strong&gt;deprecated&lt;/strong&gt; since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
</span><span class="cx">                 else
</span><span class="lines">@@ -2964,8 +2963,7 @@
</span><span class="cx">  * to get the backtrace up to what file and function included the deprecated
</span><span class="cx">  * file.
</span><span class="cx">  *
</span><del>- * The current behavior is to trigger an user error if WP_DEBUG is defined and
- * is true.
</del><ins>+ * The current behavior is to trigger an user error if WP_DEBUG is true.
</ins><span class="cx">  *
</span><span class="cx">  * This function is to be used in every file that is depreceated
</span><span class="cx">  *
</span><span class="lines">@@ -2986,7 +2984,7 @@
</span><span class="cx">         do_action('deprecated_file_included', $file, $replacement);
</span><span class="cx"> 
</span><span class="cx">         // Allow plugin to filter the output error trigger
</span><del>-        if( defined('WP_DEBUG') &amp;&amp; ( true === WP_DEBUG ) &amp;&amp; apply_filters( 'deprecated_file_trigger_error', true )) {
</del><ins>+        if( WP_DEBUG &amp;&amp; apply_filters( 'deprecated_file_trigger_error', true ) ) {
</ins><span class="cx">                 if( !is_null($replacement) )
</span><span class="cx">                         trigger_error( sprintf( __('%1$s is &lt;strong&gt;deprecated&lt;/strong&gt; since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) );
</span><span class="cx">                 else
</span></span></pre></div>
<a id="trunkwpincludeshttpphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/http.php (12206 => 12207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/http.php        2009-11-18 08:12:05 UTC (rev 12206)
+++ trunk/wp-includes/http.php        2009-11-18 08:22:49 UTC (rev 12207)
</span><span class="lines">@@ -655,7 +655,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $proxy = new WP_HTTP_Proxy();
</span><span class="cx"> 
</span><del>-                if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') &amp;&amp; false === WP_DEBUG ) ) {
</del><ins>+                if ( !WP_DEBUG ) {
</ins><span class="cx">                         if ( $proxy-&gt;is_enabled() &amp;&amp; $proxy-&gt;send_through_proxy( $url ) )
</span><span class="cx">                                 $handle = @fsockopen( $proxy-&gt;host(), $proxy-&gt;port(), $iError, $strError, $r['timeout'] );
</span><span class="cx">                         else
</span><span class="lines">@@ -826,7 +826,7 @@
</span><span class="cx">                 if ( 'http' != $arrURL['scheme'] &amp;&amp; 'https' != $arrURL['scheme'] )
</span><span class="cx">                         $url = str_replace($arrURL['scheme'], 'http', $url);
</span><span class="cx"> 
</span><del>-                if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') &amp;&amp; false === WP_DEBUG ) )
</del><ins>+                if ( !WP_DEBUG )
</ins><span class="cx">                         $handle = @fopen($url, 'r');
</span><span class="cx">                 else
</span><span class="cx">                         $handle = fopen($url, 'r');
</span><span class="lines">@@ -999,7 +999,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $context = stream_context_create($arrContext);
</span><span class="cx"> 
</span><del>-                if ( ! defined('WP_DEBUG') || ( defined('WP_DEBUG') &amp;&amp; false === WP_DEBUG ) )
</del><ins>+                if ( !WP_DEBUG )
</ins><span class="cx">                         $handle = @fopen($url, 'r', false, $context);
</span><span class="cx">                 else
</span><span class="cx">                         $handle = fopen($url, 'r', false, $context);
</span><span class="lines">@@ -1167,7 +1167,7 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') &amp;&amp; false === WP_DEBUG ) ) //Emits warning level notices for max redirects and timeouts
</del><ins>+                if ( !WP_DEBUG ) //Emits warning level notices for max redirects and timeouts
</ins><span class="cx">                         $strResponse = @http_request($r['method'], $url, $r['body'], $options, $info);
</span><span class="cx">                 else
</span><span class="cx">                         $strResponse = http_request($r['method'], $url, $r['body'], $options, $info); //Emits warning level notices for max redirects and timeouts
</span><span class="lines">@@ -1184,7 +1184,7 @@
</span><span class="cx">                 $theHeaders = WP_Http::processHeaders($theHeaders);
</span><span class="cx"> 
</span><span class="cx">                 if ( ! empty( $theBody ) &amp;&amp; isset( $theHeaders['headers']['transfer-encoding'] ) &amp;&amp; 'chunked' == $theHeaders['headers']['transfer-encoding'] ) {
</span><del>-                        if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') &amp;&amp; false === WP_DEBUG ) )
</del><ins>+                        if ( !WP_DEBUG )
</ins><span class="cx">                                 $theBody = @http_chunked_decode($theBody);
</span><span class="cx">                         else
</span><span class="cx">                                 $theBody = http_chunked_decode($theBody);
</span></span></pre></div>
<a id="trunkwpincludeswpdbphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/wp-db.php (12206 => 12207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/wp-db.php        2009-11-18 08:12:05 UTC (rev 12206)
+++ trunk/wp-includes/wp-db.php        2009-11-18 08:22:49 UTC (rev 12207)
</span><span class="lines">@@ -357,7 +357,7 @@
</span><span class="cx">         function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
</span><span class="cx">                 register_shutdown_function(array(&amp;$this, &quot;__destruct&quot;));
</span><span class="cx"> 
</span><del>-                if ( defined('WP_DEBUG') and WP_DEBUG == true )
</del><ins>+                if ( WP_DEBUG )
</ins><span class="cx">                         $this-&gt;show_errors();
</span><span class="cx"> 
</span><span class="cx">                 if ( defined('DB_CHARSET') )
</span></span></pre></div>
<a id="trunkwpsettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-settings.php (12206 => 12207)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-settings.php        2009-11-18 08:12:05 UTC (rev 12206)
+++ trunk/wp-settings.php        2009-11-18 08:22:49 UTC (rev 12207)
</span><span class="lines">@@ -210,6 +210,7 @@
</span><span class="cx">                 ini_set('error_log', WP_CONTENT_DIR . '/debug.log');
</span><span class="cx">         }
</span><span class="cx"> } else {
</span><ins>+        define('WP_DEBUG', false);
</ins><span class="cx">         if ( defined('E_RECOVERABLE_ERROR') )
</span><span class="cx">                 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
</span><span class="cx">         else
</span></span></pre>
</div>
</div>

</body>
</html>