<!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>[16377] trunk: Properly check, initialize, or cast a number of variables.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16377">16377</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-11-15 06:38:10 +0000 (Mon, 15 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Properly check, initialize, or cast a number of variables. props ChenHui. see <a href="http://trac.wordpress.org/ticket/14642">#14642</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmineditphp">trunk/wp-admin/edit.php</a></li>
<li><a href="#trunkwpadminincludesimageeditphp">trunk/wp-admin/includes/image-edit.php</a></li>
<li><a href="#trunkwpadminincludesuserphp">trunk/wp-admin/includes/user.php</a></li>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmineditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit.php (16376 => 16377)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit.php        2010-11-14 20:35:42 UTC (rev 16376)
+++ trunk/wp-admin/edit.php        2010-11-15 06:38:10 UTC (rev 16377)
</span><span class="lines">@@ -13,12 +13,13 @@
</span><span class="cx"> $wp_list_table->check_permissions();
</span><span class="cx">
</span><span class="cx"> // Back-compat for viewing comments of an entry
</span><del>-if ( $_redirect = intval( max( @$_REQUEST['p'], @$_REQUEST['attachment_id'], @$_REQUEST['page_id'] ) ) ) {
-        wp_redirect( admin_url('edit-comments.php?p=' . $_redirect ) );
-        exit;
-} else {
-        unset( $_redirect );
</del><ins>+foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
+        if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
+                wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
+                exit;
+        }
</ins><span class="cx"> }
</span><ins>+unset( $_redirect );
</ins><span class="cx">
</span><span class="cx"> // Handle bulk actions
</span><span class="cx"> $doaction = $wp_list_table->current_action();
</span></span></pre></div>
<a id="trunkwpadminincludesimageeditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/image-edit.php (16376 => 16377)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/image-edit.php        2010-11-14 20:35:42 UTC (rev 16376)
+++ trunk/wp-admin/includes/image-edit.php        2010-11-15 06:38:10 UTC (rev 16377)
</span><span class="lines">@@ -422,7 +422,7 @@
</span><span class="cx">         $file = get_attached_file($post_id);
</span><span class="cx">         $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
</span><span class="cx">         $restored = false;
</span><del>-        $msg = '';
</del><ins>+        $msg = new stdClass;
</ins><span class="cx">
</span><span class="cx">         if ( !is_array($backup_sizes) ) {
</span><span class="cx">                 $msg->error = __('Cannot load image metadata.');
</span><span class="lines">@@ -493,7 +493,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function wp_save_image($post_id) {
</span><del>-        $return = '';
</del><ins>+        $return = new stdClass;
</ins><span class="cx">         $success = $delete = $scaled = $nocrop = false;
</span><span class="cx">         $post = get_post($post_id);
</span><span class="cx">         @ini_set('memory_limit', '256M');
</span></span></pre></div>
<a id="trunkwpadminincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/user.php (16376 => 16377)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/user.php        2010-11-14 20:35:42 UTC (rev 16376)
+++ trunk/wp-admin/includes/user.php        2010-11-15 06:38:10 UTC (rev 16377)
</span><span class="lines">@@ -55,14 +55,14 @@
</span><span class="cx"> */
</span><span class="cx"> function edit_user( $user_id = 0 ) {
</span><span class="cx">         global $wp_roles, $wpdb;
</span><del>-        if ( $user_id != 0 ) {
</del><ins>+        $user = new WP_User( $user_id );
+        if ( $user_id ) {
</ins><span class="cx">                 $update = true;
</span><span class="cx">                 $user->ID = (int) $user_id;
</span><span class="cx">                 $userdata = get_userdata( $user_id );
</span><span class="cx">                 $user->user_login = $wpdb->escape( $userdata->user_login );
</span><span class="cx">         } else {
</span><span class="cx">                 $update = false;
</span><del>-                $user = '';
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( !$update && isset( $_POST['user_login'] ) )
</span></span></pre></div>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (16376 => 16377)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2010-11-14 20:35:42 UTC (rev 16376)
+++ trunk/wp-includes/functions.php        2010-11-15 06:38:10 UTC (rev 16377)
</span><span class="lines">@@ -4232,7 +4232,7 @@
</span><span class="cx">                 foreach( $extra_headers as $key=>$value ) {
</span><span class="cx">                         $extra_headers[$key] = $key;
</span><span class="cx">                 }
</span><del>-                $all_headers = array_merge($extra_headers, $default_headers);
</del><ins>+                $all_headers = array_merge( $extra_headers, (array) $default_headers );
</ins><span class="cx">         } else {
</span><span class="cx">                 $all_headers = $default_headers;
</span><span class="cx">         }
</span></span></pre>
</div>
</div>
</body>
</html>